Jump to content
  • Advertisement

Archived

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

Ekim_Gram

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

This topic is 5374 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
Advertisement
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
I don''t have the answer, but I believe that he is looking to have 640X480 resolution in a 320X240 window type thing..

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
that''s still not very clear. Rectangle... you mean the resized window? Maybe post a screenshot to show what you mean





--{You fight like a dairy farmer!}

Share this post


Link to post
Share on other sites
respond to the resize event (look in the docs) and send a brand new SDL_SEtVideoMode for the appropriate size. (found in the msg struct)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!