Jump to content
  • Advertisement

Archived

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

fury3

Screen Resize without Direct X

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

Is it possible to resize the screen to another resolution without using directx? (eg. an API/GDI call) if so, is it also possible to change the color depth? Thanx in advance

Share this post


Link to post
Share on other sites
Advertisement
Easy! Use the Win32 API subset known as Developer Mode. This code is curtesy of NeHe

DEVMODE dmScreenSettings; // Device Mode
memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); // Makes Sure Memory''s Cleared
dmScreenSettings.dmSize=sizeof(dmScreenSettings); // Size Of The Devmode Structure
dmScreenSettings.dmPelsWidth = width; // Selected Screen Width
dmScreenSettings.dmPelsHeight = height; // Selected Screen Height
dmScreenSettings.dmBitsPerPel = bits; // Selected Bits Per Pixel
dmScreenSettings.dmFields=DM_BITSPERPEL/DM_PELSWIDTH/DM_PELSHEIGHT;


// Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)
{

/* If the mode couldn''t be set the code below will run. If a matching fullscreen mode doesn''t exist, a messagebox will pop up offering two options... The option to run in a window or the option to quit. */


// If The Mode Fails, Offer Two Options. Quit Or Run In A Window.
MessageBox(NULL,"The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. ","NeHe GL",MB_YESNO/MB_ICONEXCLAMATION);

And there you go! Changed Screen resolution!

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!