Sign in to follow this  
ReclusiveFreak

SDL: changing video modes inside the game

Recommended Posts

Greetings Gamedev members. I am learning to program little games (NES, SNES style) for fun in my spare time. I've programmed a nice little tetris game that is like "The New Tetris" for the Nintendo 64 in that you can make gold and silver squares,etc. My question is thus: I would like the user to be able to change the video mode within the game, like an option in the menu. I have written a test program that displays a bitmap and allows you to change the video mode from 1024x768 fullscreen to 800x600 windowed by pressing "v". This works successfully. However, it obviously doesn't scale down my bitmap files. (ie my sprites and what have you). So if I go from 1024x768 to 800x600, my game is too big for the screen. Is there an easy way to change the videomode such that your graphics scale up/down with the screen resolution? If there's not an easy way, what is the conventional way? Should I use an SDL-gfx library I found which allows you to zoom in and out on sprites to adjust the zoom level depending on the video mode? This seems inelegant and non-standard. It seems like tons of games let you change the screen resolution. I am curious if anyone knows how this is usually accomplished. Thank you for any advice you may have. EDIT: I forgot to mention: I am writing the game in C++ using Bloodshed DevC++, SDL for 2D graphics, on a WindowsXP machine.

Share this post


Link to post
Share on other sites
I'd say there are 2 ways, and you already found one. You can use SDL_gfx to scale down / up your graphics.

Or, use OpenGL. Check the openGl forums, should have informations about how to set it up (I posted about it this week) and google around for opengl with sdl and you should be in business.

OpenGL is a bit harder, but you do get better framerates.

Share this post


Link to post
Share on other sites
Thanks for your help.

Tetris is such a simple program, and since the game is 90% done, I think I will try the SDL_gfx method. However, I'm glad to know that OpenGL is used with SDL for 2D development. I will likely use that for my next game, which will be more complex.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this