Added experimental makepkg-update-checksums.sh
[mirrors/Programs.git] / c / sdl / sdl.c
1 /*
2 Add SDL.lib, SDLmain.lib and SDL_mixer.lib to your project settings.
3 g++ -o sdl02 sdl.c `sdl-config --cflags --libs`
4
5 */
6
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <string.h>
10 #include <math.h>
11
12 #include <SDL/SDL.h>
13 #include <SDL/SDL_mixer.h>
14
15 class sound{
16 public:
17 sound();
18 ~sound();
19 void playWAV(const char *wav);
20 void playMP3(const char *mp3);
21 };
22
23 sound::sound(){}
24 sound::~sound(){}
25
26 void sound::playWAV(const char *wav){
27 Mix_Chunk *music;
28 Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 2048);
29 music = Mix_LoadWAV(wav);
30 Mix_PlayChannel(1,music,0);
31 }
32
33 void sound::playMP3(const char *mp3){
34 Mix_Music *music;
35 Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 2048);
36 music = Mix_LoadMUS(mp3);
37 Mix_VolumeMusic(100);
38 Mix_PlayMusic(music,-1);
39
40 }
41
This page took 0.635804 seconds and 4 git commands to generate.