forked from voidderef/sgl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtitle.lua
More file actions
62 lines (46 loc) · 1.39 KB
/
title.lua
File metadata and controls
62 lines (46 loc) · 1.39 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
package.path = './data/lua/?.lua;' .. package.path
require("sgl")
local __id_tex_title = SGL_TEX_ID_INVALID
local __id_sprite_title = SGL_SPRITE_ID_INVALID
local function __load(table_resources, table_args)
local res_tex_title = table_resources["tex_title"]
if res_tex_title == nil then
print("Missing tex_title resource entry")
return false
end
local asset_paths = sgl_asset_paths()
res_tex_title = asset_paths["title"] .. "/" .. res_tex_title
-- load title
__id_tex_title = sgl_tex_create(res_tex_title)
__id_sprite_title = sgl_sprite_create(__id_tex_title)
sgl_sprite_pos(__id_sprite_title, 0, 0)
sgl_sprite_dim(__id_sprite_title, sgl_ren_screen_width(), sgl_ren_screen_height())
return true
end
local function __unload()
sgl_sprite_destroy(__id_sprite_title)
sgl_tex_destroy(__id_tex_title)
end
local function __update(prev_delta_sec, input_state)
end
local function __on_enable()
sgl_sprite_activate(__id_sprite_title, true)
end
local function __on_disable()
sgl_sprite_activate(__id_sprite_title, false)
end
local function __on_confirm()
return true
end
local function __on_transition()
return true
end
return {
f_load = __load,
f_unload = __unload,
f_update = __update,
f_on_enable = __on_enable,
f_on_disable = __on_disable,
f_on_confirm = __on_confirm,
f_on_transition = __on_transition,
}