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
|
require "src.init"
local lg = love.graphics
lg.setLineStyle("rough")
function love.load()
main_init()
if arg[2] == "speck" then
start_speck_editor()
else
start_game_scene()
end
end
function love.update(dt)
local scn = get_current_scene()
assert(scn, "No scene set.")
if is_input_just_pressed("Hot_Reload") and lk.isDown("lctrl") then
reload_assets()
end
fire_event(scn.on_update, dt)
fire_event(global_on_update, dt)
flush_scene()
get_active_camera():update(dt)
end
function love.draw(dt)
lg.origin()
lg.setCanvas({ viewport, stencil = true })
use_camera_transform()
lg.clear()
local scn = get_current_scene()
assert(scn, "No scene set.")
-- borgir
fire_event(scn.on_draw, dt)
fire_event(global_on_draw, dt)
flush_scene()
lg.origin()
lg.setCanvas()
local scr_width, scr_height = lg.getDimensions()
WindowScale = min(scr_width / SCR_WIDTH, scr_height / SCR_HEIGHT)
lg.setColor(1, 1, 1)
lg.draw(
viewport,
scr_width / 2, scr_height / 2, 0,
WindowScale, WindowScale,
SCR_WIDTH / 2, SCR_HEIGHT / 2)
im.begin_step()
fire_event(scn.on_ui)
fire_event(global_on_ui)
flush_scene()
im.draw()
im.end_step()
lg.print(tostring(love.timer.getFPS()))
input_step()
end
|