Sargeant12344 Posted May 29, 2016 Share Posted May 29, 2016 I recently changed the screen resolution in Main.lua and set it to fullscreen, I was however wonder if someone were to play it on a lower res monitor, would the game be distorted in any way? Heres my main.lua. import "Addons/THUI/THUI.lua" --Initialize Steamworks (optional) Steamworks:Initialize() --Set the application title title="MyGame" --Create a window local windowstyle = window.Titlebar if System:GetProperty("fullscreen")=="1" then windowstyle=windowstyle+window.FullScreen end window=Window:Create(title,0,0,System:GetProperty("screenwidth","1920"),System:GetProperty("screenheight","1080"),windowstyle+window.FullScreen) window:HideMouse() --Create the graphics context context=Context:Create(window,0) if context==nil then return end THUI:Initialize() --Create a world world=World:Create() world:SetLightQuality((System:GetProperty("lightquality","1"))) --Load a map local mapfile = System:GetProperty("map","Maps/start.map") if Map:Load(mapfile)==false then return end paused = false exit_game = false while not exit_game do --If window has been closed, end the program if window:Closed() then break end --Handle map change if changemapname~=nil then --Clear all entities world:Clear() --Load the next map Time:Pause() if Map:Load("Maps/"..changemapname..".map")==false then return end Time:Resume() changemapname = nil end if not paused then --Update the app timing Time:Update() --Update the world world:Update() end --Render the world world:Render() THUI:Update() --Render statistics context:SetBlendMode(Blend.Alpha) if DEBUG then context:SetColor(1,0,0,1) context:DrawText("Debug Mode",2,2) context:SetColor(1,1,1,1) context:DrawStats(2,22) context:SetBlendMode(Blend.Solid) else --Toggle statistics on and off if (window:KeyHit(Key.F11)) then showstats = not showstats end if showstats then context:SetColor(1,1,1,1) context:DrawText("FPS: "..Math:Round(Time:UPS()),2,2) end end --Refresh the screen context:Sync(true) end Quote Link to comment Share on other sites More sharing options...
nick.ace Posted May 29, 2016 Share Posted May 29, 2016 No, it won't. In fact, it won't be distorted with different aspect ratios either. The only thing you have to worry about it the UI if you make one and don't apply scaling. Quote Link to comment Share on other sites More sharing options...
Sargeant12344 Posted May 29, 2016 Author Share Posted May 29, 2016 Okay Thanks. However, when I try to set the resolution to 2560*1440 an error message pops up stating "Script Error attempt to index global 'window (a nil value) Line 13 Any help? Quote Link to comment Share on other sites More sharing options...
nick.ace Posted May 29, 2016 Share Posted May 29, 2016 Is that a resolution supported by your video card/monitor? Use these commands: System::CountGraphicsModes System::GetGraphicsMode Basically, the first one gives you a length. You would then use a for-loop or something and loop through and print out all of the graphics modes supported. 1 Quote Link to comment Share on other sites More sharing options...
macklebee Posted May 29, 2016 Share Posted May 29, 2016 Simple example showing your supported resolutions: rescounter = System:CountGraphicsModes()-1 resolutions = {} for i = 0, rescounter do resolutions = System:GetGraphicsMode(i) System:Print("Resolution "..i..": "..resolutions.x.." x "..resolutions.y) end window = Window:Create("Supported Resolutions", 0,0,resolutions[rescounter].x,resolutions[rescounter].y,16) context = Context:Create(window) while window:KeyDown(Key.Escape)==false do context:SetColor(0,0,0) context:Clear() context:SetBlendMode(Blend.Alpha) for i = 0, rescounter do context:SetColor(1,0,0) context:DrawRect(0,0,resolutions.x, resolutions.y,1) context:SetColor(1,1,1) context:DrawText(resolutions.x.." x "..resolutions.y, resolutions.x-75, resolutions.y-15) end context:SetBlendMode(Blend.Solid) context:Sync(true) end 1 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...
thehankinator Posted May 30, 2016 Share Posted May 30, 2016 If you are using Autoscale, the THUI will scale whatever resolution you are set to. Anchor and Absolute will not (at this time anyway). Quote Link to comment Share on other sites More sharing options...
Sargeant12344 Posted May 30, 2016 Author Share Posted May 30, 2016 Okay Thanks for all the help, 1440p is not supported by my monitor (I was thinking that you could downscale a high res image in Leadwerks) . 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.