Haydenmango Posted May 31, 2015 Share Posted May 31, 2015 I may be wrong but it seems that you can't change the fullscreen setting after you create the window for your game. Would it be possible to add the ability to toggle fullscreen mode through the Window:SetLayout() function? 1 Quote Check out my game Rogue Snowboarding- https://haydenmango.itch.io/roguesnowboarding Link to comment Share on other sites More sharing options...
macklebee Posted May 31, 2015 Share Posted May 31, 2015 I am able to toggle fullscreen mode using SetLayout when I set the window style to '0' upon creation. It would be nice to be able to set the window styles between the two states though. What I haven't figured out what to do yet though is to change resolutions but be at fullscreen along with keeping the ability to go to a windowed mode. I think the missing ability to set the window style is the problem. count = System:CountGraphicsModes() resolutions = {} for i = 0, count-1 do resolutions = System:GetGraphicsMode(i) end window = Window:Create("window properties", 0,0,800,600,0) context = Context:Create(window) world = World:Create() camera = Camera:Create() camera:Move(0,0,-3) light = DirectionalLight:Create() light:SetRotation(35,35,0) model = Model:Box() model:SetColor(1.0,0.5,0.0) while window:KeyDown(Key.Escape)==false do if window:Closed() then break end if window:KeyHit(Key.Down) then window:SetLayout(0,0,800,600) end if window:KeyHit(Key.Up) then window:SetLayout(0,0,resolutions[count-1].x,resolutions[count-1].y) end model:Turn(0,Time:GetSpeed(),0) Time:Update() world:Update() world:Render() context:SetBlendMode(Blend.Alpha) context:DrawStats(0,0,true) context:Sync(true) end Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Skrakle Posted May 31, 2015 Share Posted May 31, 2015 I just managed to make it work by releasing the window & context and re-creating them. I haven't tested it thoroughly, just wrote the code and it worked. Obviously you should replace the windows code for getting the desktop resolution with something else. In your loop: if (window->KeyHit(Key::F)) { window->Release(); context->Release(); if (fullscreen == false) { RECT desktop; const HWND hDesktop = GetDesktopWindow(); GetWindowRect(hDesktop, &desktop); window = Leadwerks::Window::Create("Lands of nowhere", 0, 0, desktop.right, desktop.bottom, Window::FullScreen); } else { window = Leadwerks::Window::Create("Lands of nowhere", 70, 70, 1024, 768); } context = Context::Create(window); fullscreen = !fullscreen; return true; } 1 Quote Link to comment Share on other sites More sharing options...
macklebee Posted May 31, 2015 Share Posted May 31, 2015 Works but that method in lua will cause the program to shut down half the time. Also, your method in lua appears to make the memory usage go up 3-4GBs each time. The SetLayout method doesn't do that - at least in lua (or at least in much smaller amounts). Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Skrakle Posted May 31, 2015 Share Posted May 31, 2015 Works but that method in lua will cause the program to shut down half the time. Also, your method in lua appears to make the memory consumption go up each time. The SetLayout method doesn't do that - at least in lua. Yeah i was afraid that might happen in lua or even in linux, i guess it's unsafe to use. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.