Hallo,
I am using a API which does not have any setPixel() functions, instead it just has a long array. Im trying to make my own setPixel() function, but im not really sure im doing it the right way.
This is how I try to set the color of a pixel:
Thanks for your timeCode:#define SCREEN_WIDTH 768 #define SCREEN_HEIGHT 512 #define BYTES_PER_PIXEL 4 // yPos and xPos are integers. // Is this the correct calculation? int pixelOffset = BYTES_PER_PIXEL * ((yPos * SCREEN_WIDTH)) + xPos); screen[pixelOffset ] = 255; screen[pixelOffset +1] = 255; screen[pixelOffset +2] = 255; //screen[pixelOffset +3] = 255; Alpha channel, not used