-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.lua
72 lines (53 loc) · 1.44 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
PostShader = require "lib/light/postshader"
LightWorld = require "lib/light"
gamera = require "lib/gamera"
bump = require "lib/bump"
inspect = require "lib/inspect"
world = bump.newWorld()
--require "lighting"
require "player"
require "map"
require "lights"
function love.load()
cam = gamera.new(-love.graphics.getWidth(),-love.graphics.getHeight(),60*32+love.graphics.getWidth(),60*32+love.graphics.getHeight())
scale = 1
-- create light world
lightWorld = LightWorld({
ambient = {55,55,55},
refractionStrength = 32.0,
reflectionVisibility = 0.75,
})
player.LOAD()
map.LOAD()
load_lights()
post_shader = PostShader()
end
function love.update(dt)
local x, y, scale = player.cam.x, player.cam.y, scale
love.window.setTitle("Light vs. Shadow Engine (FPS:" .. love.timer.getFPS() .. ")")
cam:devMovement(dt)
cam:setScale(scale)
lightWorld:update(dt)
lightWorld:setTranslation(-cam.x, -cam.y)
lightWorld:setScale(scale)
player.UPDATE(dt)
end
function love.draw()
cam:draw(function(l,t,w,h)
lightWorld:draw(function(l, t, w, h, s)
map.DRAW()
player.DRAW()
end)
--[[
love.graphics.setColor(255,255,255,100)
love.graphics.rectangle("fill", player.cam.x, player.cam.y, player.cam.width, player.cam.height)
--]]
lightWorld.post_shader:addEffect("bloom")
end)
end
function love.keypressed(key)
player.KEYPRESSED(key)
end
function love.keyreleased(key)
player.KEYRELEASED(key)
end