-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScreenManager.lua
38 lines (28 loc) · 947 Bytes
/
ScreenManager.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
local drawAPI = require "Screens/UI/DrawAPI"
-- import screens
local reactorScreen = require "Screens/ReactorScreen"
local screens = {
reactorScreen
}
local ScreenCount = #screens
local function init()
for i = 1, ScreenCount, -1 do
screens[i].init()
end
end
local function drawScreenTitle(screenPointer)
drawAPI.Text(20, 3, screens[screenPointer].Title, 0x696969, 0xFFFFFF)
end
local function handleTouchEvent(screenPointer, eventData)
if screenPointer <= 0 or screenPointer > ScreenCount then
return
end
screens[screenPointer].handleTouchEvent(eventData)
end
local function showScreen(screenPointer, screenData)
if screenPointer <= 0 or screenPointer > ScreenCount then
return
end
screens[screenPointer].show(screenData)
end
return { init = init, drawScreenTitle = drawScreenTitle, ScreenCount = ScreenCount, handleTouchEvent = handleTouchEvent, showScreen = showScreen }