making update required so that is optimizes drawing

This commit is contained in:
Tim Anema 2014-12-13 17:29:07 -05:00
parent 33fec6bfd4
commit fac5d932f2
10 changed files with 12 additions and 4 deletions

View File

@ -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)

View File

@ -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

View File

@ -235,6 +235,8 @@ function love.update(dt)
else
lightWorld.post_shader:removeEffect("bloom")
end
lightWorld:update(dt)
end
function love.draw()

View File

@ -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()

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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