Jump to content

Resolution Question


Sargeant12344
 Share

Recommended Posts

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

Link to comment
Share on other sites

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

post-14-0-99130400-1464563006_thumb.jpg

  • Upvote 1

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...