mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 12:19:02 -06:00
Allow the window to be resized freely. (#8)
TODO: add option in config (#5) to set window size, and then save the current window size when resized so the next time you open the app, it opens at the same size you closed it with.
This commit is contained in:
parent
0e7a2bb9fe
commit
1db0a0ef05
27
main.lua
27
main.lua
@ -11,6 +11,9 @@ function love.load()
|
|||||||
config["side_next"] = false
|
config["side_next"] = false
|
||||||
config["reverse_rotate"] = true
|
config["reverse_rotate"] = true
|
||||||
config["fullscreen"] = false
|
config["fullscreen"] = false
|
||||||
|
|
||||||
|
love.window.setMode(love.graphics.getWidth(), love.graphics.getHeight(), {resizable = true});
|
||||||
|
|
||||||
if not config.input then
|
if not config.input then
|
||||||
config.input = {}
|
config.input = {}
|
||||||
scene = InputConfigScene()
|
scene = InputConfigScene()
|
||||||
@ -61,18 +64,18 @@ end
|
|||||||
|
|
||||||
function love.draw()
|
function love.draw()
|
||||||
love.graphics.push()
|
love.graphics.push()
|
||||||
if love.window.getFullscreen() then
|
|
||||||
-- get offset matrix
|
-- get offset matrix
|
||||||
love.graphics.setDefaultFilter("linear", "nearest")
|
love.graphics.setDefaultFilter("linear", "nearest")
|
||||||
local width = love.graphics.getWidth()
|
local width = love.graphics.getWidth()
|
||||||
local height = love.graphics.getHeight()
|
local height = love.graphics.getHeight()
|
||||||
local scale_factor = math.min(width / 640, height / 480)
|
local scale_factor = math.min(width / 640, height / 480)
|
||||||
love.graphics.translate(
|
love.graphics.translate(
|
||||||
(width - scale_factor * 640) / 2,
|
(width - scale_factor * 640) / 2,
|
||||||
(height - scale_factor * 480) / 2
|
(height - scale_factor * 480) / 2
|
||||||
)
|
)
|
||||||
love.graphics.scale(scale_factor)
|
love.graphics.scale(scale_factor)
|
||||||
end
|
|
||||||
scene:render()
|
scene:render()
|
||||||
love.graphics.pop()
|
love.graphics.pop()
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user