Archived

This topic is now archived and is closed to further replies.

Is it possible to set a specific window size in SDL?

This topic is 5129 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m in my experimenting stage with SDL and I was just wondering if it''s possible to set the window size to a certain number of pixels. Can I? (And yes, I''ve looked through the documentation but couldn''t find anything)
R.I.P. Mark Osback Solo Pa Mi Gente VG-Force

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Not sure what you mean.
The window size is the size of the screen you set when initializing the SDL video part.
I.e. if your screen is 640x480 your window will have this size, too.

Share this post


Link to post
Share on other sites

const int SCREEN_WIDTH = 800;
const int SCREEN_HEIGHT = 600;
const int SCREEN_BPP = 16;

SDL_Surface * screen = NULL;

void InitSDL()
{
...
// an example

screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE);
...
}

int main()
{
...
InitSDL();
...
}




daveandrews.org - a Christian Programmer's Weblog | Dusty Engine - a task engine using Irrlicht

[edited by - Ronin Magus on November 28, 2003 9:49:35 AM]

Share this post


Link to post
Share on other sites
Derr...lemme try to explain. Ok, you know how you can resize a window by dragging the borders of the window itself? If you drag it a few inches up, and to the left, you get a rectangle taking up only a portion of the screen. You can still see part of your desktop. Is there a way in which I can make SDL to initialize the size of that rectangle?



R.I.P. Mark Osback
Solo Pa Mi Gente
VG-Force

Share this post


Link to post
Share on other sites