Window
Moderator: Moderators
Window
On-the-fly fullscreen / zoom toggling using stock ZGE ( Windows-only ). Press F4 to toggle between windowed & fullscreen mode and F2 / F3 to make the window smaller / bigger.
K
- Attachments
-
- Window.jpg (41.69 KiB) Viewed 27977 times
-
- Window.zip
- (37.56 KiB) Downloaded 1165 times
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
Re: Window
Sorry, I realize this is a very old thread. But I just came across the need to switch to/from fullscreen mode from within my app. I'm planning on adding it to my options menu. Can this be done? I checked the example, but it seemed a bit too complicated, not to mention I'd love if it could work with Linux as well.
I had hoped App.FullScreen = 1; would be enough, but no luck.
I had hoped App.FullScreen = 1; would be enough, but no luck.
Re: Window
Hi Imerion,
Unfortunately this never made it in. I've send Ville source code ( examples ) for this multiple times over the years .. most recently in 2014 ( including support for Aero snap ), but no cigar. Not sure what else i can do
K
Unfortunately this never made it in. I've send Ville source code ( examples ) for this multiple times over the years .. most recently in 2014 ( including support for Aero snap ), but no cigar. Not sure what else i can do
K
Re: Window
Hi guys,
I made a quick attempt at fixing this. Instead of using the Fullscreen property I use the ScreenMode property.
First download latest beta: http://www.zgameeditor.org/files/ZGameEditor_beta.zip
Then try this project (press space to switch between fullscreen and windowed):
I made a quick attempt at fixing this. Instead of using the Fullscreen property I use the ScreenMode property.
First download latest beta: http://www.zgameeditor.org/files/ZGameEditor_beta.zip
Then try this project (press space to switch between fullscreen and windowed):
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" ScreenMode="1" FileVersion="2">
<OnUpdate>
<KeyPress Keys=" " RepeatDelay="1">
<OnPressed>
<ZExpression>
<Expression>
<![CDATA[App.ScreenMode= (App.ScreenMode==0) ? 1 : 0;
App.ClearColor.R=1-App.ClearColor.R;]]>
</Expression>
</ZExpression>
</OnPressed>
</KeyPress>
</OnUpdate>
<OnRender>
<RenderSprite/>
</OnRender>
</ZApplication>
Re: Window
Updated example above and fixed a bug related to keypress states when switching screenmode. If you want to test then download beta again.
Note that App.WindowHandle gets recreated so if you use this somehow (passing it to external library perhaps) then you need to do this again after switching screenmode.
Note that App.WindowHandle gets recreated so if you use this somehow (passing it to external library perhaps) then you need to do this again after switching screenmode.
Re: Window
Hej Ville,
I assume that the current approach is just temporarily? Since .. this way you can't use a custom window resolution ( aside from it being a rather unintuitive way to toggle fullscreen ).
Also, why are you recreating the window ( you're not recreating the OpenGL context as well i hope )? You can simply update the window size & style instead ( as demonstrated in the examples i send ) ..
http://dl.dropboxusercontent.com/u/1412036/Window.zip
K
I assume that the current approach is just temporarily? Since .. this way you can't use a custom window resolution ( aside from it being a rather unintuitive way to toggle fullscreen ).
Also, why are you recreating the window ( you're not recreating the OpenGL context as well i hope )? You can simply update the window size & style instead ( as demonstrated in the examples i send ) ..
http://dl.dropboxusercontent.com/u/1412036/Window.zip
K
Re: Window
Thanks for adding an implementation for this! It works fine, but unfortunately I needed a custom window resolution. (Since all the built-in ones are non-widescreen.)
I tried to use 1024x768 since it's close to what I use in the game (1024x576). That way everything is displayed, but with black bars at top and bottom.
Switching to fullscreen this way works fine, and after switching the game uses my full screen resolution (giving me a wide 1366x768), but after that I can't seem to switch back to 1024x768 windowed. It simply doesn't do anything after that.
I tried to use 1024x768 since it's close to what I use in the game (1024x576). That way everything is displayed, but with black bars at top and bottom.
Switching to fullscreen this way works fine, and after switching the game uses my full screen resolution (giving me a wide 1366x768), but after that I can't seem to switch back to 1024x768 windowed. It simply doesn't do anything after that.
Re: Window
Ah, that list of resolutions needs to be updated.Imerion wrote:I needed a custom window resolution. (Since all the built-in ones are non-widescreen.)
@Kjell: You know I always try to implement features in the simplest way possible . The reasons are both to save development time and runtime size. So the solution I chose here only required me to add a few lines of code, whereas if I tried to use your examples it would require me to add more code and would be trickier to make cross-platform. In the end, I still may use your code, but this is a first effort.