If you’re compiling on Windows, make sure you are compiling as a
console app or you might not get any output from printf() even when
program is run from a console. Also, there’s a minimum window size on
Windows, 320x240 is probably OK, but try increasing it to 640x480.
Try assigning a renderer before showing the window and call
SDL_UpdateWindow() after SDL_ShowWindow().
Don’t use sleep(10), you could try SDL_Delay(10000), but you’re better
to implement an event loop. Look up SDL_WaitEvent() and SDL_PollEvent
in the documentation wiki. On Windows, and probably other platforms,
SDL may need to respond to events for the window to actually show up,
which means SDL_PumpEvents() needs to be called a few times after the
window is created and shown. SDL_WaitEvent() or SDL_PollEvent() will
take care of this for you.On 18/05/2010, Lohitha R <lohitha.r at globaledgesoft.com> wrote:
Hi,
Can any one tell, how to use SDL 1.3, some sample code, which
is used to creat SDL window, and etc…
I wrote one test.c but I didn’t get output for that,
#include <SDL/SDL.h>
int main()
{
SDL_Window *win = NULL;
int width = 320, height = 240;
I don’t why I’m not getting error or proper output, Please guide me…
I think i’m not using the APIs properly…
If you’re compiling on Windows, make sure you are compiling as a
console app or you might not get any output from printf() even when
program is run from a console. Also, there’s a minimum window size on
Windows, 320x240 is probably OK, but try increasing it to 640x480.
Try assigning a renderer before showing the window and call
SDL_UpdateWindow() after SDL_ShowWindow().
Don’t use sleep(10), you could try SDL_Delay(10000), but you’re better
to implement an event loop. Look up SDL_WaitEvent() and SDL_PollEvent
in the documentation wiki. On Windows, and probably other platforms,
SDL may need to respond to events for the window to actually show up,
which means SDL_PumpEvents() needs to be called a few times after the
window is created and shown. SDL_WaitEvent() or SDL_PollEvent() will
take care of this for you.