dxx-rebirth/common/main/songs.h
Kp f491059ed7 Enable building with SDL2
This commit enables Rebirth to build with SDL2, but the result is not
perfect.

- SDL2 removed some sticky key support.  Rebirth may behave differently
  now in this area.
- SDL2 removed some key-repeat related support.  Rebirth may behave
  differently now in this area.
- SDL2 gained the ability to make a window fullscreen by sizing it to
  the desktop instead of by changing the desktop resolution.  Rebirth
  uses this, and it mostly works.
  - Resizing while in the automap does not notify the automap code, so
    the view is wrong until the player switches out of automap mode and
    back in.
- SDL2 changed how to enumerate available resolutions.  Since
  fitting the window to the desktop is generally more useful than
  fitting the desktop to the window, I chose to drop support for
  enumerating resolutions instead of porting to the new API.  Users can
  now enter an arbitrary window dimension and Rebirth will make an
  attempt to use it.
  - It might be useful to cap the window dimension at the desktop
    dimension, but that is not done yet.
  - Entering fullscreen mode through the Controls->Graphics submenu
    failed to notify the relevant subsystems, causing the rendered
    content not to rescale.  For now, compile out the option to toggle
    full screen through that menu.  Toggling through Alt+Enter works
    properly.

Despite these quirks, this is a substantial improvement over the prior
commit, where SDL2 cannot be used at all.  The remaining issues can be
resolved in future work.

References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/82>
2018-07-28 23:22:58 +00:00

77 lines
1.8 KiB
C++

/*
* This file is part of the DXX-Rebirth project <http://www.dxx-rebirth.com/>.
* It is copyright by its individual contributors, as recorded in the
* project's Git history. See COPYING.txt at the top level for license
* terms and a link to the Git history.
*/
/*
*
* Header for songs.c
*
*/
#ifndef _SONGS_H
#define _SONGS_H
#include <SDL_version.h>
#ifdef __cplusplus
#include "dxxsconf.h"
struct bim_song_info
{
char filename[16];
};
#define SONG_TITLE 0
#define SONG_BRIEFING 1
#define SONG_ENDLEVEL 2
#define SONG_ENDGAME 3
#define SONG_CREDITS 4
#define SONG_FIRST_LEVEL_SONG 5
#define SONG_EXT_HMP "hmp"
#if DXX_USE_SDLMIXER
#define SONG_EXT_MID "mid"
#define SONG_EXT_OGG "ogg"
#define SONG_EXT_FLAC "flac"
#define SONG_EXT_MP3 "mp3"
#endif
#if !DXX_USE_SDLMIXER
#ifdef _WIN32
#define songs_play_file(filename,repeat,hook_finished_track) songs_play_file(filename,repeat)
#else
#define songs_play_file(filename,repeat,hook_finished_track) songs_play_file()
#endif
#if SDL_MAJOR_VERSION == 2
#define songs_play_song(songnum,repeat) songs_play_song(songnum)
#endif
#endif
int songs_play_file(const char *filename, int repeat, void (*hook_finished_track)());
#ifdef dsx
namespace dsx {
int songs_play_song( int songnum, int repeat );
int songs_play_level_song( int levelnum, int offset );
//stop any songs - midi, redbook or jukebox - that are currently playing
}
#endif
void songs_stop_all(void);
// check which song is playing, or -1 if not playing anything
int songs_is_playing();
void songs_pause(void);
void songs_resume(void);
void songs_pause_resume(void);
// set volume for selected music playback system
void songs_set_volume(int volume);
void songs_uninit();
#endif
#endif