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.pull/1/head
parent
0e7a2bb9fe
commit
1db0a0ef05
27
main.lua
27
main.lua
|
@ -11,6 +11,9 @@ function love.load()
|
|||
config["side_next"] = false
|
||||
config["reverse_rotate"] = true
|
||||
config["fullscreen"] = false
|
||||
|
||||
love.window.setMode(love.graphics.getWidth(), love.graphics.getHeight(), {resizable = true});
|
||||
|
||||
if not config.input then
|
||||
config.input = {}
|
||||
scene = InputConfigScene()
|
||||
|
@ -61,18 +64,18 @@ end
|
|||
|
||||
function love.draw()
|
||||
love.graphics.push()
|
||||
if love.window.getFullscreen() then
|
||||
-- get offset matrix
|
||||
love.graphics.setDefaultFilter("linear", "nearest")
|
||||
local width = love.graphics.getWidth()
|
||||
local height = love.graphics.getHeight()
|
||||
local scale_factor = math.min(width / 640, height / 480)
|
||||
love.graphics.translate(
|
||||
(width - scale_factor * 640) / 2,
|
||||
(height - scale_factor * 480) / 2
|
||||
)
|
||||
love.graphics.scale(scale_factor)
|
||||
end
|
||||
|
||||
-- get offset matrix
|
||||
love.graphics.setDefaultFilter("linear", "nearest")
|
||||
local width = love.graphics.getWidth()
|
||||
local height = love.graphics.getHeight()
|
||||
local scale_factor = math.min(width / 640, height / 480)
|
||||
love.graphics.translate(
|
||||
(width - scale_factor * 640) / 2,
|
||||
(height - scale_factor * 480) / 2
|
||||
)
|
||||
love.graphics.scale(scale_factor)
|
||||
|
||||
scene:render()
|
||||
love.graphics.pop()
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue