Files
JailAudio/main.cpp
2021-02-03 21:39:28 +01:00

38 lines
959 B
C++

#include "jail_audio.h"
#include <stdlib.h>
#include <SDL2/SDL.h>
SDL_Event event;
SDL_Window *sdlWindow;
int main(int argc, char **argv) {
SDL_Init(SDL_INIT_EVERYTHING);
sdlWindow = SDL_CreateWindow("JailAudio", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 320, 240, SDL_WINDOW_SHOWN);
JA_Init(48000, AUDIO_S16, 2);
JA_PlayMusic("intro2.ogg");
JA_Sound peiv = JA_LoadSound("menu_select.wav");
bool should_exit = false;
while(!should_exit) {
while(SDL_PollEvent(&event)) {
if (event.type == SDL_QUIT) { should_exit = true; break; }
if (event.type == SDL_KEYDOWN) {
JA_PlaySound(peiv);
if (JA_IsMusicPlaying())
JA_PauseMusic();
else
{
JA_RestartMusic();
}
}
}
}
SDL_DestroyWindow(sdlWindow);
SDL_Quit();
return 0;
}