Jump to content
  • Advertisement

Archived

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

sunone

window to fullscreen and fullscreen to window

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

I''m making a program with opengl and windowapi. But I found problem to switch everytime I want from windowed mode to fullscreen mode and from fullscreen to windowed. Becouse the parameters of "DWORD dwstyle" I pass to the main handle "HWND=Createwindow("NAME",....) is in the winmain and build the window at the beginn, but the Getkeystate I use change the dwstyle after with the window already built. So nothing happens.... I can choose the mode only in the begin with a Messagebox. But not after (when the program is running) What can I do ? I found a Lesson from http://nehe.gamedev.net where there is a solution to this, but it''s really strange structuring, different from the mine. What is very important to use to solve this problem ?

Share this post


Link to post
Share on other sites
Advertisement
Kill the existing window, define the new properties, create a new window, bind OpenGL to it, and continue the game ^_^

-Maarten Leeuwrik


Follower of the NLS
(New Lounge Standards)

Share this post


Link to post
Share on other sites
Thanx for the answer. Probably it''s right...
so I do this:
... if(GetKeystate=VK_F1)
{ KillGLWindow();
fullscreen=!fullscreen;
....and for create a new window with the new properties Can I use CreateWindow("nome",widht,..)?

Also if my function that controls the keystate is outside the winmain ?

Share this post


Link to post
Share on other sites
Hehe... I usually just go for an object-oriented approach... Create a global class for the window, with a create() and a destroy() command... Move all your window creation and destruction code into that class... Perhaps add some functions to set up window variables.

Then, when you first run your program, do a setup(..., ...) and a create(). When you want to resize, setup(..., ...), destroy(), create().

-Maarten Leeuwrik


Follower of the NLS
(New Lounge Standards)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You can use SetWindowLong to change the window styles while your program is running.

Share this post


Link to post
Share on other sites
sunone,

I would take AP''s advice, as closing & reopening a window is very crappy (no offense Ronin_54). You can find more information on SetWindowLong here. Good luck .

Share this post


Link to post
Share on other sites
Unless you want to change bit depth, all size changes can be performed without destroying the window. I wish there was a way to keep textures stored and change bit depth, but I don''t think there is (maybe someone has an easy way).

Share this post


Link to post
Share on other sites
I tryed the function SetWindowLong(MY_HWND,GWL_STYLE,...any style) ... this function changes the style but with a lot of problem for the sistem... crashing, cropping the desktop... and other... I''m not shure this is the best way to change windowstyle while the program is running... or maybe there is somethig else I ''ve to do with while I call this function

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!