light_world.lua/examples/gamera.lua

29 lines
580 B
Lua
Raw Normal View History

2014-12-04 00:22:45 +00:00
local gamera = require "examples/vendor/gamera"
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 = gamera.new(0, 0, love.graphics.getWidth(), love.graphics.getHeight())
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:setScale(scale)
cam:setPosition(x, y)
end
2021-11-10 01:15:14 +00:00
local function draw()
2014-12-04 00:22:45 +00:00
cam:draw(function(l,t,w,h)
2021-11-10 01:15:14 +00:00
simple.draw()
2014-12-04 00:22:45 +00:00
end)
end
2021-11-10 01:15:14 +00:00
return {
load = load,
update = update,
draw = draw,
keypressed = keypressed,
}