light_world.lua/examples/hump.lua

28 lines
535 B
Lua
Raw Normal View History

2014-12-04 00:22:45 +00:00
local Camera = require "examples/vendor/hump/camera"
2021-11-10 01:15:14 +00:00
local simple = require "examples.simple"
local keyboard = require "examples.lib.keyboard"
2014-12-04 00:22:45 +00:00
2021-11-10 01:15:14 +00:00
local function load()
2014-12-04 00:22:45 +00:00
cam = Camera(love.graphics.getWidth()/2, love.graphics.getHeight()/2)
2021-11-10 01:15:14 +00:00
simple.load()
2014-12-04 00:22:45 +00:00
end
2021-11-10 01:15:14 +00:00
local function update(dt)
local x, y, scale = keyboard.update(dt)
simple.update(dt, x, y, scale)
2014-12-04 00:22:45 +00:00
cam:lookAt(x, y)
cam:zoom(scale)
end
2021-11-10 01:15:14 +00:00
local function draw()
2014-12-04 00:22:45 +00:00
cam:attach()
2021-11-10 01:15:14 +00:00
simple.draw()
2014-12-04 00:22:45 +00:00
cam:detach()
end
2021-11-10 01:15:14 +00:00
return {
load = load,
update = update,
draw = draw,
}