core/screen: load height from love.conf
This commit is contained in:
parent
e03c9a1768
commit
838a68787b
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue