Jump to content
  • Advertisement

Archived

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

hello_there

changing resolutions

This topic is 5391 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

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.

Share this post


Link to post
Share on other sites
Advertisement
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
}

Share this post


Link to post
Share on other sites
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)

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!