![]() |
|
Easy C typecast/SDL problem... - Printable Version +- iDevGames Forums (http://www.idevgames.com/forums) +-- Forum: Development Zone (/forum-3.html) +--- Forum: Graphics & Audio Programming (/forum-9.html) +--- Thread: Easy C typecast/SDL problem... (/thread-6692.html) |
Easy C typecast/SDL problem... - sealfin - Oct 10, 2003 08:53 AM I'm just trying to plot one pixel directly to a surface (which has already been locked, et al) with... Code: theSurface->pixels[ (( 640 * ( y - 1 )) + x ) ] = SDL_MapRGB( theSurface->format, 255, 0, 0 );Easy C typecast/SDL problem... - hams - Oct 10, 2003 09:35 AM Quote: based on that, it would seem SDL_MapRGB returns void. check the prototype for SDL_MapRGB. kevin Easy C typecast/SDL problem... - sealfin - Oct 10, 2003 10:04 AM No, the pixels member of SDL_Surface is the void pointer - which is where the plot/assignment falls apart... Easy C typecast/SDL problem... - hams - Oct 10, 2003 12:06 PM if pixels is void* then you have to cast it first. int *pix_ptr = theSurface->pixels; pix_ptr[ blah] = SDL_MapRGB (...) Easy C typecast/SDL problem... - sealfin - Oct 10, 2003 12:39 PM Thanks, I'd completely overlooked that... Thanks!
|