mirror of
https://github.com/tanema/light_world.lua.git
synced 2024-12-24 20:24:19 +00:00
making update required so that is optimizes drawing
This commit is contained in:
parent
33fec6bfd4
commit
fac5d932f2
1
conf.lua
1
conf.lua
@ -3,6 +3,7 @@ function love.conf(t)
|
||||
t.version = "0.9.0" -- The LÖVE version this game was made for (string)
|
||||
t.console = true -- Attach a console (boolean, Windows only)
|
||||
|
||||
--1440 x 900
|
||||
t.window.title = "Untitled" -- The window title (string)
|
||||
t.window.icon = nil -- Filepath to an image to use as the window's icon (string)
|
||||
t.window.width = 800 -- The window width (number)
|
||||
|
@ -62,7 +62,7 @@ function love.update(dt)
|
||||
end
|
||||
|
||||
animation2:update(dt)
|
||||
lightWorld:update(dt) --only needed for animation
|
||||
lightWorld:update(dt)
|
||||
lightMouse:setPosition((love.mouse.getX() - x)/scale, (love.mouse.getY() - y)/scale, z)
|
||||
end
|
||||
|
||||
|
@ -235,6 +235,8 @@ function love.update(dt)
|
||||
else
|
||||
lightWorld.post_shader:removeEffect("bloom")
|
||||
end
|
||||
|
||||
lightWorld:update(dt)
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
|
@ -64,6 +64,7 @@ function love.update(dt)
|
||||
cam:setScale(scale)
|
||||
cam:setPosition(x, y)
|
||||
lightWorld:setTranslation(x, y, scale)
|
||||
lightWorld:update(dt)
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
|
@ -64,6 +64,7 @@ function love.update(dt)
|
||||
cam:lookAt(x, y)
|
||||
cam:zoom(scale)
|
||||
lightWorld:setTranslation(x, y, scale)
|
||||
lightWorld:update(dt)
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
|
@ -48,6 +48,7 @@ function love.update(dt)
|
||||
scale = scale + 0.01
|
||||
end
|
||||
|
||||
lightWorld:update(dt)
|
||||
lightMouse:setPosition(love.mouse.getX()/scale, love.mouse.getY()/scale)
|
||||
end
|
||||
|
||||
|
@ -87,6 +87,7 @@ function love.update(dt)
|
||||
post_shader:removeEffect("chromatic_aberration")
|
||||
end
|
||||
|
||||
lightWorld:update(dt)
|
||||
lightMouse:setPosition(love.mouse.getX()/scale, love.mouse.getY()/scale)
|
||||
end
|
||||
|
||||
|
@ -137,6 +137,7 @@ function love.update(dt)
|
||||
lightWorld.post_shader:removeEffect("chromatic_aberration")
|
||||
end
|
||||
|
||||
lightWorld:update(dt)
|
||||
lightMouse:setPosition((love.mouse.getX() - x)/scale, (love.mouse.getY() - y)/scale, z)
|
||||
end
|
||||
|
||||
|
@ -56,6 +56,7 @@ function love.update(dt)
|
||||
end
|
||||
|
||||
map:update(dt)
|
||||
lightWorld:update(dt)
|
||||
lightMouse:setPosition((love.mouse.getX() - x)/scale, (love.mouse.getY() - y)/scale, z)
|
||||
end
|
||||
|
||||
|
@ -85,10 +85,9 @@ end
|
||||
|
||||
function light_world:update(dt)
|
||||
for i = 1, #self.bodies do
|
||||
if self.bodies[i]:isInRange(-self.l,-self.t,self.w,self.h,self.s) then
|
||||
self.bodies[i].is_on_screen = self.bodies[i]:isInRange(-self.l,-self.t,self.w,self.h,self.s)
|
||||
if self.bodies[i]:isVisible() then
|
||||
self.bodies[i]:update(dt)
|
||||
else
|
||||
self.bodies[i].is_on_screen = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user