i i've just started using nokia's extensions for midp, and there are some things that i'm not getting.
for example the DirectGraphics, in my paint method i have something like this, in the very end
public void paint(Graphics g){
........
offScreen = DirectUtils.getDirectGraphics(g);
}
then later on my have one of the most requested methods in the whole app
public boolean hasHit(int posX, posY){
int[] pixels = new int[20];
int format = offScreen.getNativePixelFormat();
offScreen.getPixels(pixels, 0,0,posX,posY,1,20, format);
for(int i = 0; i < pixels.length; i++){
if(pixels[i] != GAME_BLUE){
hasHit = true;
}
}
and this is simply not working, more likely because of something i'm doing wrong, but just can't see what.
my intention is to get a heigth 20 verical line with 1 width, and to check the values in it.
but i when i look into the array, i only see zero's.
and another thing, how do i transform 0x05143F into TYPE_USHORT_4444_ARGB;
thanks in advance for your time
wills

Reply With Quote


