Hi!, i have a problem with SDL_CreateRGBSurfaceFrom() and SDL_CreateRGBSurfaceWithFormatFrom() functions, i have been trying to convert an array of pixels to a Surface but SDL dont let me draw well. Pixels are read each 4Bytes, on windows it is a DWORD (32bits) and RGB are 3Bytes, i think thats its the problem but now, what can i do?, am lost, i need to find a way to convert my pixels array to a Surface struct or ignore that byte but that is out of my range. Help plx!
That’s my example:
int data[25]= {
65280,255,400,255,255,
255,255,255,255,255,
255,255,255,255,255,
255,255,255,255,255,
255,255,255,255,255
};
//I try both
//SDL_Surface* menu = SDL_CreateRGBSurfaceWithFormatFrom((void*)data, 5, 5, 24, 35, SDL_PIXELFORMAT_RGB24);
SDL_Surface menu = SDL_CreateRGBSurfaceFrom((void*)data, 5, 5, 24, 5*3, 0, 0, 0, 0);
next, i call render copy with dimensions and get this :c
RGB
The black ones are the bytes that i cannot reach with code.