core/background: get screen size from screen object

This commit is contained in:
Kazhnuz 2019-03-05 19:37:38 +01:00
parent cfdeefe301
commit 20d617408a
1 changed files with 4 additions and 3 deletions

View File

@ -28,10 +28,11 @@ function Background:new(filepath)
self.image = love.graphics.newImage(filepath)
self.batch = love.graphics.newSpriteBatch(self.image , 1000 )
self.width, self.height = self.image:getDimensions()
self.width, self.height = self.image:getDimensions()
screenwidth, screenheight = core.screen:getDimensions()
local w = math.floor(424 / self.width) * self.width + 1
local h = math.floor(240 / self.height) * self.height + 1
local w = math.floor(screenwidth / self.width) * self.width + 1
local h = math.floor(screenheight / self.height) * self.height + 1
for i=-1, w do
for j=-1, h do