-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
118 lines (91 loc) · 3.34 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
DEBUG = true
local HooECS = require('lib.HooECS')
HooECS.initialize({
globals = true,
debug = DEBUG,
})
Timer = require('lib.hump.timer')
vector = require('lib.hump.vector')
scrale = require('lib.scrale.scrale')
lume = require('lib.lume.lume')
inspect = require('lib.inspect.inspect')
local gamera = require('lib.gamera.gamera')
-- Entities
-- local Player = require('src.entities.Player')
local Level = require('src.entities.Level')
-- Systems
local CollisionSystem = require('src.systems.CollisionSystem')
local InputSystem = require('src.systems.InputSystem')
local PhysicsSystem = require('src.systems.PhysicsSystem')
local MovementSystem = require('src.systems.MovementSystem')
local GroundedSystem = require('src.systems.GroundedSystem')
local JumpSystem = require('src.systems.JumpSystem')
local DashSystem = require('src.systems.DashSystem')
local CrouchSystem = require('src.systems.CrouchSystem')
-- local SlideSystem = require('src.systems.SlideSystem')
local SpawnSystem = require('src.systems.SpawnSystem')
local DeathSystem = require('src.systems.DeathSystem')
local HealthUISystem = require('src.systems.HealthUISystem')
local AnimationSystem = require('src.systems.AnimationSystem')
local LevelRenderingSystem = require('src.systems.LevelRenderingSystem')
local SpriteRenderingSystem = require('src.systems.SpriteRenderingSystem')
local AnimationRenderingSystem = require('src.systems.AnimationRenderingSystem')
local CameraSystem = require('src.systems.CameraSystem')
-- Debugging systems
local CameraDebugSystem = require('src.systems.CameraDebugSystem')
local HitboxRenderSystem = require('src.systems.HitboxRenderSystem')
local DebugTextSystem = require('src.systems.DebugTextSystem')
print(love.graphics.getHeight())
function love.load()
scrale.init({
fillHorizontally = false,
fillVertically = false,
scaleFilter = "nearest",
})
love.graphics.setLineStyle('rough')
love.graphics.setNewFont('assets/fonts/gohufont-11.ttf', 11)
camera = gamera.new(0, 0, 1024, 192)
camera:setWindow(0, 0, 256, 144)
engine = Engine()
eventManager = EventManager()
eventManager:addListener("Spawn", SpawnSystem, SpawnSystem.fireEvent)
local level = Level('assets/levels/level.lua')
engine:addEntity(level)
-- engine:addEntity(Player(camera))
engine:addSystem(InputSystem())
engine:addSystem(PhysicsSystem(level))
engine:addSystem(MovementSystem())
engine:addSystem(GroundedSystem())
engine:addSystem(JumpSystem())
engine:addSystem(DashSystem())
engine:addSystem(CrouchSystem(level))
-- engine:addSystem(SlideSystem())
engine:addSystem(AnimationSystem())
engine:addSystem(SpriteRenderingSystem(camera))
engine:addSystem(AnimationRenderingSystem(camera))
engine:addSystem(CollisionSystem(level))
engine:addSystem(DeathSystem())
engine:addSystem(LevelRenderingSystem(camera))
engine:addSystem(HealthUISystem(camera))
engine:addSystem(CameraSystem())
if DEBUG then
engine:addSystem(CameraDebugSystem(camera))
engine:addSystem(HitboxRenderSystem(camera))
engine:addSystem(DebugTextSystem(camera))
end
end
function love.update(dt)
require("lib.lovebird.lovebird").update()
require('lib.lurker.lurker').update()
engine:update(dt)
end
function love.draw()
scrale.drawOnCanvas(true)
engine:draw()
scrale.draw()
end
function love.keypressed(k)
if k == "p" then
scrale.toggleFullscreen()
end
end