mirror of
https://github.com/clockworkpi/Menu.git
synced 2025-12-13 07:58:51 +01:00
61 lines
1.3 KiB
Plaintext
Executable File
61 lines
1.3 KiB
Plaintext
Executable File
|
|
module program+ {
|
|
|
|
private import
|
|
rt::c,
|
|
lib::sdl2,
|
|
lib::sdl2_image,
|
|
lib::sdl2_mixer,
|
|
lib::sdl2_ttf;
|
|
|
|
func startup() {
|
|
std::init();
|
|
if !lib::curl::so::init() or
|
|
!lib::dbus::so::init() or
|
|
!lib::sdl2::so::init() or
|
|
!lib::sdl2_image::so::init() or
|
|
!lib::sdl2_mixer::so::init() or
|
|
!lib::sdl2_ttf::so::init()or
|
|
!lib::sqlite3::so::init() {
|
|
exit(1);
|
|
}
|
|
init_sdl();
|
|
srand2(clock(), time(null), getpid());
|
|
}
|
|
|
|
func cleanup() {
|
|
quit_sdl();
|
|
}
|
|
|
|
}
|
|
|
|
module program+ {
|
|
|
|
func init_sdl() {
|
|
if SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS) < 0 {
|
|
printf("SDL_Init: %s\n", SDL_GetError());
|
|
exit(1);
|
|
}
|
|
if !IMG_Init(IMG_INIT_PNG) {
|
|
printf("IMG_Init: %s\n", SDL_GetError());
|
|
exit(1);
|
|
}
|
|
if !Mix_Init(MIX_INIT_MP3) {
|
|
printf("Mix_Init: %s\n", SDL_GetError());
|
|
exit(1);
|
|
}
|
|
if TTF_Init() == -1 {
|
|
printf("TTF_Init: %s\n", SDL_GetError());
|
|
exit(1);
|
|
}
|
|
}
|
|
|
|
func quit_sdl() {
|
|
TTF_Quit();
|
|
Mix_Quit();
|
|
IMG_Quit();
|
|
SDL_Quit();
|
|
}
|
|
|
|
}
|