Skip to main content
gamedev.net
🔒 Locked

changing resolutions

Started by hello_there 1 reply 400+ views
Original Post
hello_there
hello_there
In my game i want the player to be able to change the resolutions what are the steps that i would have to do? Using opengl and windows.
____________How could hell be worse?
Xiachunyi
Xiachunyi
Use the "ChangeDisplaySettings" Windows API function to change the screen resolution.

DEVMODE dmScreenSettings;
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
dmScreenSettings.dmSize=sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = width;
dmScreenSettings.dmPelsHeight = height;
dmScreenSettings.dmBitsPerPel=bits;
dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)
{
//Error code here
}
Big Cheez
Big Cheez
When they change the screen resolution, just run this piece of code:

KillGLWindow();//or its equivalent in your program
CreateGLWindow("title",newXRes,newYRes,32,fullscreen)
"That MSMAGNET program trashed my hard drive!"

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.