mirror of
https://github.com/clockworkpi/Menu.git
synced 2026-03-20 10:52:50 +01:00
first commit
This commit is contained in:
60
60_Utils/02_Bean/beans/shell/program.bean
Executable file
60
60_Utils/02_Bean/beans/shell/program.bean
Executable file
@@ -0,0 +1,60 @@
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user