source: abuse/trunk/src/sdl2port/sound.h @ 731

Last change on this file since 731 was 731, checked in by jjsimpso, 8 years ago

sdlport: Add support for SDL2, inculding the game controller API. Configure
script will check for SDL2 and use it if present, otherwise it will fall
back to SDL v1. Some old SDL v1 features not implemented yet on SDL2, such
as saving screenshots.

core: Small change for SDL2 game controller API to disable the game
controller in the save/load game menu.

Summary of game controller API changes:

  • Enable with -gamepad
  • Tested with PS3 dualshock 3.
  • D-pad moves, right analog controls aiming
  • X: change weapon, []: jump, R1: fire, L1: special ability, /\:use/activate
  • All menu navigation requires the mouse, which is disabled during normal game play.
File size: 1.3 KB
RevLine 
[731]1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
5 *
6 *  This software was released into the Public Domain. As with most public
7 *  domain software, no warranty is made or implied by Crack dot Com, by
8 *  Jonathan Clark, or by Sam Hocevar.
9 */
10
11#ifndef __SOUND_H__
12#define __SOUND_H__
13
14#if !defined __CELLOS_LV2__
15#   include <SDL/SDL_mixer.h>
16#endif
17
18/* options are passed via command line */
19
20#define SFX_INITIALIZED    1
21#define MUSIC_INITIALIZED  2
22
23int sound_init(int argc, char **argv);
24void sound_uninit();
25void print_sound_options(); // print the options avaible for sound
26
27class sound_effect
28{
29public:
30    sound_effect(char const *filename);
31    ~sound_effect();
32
33    void play(int volume = 127, int pitch = 128, int panpot = 128);
34
35private:
36#if !defined __CELLOS_LV2__
37    Mix_Chunk* m_chunk;
38#endif
39};
40
41class song
42{
43public:
44#if !defined __CELLOS_LV2__
45    char const *name() { return Name; }
46#endif
47    song(char const *filename);
48    void play(unsigned char volume=127);
49    void stop(long fadeout_time=0); // time in ms
50    int playing();
51    void set_volume(int volume);
52    ~song();
53
54private:
55#if !defined __CELLOS_LV2__
56    char *Name;
57    unsigned char *data;
58    unsigned long song_id;
59    Mix_Music* music;
60    SDL_RWops* rw;
61#endif
62};
63
64#endif
65
Note: See TracBrowser for help on using the repository browser.