core/screen: load height from love.conf

This commit is contained in:
Kazhnuz 2019-03-05 19:22:23 +01:00
parent e03c9a1768
commit 838a68787b
2 changed files with 9 additions and 7 deletions

View File

@ -7,8 +7,8 @@ function love.conf(t)
t.window.title = "Imperium Porcorum" -- The window title (string)
t.window.icon = nil -- Filepath to an image to use as the window's icon (string)
t.window.width = 424*2 -- The window width (number)
t.window.height = 240*2 -- The window height (number)
t.window.width = 424 -- The window width (number)
t.window.height = 240 -- The window height (number)
t.window.borderless = false -- Remove all border visuals from the window (boolean)
t.window.resizable = false -- Let the window be user-resizable (boolean)
t.window.minwidth = 1 -- Minimum window width if the window is resizable (number)

View File

@ -26,14 +26,12 @@ local ScreenManager = Object:extend()
local CScreen = require "libs.cscreen"
local SCREEN_HEIGHT = 240
local SCREEN_WIDTH = 424
function ScreenManager:new(controller)
self.controller = controller
self.data = self.controller.options.data.video
self.width, self.height = love.graphics.getDimensions()
self:applySettings()
CScreen.init(SCREEN_WIDTH, SCREEN_HEIGHT, true)
CScreen.init(self.width, self.height, true)
CScreen.setColor(0, 0, 0, 1)
love.graphics.setDefaultFilter( "nearest", "nearest", 1 )
@ -46,7 +44,7 @@ function ScreenManager:applySettings()
flags.vsync = self.data.vsync
flags.borderless = (self.data.border == false)
love.window.setMode(SCREEN_WIDTH * self.data.resolution, SCREEN_HEIGHT * self.data.resolution, flags)
love.window.setMode(self.width * self.data.resolution, self.height * self.data.resolution, flags)
love.window.setFullscreen( self.data.fullscreen )
local width, height = love.window.getMode()
@ -61,6 +59,10 @@ function ScreenManager:getMousePosition()
return CScreen.project(love.mouse.getX(), love.mouse.getY())
end
function ScreenManager:getDimensions()
return self.width, self.height
end
function ScreenManager:apply()
CScreen.apply()
end