void abort_example(char const *format, ...) { char str[1024]; va_list args; ALLEGRO_DISPLAY *display; va_start(args, format); vsnprintf(str, sizeof str, format, args); va_end(args); display = al_is_system_installed() ? al_get_current_display() : NULL; al_show_native_message_box(display, "Error", "Cannot run example", str, NULL, 0); exit(1); }
bool System::shutdownSharedSystem() { if (al_is_joystick_installed()) al_uninstall_joystick(); if (al_is_mouse_installed()) al_uninstall_mouse(); if (al_is_keyboard_installed()) al_uninstall_keyboard(); al_shutdown_image_addon(); if (al_is_system_installed()) al_uninstall_system(); return true; }
void install() { // setup allegro init = al_is_system_installed() && al_install_audio() && al_init_acodec_addon() && al_reserve_samples(0); // create bgm channel bgm_channel = al_create_sample_instance(NULL); al_attach_sample_instance_to_mixer(bgm_channel, al_get_default_mixer()); al_set_sample_instance_playmode(bgm_channel, ALLEGRO_PLAYMODE_LOOP); // create sample channels for (int i=0; i<SAMPLE_MAX; i++) { effects.push_back( al_create_sample_instance(NULL) ); al_attach_sample_instance_to_mixer(effects[i], al_get_default_mixer()); } // setup volume set_volume(master_vol); }
void Renderer::uninit() { if(queue_) al_destroy_event_queue(queue_); if(tmr_) al_destroy_timer(tmr_); if(prg_) { al_use_shader(nullptr); al_destroy_shader(prg_); } if(resManager_) delete resManager_; for(auto chunk: chunkData_) { delete chunk.second; } chunkData_.clear(); if(dpy_) al_destroy_display(dpy_); if(al_is_system_installed()) al_uninstall_system(); tmr_ = nullptr; dpy_ = nullptr; queue_ = nullptr; prg_ = nullptr; resManager_ = nullptr; // TODO: delete loaded chunks? }
VALUE rbal_is_system_installed(VALUE rself) { return RBH_INT_BOOL(al_is_system_installed()); }
static mrb_value installed(mrb_state *mrb, mrb_value self) { return mrb_bool_value(al_is_system_installed()); }