better getopts
[mirrors/Programs.git] / c / sdl / sdl.c
... / ...
CommitLineData
1/*
2Add SDL.lib, SDLmain.lib and SDL_mixer.lib to your project settings.
3g++ -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
15class sound{
16public:
17sound();
18~sound();
19void playWAV(const char *wav);
20void playMP3(const char *mp3);
21};
22
23sound::sound(){}
24sound::~sound(){}
25
26void 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
33void 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.282896 seconds and 4 git commands to generate.