Mercurial > molko
comparison examples/example-audio/main.c @ 298:196264679079
misc: remove usage of bool
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 10 Mar 2021 18:49:08 +0100 |
parents | cd5bdb995052 |
children | 3638b39ef2bf |
comparison
equal
deleted
inserted
replaced
297:6151152d009c | 298:196264679079 |
---|---|
54 }; | 54 }; |
55 | 55 |
56 static void | 56 static void |
57 init(void) | 57 init(void) |
58 { | 58 { |
59 if (!core_init("fr.malikania", "audio") || !ui_init()) | 59 if (core_init("fr.malikania", "audio") < 0 || ui_init() < 0) |
60 panic(); | 60 panic(); |
61 if (!window_open("Example - Audio", W, H)) | 61 if (window_open("Example - Audio", W, H) < 0) |
62 panic(); | 62 panic(); |
63 if (!music_open(&music, PATH("music/vabsounds-romance.ogg")) || | 63 if (music_open(&music, PATH("music/vabsounds-romance.ogg")) < 0 || |
64 !sound_open(&sound, PATH("sounds/fire.wav"))) | 64 sound_open(&sound, PATH("sounds/fire.wav")) < 0) |
65 panic(); | 65 panic(); |
66 } | 66 } |
67 | 67 |
68 static void | 68 static void |
69 quit(void) | 69 quit(void) |
78 { | 78 { |
79 (void)st; | 79 (void)st; |
80 | 80 |
81 switch (ev->type) { | 81 switch (ev->type) { |
82 case EVENT_CLICKDOWN: | 82 case EVENT_CLICKDOWN: |
83 if (!sound_play(&sound, -1, 0)) | 83 if (sound_play(&sound, -1, 0) < 0) |
84 panic(); | 84 panic(); |
85 break; | 85 break; |
86 case EVENT_KEYDOWN: | 86 case EVENT_KEYDOWN: |
87 switch (ev->key.key) { | 87 switch (ev->key.key) { |
88 case KEY_f: | 88 case KEY_f: |
136 struct state state = { | 136 struct state state = { |
137 .handle = handle, | 137 .handle = handle, |
138 .draw = draw | 138 .draw = draw |
139 }; | 139 }; |
140 | 140 |
141 game_switch(&state, true); | 141 game_switch(&state, 1); |
142 game_loop(); | 142 game_loop(); |
143 | 143 |
144 music_finish(&music); | 144 music_finish(&music); |
145 sound_finish(&sound); | 145 sound_finish(&sound); |
146 } | 146 } |