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
|
#+feature dynamic-literals
package demonchime
// DO NOT EDIT
//
// This file is autogenerated by tools/compile_assets
// All resource types are defined in 'src/resources.odin'.
import rl "vendor:raylib"
Image_Id :: enum {
TILESETS,
PLAYER,
}
Animation_Id :: enum {
PLAYER,
}
Map_Id :: enum {
ROOM_BEGIN_1,
ROOM_BEGIN,
}
Tileset_Id :: enum {
TILESET,
}
Resource_Id :: union {
Image_Id,
Animation_Id,
Map_Id,
Tileset_Id,
}
images: [Image_Id]Image_Resource
animations: [Animation_Id]Animation_Resource
maps: [Map_Id]Map_Resource
tilesets: [Tileset_Id]Tileset_Resource
path_to_id: map[string]Resource_Id
load_resources :: proc() {
load_images()
load_anims()
load_maps()
load_tilesets()
// Allow conversion from paths to a resource id, since it's a better way to
// reference resources in other resources (JSON is a good example).
path_to_id["res/tileset.tsj"] = Tileset_Id.TILESET
path_to_id["res/img/player.ase"] = Image_Id.PLAYER
path_to_id["res/img/tilesets.png"] = Image_Id.TILESETS
path_to_id["res/room_begin.tmj"] = Map_Id.ROOM_BEGIN
path_to_id["res/room_begin_1.tmj"] = Map_Id.ROOM_BEGIN_1
}
@(private="file")
load_images :: proc() {
images[.TILESETS] = {data = #load("/home/xswan/demonchime/.compiled-res/tilesets.qoi")}
images[.PLAYER] = {data = #load("/home/xswan/demonchime/.compiled-res/player-sheet.qoi")}
}
@(private="file")
load_anims :: proc() {
animations[.PLAYER] = {frame_count = 23, frame_durations = {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}, tags = {"jump_trans"={from = 16, to = 16}, "jump_down"={from = 17, to = 18}, "idle"={from = 0, to = 5}, "sleep"={from = 19, to = 22}, "jump_up"={from = 14, to = 15}, "run"={from = 6, to = 13}}}
}
@(private="file")
load_maps :: proc() {
maps[.ROOM_BEGIN_1] = #load("/home/xswan/demonchime/res/room_begin_1.tmj")
maps[.ROOM_BEGIN] = #load("/home/xswan/demonchime/res/room_begin.tmj")
}
@(private="file")
load_tilesets :: proc() {
tilesets[.TILESET] = #load("/home/xswan/demonchime/res/tileset.tsj")
}
|