Easy C typecast/SDL problem...
I'm just trying to plot one pixel directly to a surface (which has already been locked, et al) with...
...unfortunately, I just get reported the error "invalid use of void expression" - I've tried to typecast the plot, but this merely changes the error reported - any suggestions?
Code:
theSurface->pixels[ (( 640 * ( y - 1 )) + x ) ] = SDL_MapRGB( theSurface->format, 255, 0, 0 );Mark Bishop
Quote:...unfortunately, I just get reported the error "invalid use of void expression" - I've tried to typecast the plot, but this merely changes the error reported - any suggestions?Code:
theSurface->pixels[ (( 640 * ( y - 1 )) + x ) ] = SDL_MapRGB( theSurface->format, 255, 0, 0 );
based on that, it would seem SDL_MapRGB returns void.
check the prototype for SDL_MapRGB.
kevin
No, the pixels member of SDL_Surface is the void pointer - which is where the plot/assignment falls apart...
Mark Bishop
if pixels is void* then you have to cast it first.
int *pix_ptr = theSurface->pixels;
pix_ptr[ blah] = SDL_MapRGB (...)
int *pix_ptr = theSurface->pixels;
pix_ptr[ blah] = SDL_MapRGB (...)
Thanks, I'd completely overlooked that...
Thanks!
Thanks!
Mark Bishop
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Easy AudioServicesDisposeSystemSoundID question :D | the_wandering_monster | 0 | 2,583 |
Oct 20, 2009 02:18 AM Last Post: the_wandering_monster |
|
| very simple and easy bmp loading for openGL | c_young | 9 | 7,922 |
Jan 20, 2007 11:08 AM Last Post: Skorche |
|
| Easy 3d engines | DudetheCreator | 1 | 2,310 |
Oct 16, 2004 10:42 AM Last Post: AnotherJake |
|

