-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
101 lines (82 loc) · 1.92 KB
/
Copy pathmain.lua
File metadata and controls
101 lines (82 loc) · 1.92 KB
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
--[[
파일명: main.lua
모듈명: Main
역할:
- LÖVE 진입점
- App 업데이트/렌더 및 입력 콜백 연결
외부에서 사용 가능한 함수:
- love.load()
- love.update(dt)
- love.draw()
- love.mousepressed(x, y, button)
- love.mousereleased(x, y, button)
- love.mousemoved(x, y, dx, dy)
- love.wheelmoved(x, y)
- love.keypressed(key)
- love.textinput(text)
- love.textedited(text, start, length)
- love.resize(w, h)
- love.focus(focused)
- love.quit()
주의:
- 입력 좌표 변환은 App 내부에서 처리한다
]]
local Constants = require("constants")
local RenderScale = require("managers.render_scale")
local FontManager = require("assets.font_manager")
local App = require("app")
local app
local renderScale
function love.load()
math.randomseed(os.time())
love.keyboard.setKeyRepeat(true)
love.graphics.setDefaultFilter("nearest", "nearest")
FontManager.loadFonts()
love.graphics.setFont(FontManager.getFont("ui"))
renderScale = RenderScale.new(Constants.BASE_WORLD_W, Constants.BASE_WORLD_H)
app = App.new(renderScale)
end
function love.update(dt)
app:update(dt)
end
function love.draw()
renderScale:beginDraw()
app:draw()
renderScale:endDraw()
end
function love.mousepressed(x, y, button)
app:mousepressed(x, y, button)
end
function love.mousereleased(x, y, button)
app:mousereleased(x, y, button)
end
function love.mousemoved(x, y, dx, dy)
if app and app.mousemoved then
app:mousemoved(x, y, dx, dy)
end
end
function love.wheelmoved(x, y)
if app and app.wheelmoved then
app:wheelmoved(x, y)
end
end
function love.keypressed(key)
app:keypressed(key)
end
function love.textinput(text)
app:textinput(text)
end
function love.textedited(text, start, length)
app:textedited(text, start, length)
end
function love.resize(w, h)
app:resize(w, h)
end
function love.focus(focused)
if app and app.focus then
app:focus(focused)
end
end
function love.quit()
app:shutdown()
end