Audio::Audio() { m_music_path[0] = "res/sounds/musics/music_1.wav"; // hit_paddle_effect m_effects_paths[0] = "res/sounds/effects/hit_paddle.wav"; // score_up_effect m_effects_paths[1] = "res/sounds/effects/score_up.wav"; // ball_speed_up m_effects_paths[2] = "res/sounds/effects/speed_up.wav"; if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) != 0) { Debug::log_err("Audio system couldn't be initialized. Due to: ", Mix_GetError()); show_audio_drivers(); m_audio_opened = false; } else { Debug::log("Audio system initialized."); m_audio_opened = true; load_musics(); load_effects(); } }
int init_engine(SDL_GLContext *context, SDL_Window *window) { int img_flags = IMG_INIT_PNG; if (!(IMG_Init(img_flags) & img_flags)) { printf("SD_image could not initialize! SDL_image Error: %s\n", IMG_GetError()); return -1; } if (init_gl(context, window)) return -1; if (init_glew()) return -1; // if (init_effects(shader_programs, shader_infos, LENGTH(shader_programs))) { // printf("Something went wrong with shader program initialization!\n"); // return -1; // } load_effects( effects.all, LENGTH(effects.all), shader_file_paths, LENGTH(shader_file_paths), attribute_strings, LENGTH(attribute_strings), uniform_strings, LENGTH(uniform_strings)); open_simplex_noise(open_simplex_noise_seed, &osnctx); SDL_GameControllerEventState(SDL_ENABLE); /* Open the first available controller. */ SDL_GameController *controller = NULL; for (int i = 0; i < SDL_NumJoysticks(); ++i) { printf("Testing controller %i\n", i); if (SDL_IsGameController(i)) { controller = SDL_GameControllerOpen(i); if (controller) { printf("Successfully opened controller %i\n", i); break; } else { printf("Could not open gamecontroller %i: %s\n", i, SDL_GetError()); } } else { printf("Controller %i is not a controller?\n", i); } } init_keyboard(); init_render(); //Located in render.c if (signal(SIGUSR1, reload_signal_handler) == SIG_ERR) { printf("An error occurred while setting a signal handler.\n"); } return 0; }
void reload_effects_void_wrapper() { // if (!reload_effects(shader_programs, shader_infos, LENGTH(shader_programs))) { // deinit_render(); // init_render(); // } load_effects( effects.all, LENGTH(effects.all), shader_file_paths, LENGTH(shader_file_paths), attribute_strings, LENGTH(attribute_strings), uniform_strings, LENGTH(uniform_strings)); deinit_render(); init_render(); }