[SDL] resizable windows

nfries88 nfries88 at yahoo.com
Wed Mar 3 14:01:11 PST 2010


Lilly wrote:
> Yes, I understood that part. But what about the rest ? Does it need to be written before the loop as well, like this (see the code below) ? 
> I find it weird that I have to type the same thing (the drawing) twice in my code.
> The first time before the loop, and the second time inside the loop.

You don't actually have to do that.


Lilly wrote:
> - Why doesn't it work if I replace PollEvent by WaitEvent ? I thought the only difference is that PollEvent is better suited for windows using time controls, so that some things can happen even when no event occur. But I get a black screen...

Call SDL_Flip(screen) before the loop as well, it should fix that.
However if you plan on implementing an AI opponent for your checkers/chess game, then stick with PollEvent.


Lilly wrote:
> When I start playing with the resize tool, I find that sometimes the board is neither touching the bottom of the window nor its right side. Shouldn't it get filled in to the minimum length between width and height ?
> 
> I also noticed that the window size isn't updated until I remove my finger from the mouse click button. Is it possible to update the window size automatically, as it is for other system's windows ?

SDL doesn't seem to put out "SDL_VIDEORESIZE" events during the resize operation, only at the end. It's probably better this way for advanced UI apps (constantly resizing might cause choppiness in rendering as things are shifted).
You can parse system window manager events for resizing events if you want, but this will be different for every system.


Lilly wrote:
> I'm using codeblocks and windows xp. When I run my program, there's cmd.exe in the background. Isn't there a way to make it not appear like that ?

Tell Code::Blocks that your program is a GUI program. It thinks it's a Console program.


Lilly wrote:
> My next step will be to resize images. How can I resize bitmap images ?

SDL 1.2 does not provide this functionality. You will need to use a separate library; Sprig, SGE, or SDL_gfx.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20100303/00d7eafd/attachment.htm>


More information about the SDL mailing list