A Newbie SDL Question
Moderator: Coders of Rage
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
A Newbie SDL Question
How do you maximize a window? I know how to set the size to 1024*768(My dimensions), and I'm sure there is a way to set the windows position, but thats not true maximize. Anyone know? Is it as simple as "SDL_WindowMaximize(blah);"
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: A Newbie SDL Question
you can pass a combination of the flags SDL_FULLSCREEN and SDL_NOFRAME (using bitwise XOR, ^) so that you have a fullscreen window with a frame. Example in pseudocode:
you have to XOR out SDL_NOFRAME because, by default, it is included in SDL_FULLSCREEN.
Hope I helped.
Code: Select all
if(player maximizes window)
{
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, (SDL_SWSURFACE|SDL_RESIZABLE|SDL_FULLSCREEN)^SDL_NOFRAME);
}
Hope I helped.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: A Newbie SDL Question
Umm... How do I XOR noframe? And I tried that code you had there, and it errored, went non-responding, then crashed. :D
EDIT: Also, I'm displaying PNG's with Alpha pre-made... and they are displaying with a black background... how do I make it interpret the alpha values?
EDIT: Also, I'm displaying PNG's with Alpha pre-made... and they are displaying with a black background... how do I make it interpret the alpha values?
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: A Newbie SDL Question
#1. Use the debugger, check what error you get. Also, check if there's an stderr.txt or stdout.txt in the executable's folder. It may have information on the crash.
#2. If you're colorkeying, premade transparancy won't work.
Hopefully that helps.
#2. If you're colorkeying, premade transparancy won't work.
Hopefully that helps.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
- wtetzner
- Chaos Rift Regular
- Posts: 159
- Joined: Wed Feb 18, 2009 6:43 pm
- Current Project: waterbear, GBA game + editor
- Favorite Gaming Platforms: Game Boy Advance
- Programming Language of Choice: OCaml
- Location: TX
- Contact:
Re: A Newbie SDL Question
in this tutorial: http://www.lazyfoo.net/SDL_tutorials/le ... /index.phpibly31 wrote:EDIT: Also, I'm displaying PNG's with Alpha pre-made... and they are displaying with a black background... how do I make it interpret the alpha values?
Where he has
Code: Select all
//If nothing went wrong in loading the image
if( loadedImage != NULL )
{
//Create an optimized image
optimizedImage = SDL_DisplayFormat( loadedImage );
//Free the old image SDL_FreeSurface( loadedImage );
}
The novice realizes that the difference between code and data is trivial. The expert realizes that all code is data. And the true master realizes that all data is code.
- PixelP
- Chaos Rift Regular
- Posts: 153
- Joined: Tue Oct 07, 2008 12:23 pm
- Programming Language of Choice: c/c++
- Location: sweden
- Contact:
Re: A Newbie SDL Question
this should get the job done.
http://www.libsdl.org/cgi/docwiki.cgi/S ... FullScreen
Code: Select all
#include "SDL.h"
int SDL_WM_ToggleFullScreen(SDL_Surface *surface);
- Kros
- Chaos Rift Regular
- Posts: 136
- Joined: Tue Feb 24, 2009 4:01 pm
- Current Project: N/A
- Favorite Gaming Platforms: PC, Playstation/2/3
- Programming Language of Choice: C++
- Location: Oregon,USA
- Contact:
Re: A Newbie SDL Question
There is a slight difference between fullscreen and a maximized window. Mayhaps he should clarify which hes looking to accomplish?PixelP wrote:this should get the job done.http://www.libsdl.org/cgi/docwiki.cgi/S ... FullScreenCode: Select all
#include "SDL.h" int SDL_WM_ToggleFullScreen(SDL_Surface *surface);
YouTube ChannelIsaac Asimov wrote:Part of the inhumanity of the computer is that, once it is competently programmed and working smoothly, it is completely honest.
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: A Newbie SDL Question
I want, when you click that little button on the top right hand corner; maximized. NOT fullscreen. How is it done? Because the other code made the screen go black except for the start bar and them freeZe and crash...
EDIT:
I took away the XOR of noframe and it works fine, except I had to add a little event SDLK_ESCAPE checker to exit instead of the X button event. Thanks!
EDIT:
I took away the XOR of noframe and it works fine, except I had to add a little event SDLK_ESCAPE checker to exit instead of the X button event. Thanks!
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.