Another issue that I’m running into is that I am not seeing changes made to my screen surface. I am testing this by drawing a square once, then updating in the loop. It does not clear the original square from the screen. What am I doing wrong?
Here is a sample of drawing the square, then updating the screen in the run loop:
void draw_square(int x, int y, int width)
{
? SDL_Rect rect = {x, y, width, width};
? SDL_FillRect(screenSurface, &rect, SDL_MapRGB(screenSurface->format, 0xFF, 0xFF, 0xFF));
}
You can “clear” a surface with: SDL_FillRect(screenSurface, NULL, 0x000000);
I would recommend following an SDL tutorial. They all try to get across
the style and flow of SDL usage and should be pretty easily translatable to
SDL2.
Jonny DOn Tue, Nov 12, 2013 at 5:33 PM, Andrew Havens wrote:
Another issue that I’m running into is that I am not seeing changes made
to my screen surface. I am testing this by drawing a square once, then
updating in the loop. It does not clear the original square from the
screen. What am I doing wrong?
Here is a sample of drawing the square, then updating the screen in the
run loop:
void draw_square(int x, int y, int width)
{
SDL_Rect rect = {x, y, width, width};
SDL_FillRect(screenSurface, &rect, SDL_MapRGB(screenSurface->format,
0xFF, 0xFF, 0xFF));
}
Furthermore, it looks like you are rendering the square just once (before entering the loop). Move the draw_square call inside the loop.
– Aggelos KolaitisOn 13 ??? 2013, at 1:10 ?.?., Jonathan Dearborn wrote:
You can “clear” a surface with: SDL_FillRect(screenSurface, NULL, 0x000000);
I would recommend following an SDL tutorial. They all try to get across the style and flow of SDL usage and should be pretty easily translatable to SDL2.
Jonny D
On Tue, Nov 12, 2013 at 5:33 PM, Andrew Havens wrote:
Another issue that I’m running into is that I am not seeing changes made to my screen surface. I am testing this by drawing a square once, then updating in the loop. It does not clear the original square from the screen. What am I doing wrong?
Here is a sample of drawing the square, then updating the screen in the run loop:
void draw_square(int x, int y, int width)
{
SDL_Rect rect = {x, y, width, width};
SDL_FillRect(screenSurface, &rect, SDL_MapRGB(screenSurface->format, 0xFF, 0xFF, 0xFF));
}