[SDL] Code Snippet...

Christopher Subich csubich at subich.com
Sun Nov 17 09:14:01 PST 2002


At 01:23 PM 11/17/02 +1100, you wrote:
>I wrote a very simple code snippet (inspired by apple),
>incase any one is interested.
>
>This is it...
>
>void SDL_SetRect(SDL_Rect *Rect, Sint16 x, Sint16 y, Uint16 w, Uint16 h);
>
>void SDL_SetRect(SDL_Rect *Rect, Sint16 x, Sint16 y, Uint16 w, Uint16 h)
>{
>     Rect->x = x;
>     Rect->y = y;
>     Rect->w = w;
>     Rect->h = h;
>}

Change it to SDL_Rect * SDL_SetRect(...), and have the function return Rect 
-- then you can use it inside of a function call needing the SDL_Rect *, 
instead of having to set it above the call.


--
"It startled him even more when just after he was awarded the Galactic 
Institute's Prize for Extreme Cleverness he got lynched by a rampaging mob 
of respectable physicists who had finally realized that the one thing they 
really couldn't stand was a smart-ass."
   -- Hitchhiker's Guide to the Galaxy





More information about the SDL mailing list