Fullscreen woes and troubles SOLVED

Started by
5 comments, last by Talmir 18 years, 8 months ago
I am having problems with my code. I am learning the basics of sdl in order to create a tetris clone.. When I run the code so far in windowed mode it works correctly. Shows my images in theyr places and all is good. But when I switch to fulscreen I get a black screen and a mouse cursor.. nothing more.. Anyone know what is going on? Within these links you find my code files : http://muer.njoerdba.com/paste/view.aspx?id=33863e91-e8dc-4ef0-a627-b0e19934e23a http://muer.njoerdba.com/paste/view.aspx?id=0f1e82b7-36f7-4e2e-bb83-1e1195fdc822 http://muer.njoerdba.com/paste/view.aspx?id=c19b9466-85a4-4404-86e7-c8c3b054ca52 http://muer.njoerdba.com/paste/view.aspx?id=3cedfbb7-bcb1-4244-aa17-990c0008ffb8 If anyone would like to take a look I´ll be gratefull :) [Edited by - Talmir on July 28, 2005 5:45:38 PM]
Advertisement
Links clickified for lazy people:
main
includes
gamestate
bitmaps

Did you switch to fullscreen when the program started or in the middle of it after you already showed all the bitmaps?
Now get down on your hands and knees and start repeating "Open Source Good, M$ Evil", smacking your head against the pavement after each repetition. Once you have completed your training you may change your first name to GNU/, to show that you are free from the slavery of the closed source world. -Michalson
The fullscreen change is the first thing that happens. Since it is the first instruction the game runs.

like so:
Screen = SDL_SetVideoMode(640, 480, 16, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN);
I really don't know much about SDL because I only played around with it once to make a small game but eventually gave up because of lack of time.
Hopefully someone else can solve this because I can only show you what I did and this line worked for me but it's not much different from what you do.

if (fullscreen) {screen = SDL_SetVideoMode(resolution.x, resolution.y, resolution.z, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN | SDL_ANYFORMAT );}	else screen = SDL_SetVideoMode(resolution.x, resolution.y, resolution.z, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_ANYFORMAT );


The only thing I did different was to use SDL_ANYFORMAT but I'm completely unsure if that might work. I have just read about SDL_ANYFORMAT and I think it doesn't have anything to do with your problem...
SDL_ANYFORMAT
Normally, if a video surface of the requested depth (bpp) is not available, SDL
will emulate one with a shadow surface. Passing SDL_ANYFORMAT prevents this and
causes SDL to use the video surface, regardless of its depth.
Now get down on your hands and knees and start repeating "Open Source Good, M$ Evil", smacking your head against the pavement after each repetition. Once you have completed your training you may change your first name to GNU/, to show that you are free from the slavery of the closed source world. -Michalson
dont use hwsurface
You can query SDL for a set of supported screen resolutions. I usually find I have any resolutions I like in windowed mode, but a set of only 8 or so in fullscreen. If you ask for an unsupported screen resolution I don't actually know what happens.
My problem lay in the locking of surfaces.. the code was faulty :P Thanks for your help everyone :)

This topic is closed to new replies.

Advertisement