SDL,vector, with reference question

Started by
10 comments, last by rip-off 11 years, 7 months ago
One way to get a new surface is to call SDL_CreateRGBSurface.
Advertisement

Here it dereferences dst without a check for null. Also, the API documentation doesn't say anything about ignoring a null destination pointer.
[/quote]
The implementation I found is apparently SDL 1.3. The implementation you posted seems to be SDL 1.2.


Also, the API documentation doesn't say anything about ignoring a null destination pointer.
[/quote]
SDL is fairly defensively programmed from what I remember. It is usually pretty good at letting you know when you've done something wrong without crashing on you (where it can). From the above it certainly seems they are moving towards being more defensive. It would be nice for this to be documented behaviour rather than a nice bonus.


Now what i am trying to achieve is :

Create a vector list of SDL_Surfaces
there will be around 10 SDL_Surfaces, Each is supposed to be a random box
Width and height is random 1-100pixels
[/quote]
A high level description is:

I want to be able to draw around 10 random boxes (between 1 and 100 pixels).

Talking about SDL_Surfaces is too low level. Why? Because there might be other approaches. For example, to solve this higher level goal, you might see that you don't actually need to store surfaces - you could store rectangles and use SDL_FillRect on the screen surface directly.

This topic is closed to new replies.

Advertisement