author | nemo |
Wed, 27 Jul 2011 09:06:51 -0400 | |
changeset 5474 | d5b392e02403 |
parent 5252 | ded882439548 |
child 5747 | 65006a679352 |
permissions | -rw-r--r-- |
555 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
4976 | 3 |
* Copyright (c) 2007-2011 Andrey Korotaev <unC0Rr@gmail.com> |
555 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
19 |
#include "SDLs.h" |
|
20 |
||
21 |
#include "SDL.h" |
|
2515
51d3f4b6293a
revert audio to use SDL_mixer -- also frontend uses it, so it needs sdlmixer sources
koda
parents:
2494
diff
changeset
|
22 |
#include "SDL_mixer.h" |
1223
41d7283934c1
Hackish way to play music in frontend... to be fixed
unc0rr
parents:
1191
diff
changeset
|
23 |
#include "hwconsts.h" |
5252 | 24 |
#include "HWApplication.h" |
2428 | 25 |
|
2515
51d3f4b6293a
revert audio to use SDL_mixer -- also frontend uses it, so it needs sdlmixer sources
koda
parents:
2494
diff
changeset
|
26 |
|
2428 | 27 |
extern char sdlkeys[1024][2][128]; |
28 |
extern char xb360buttons[][128]; |
|
29 |
extern char xb360dpad[128]; |
|
30 |
extern char xbox360axes[][128]; |
|
31 |
||
2402
edd12b259e7c
revert to manual startup of frontend's OpenAL session (keeping voices' bug fixed)
koda
parents:
2399
diff
changeset
|
32 |
|
2428 | 33 |
SDLInteraction::SDLInteraction() |
555 | 34 |
{ |
5085 | 35 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
36 |
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK); |
3697 | 37 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
38 |
musicInitialized = 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
39 |
music = NULL; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
40 |
if(SDL_NumJoysticks()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
41 |
addGameControllerKeys(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
42 |
SDL_QuitSubSystem(SDL_INIT_JOYSTICK); |
555 | 43 |
} |
44 |
||
45 |
SDLInteraction::~SDLInteraction() |
|
46 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
47 |
if (musicInitialized == 1) { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
48 |
if (music != NULL) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
49 |
Mix_FreeMusic(music); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
50 |
Mix_CloseAudio(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
51 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
52 |
SDL_Quit(); |
555 | 53 |
} |
54 |
||
55 |
QStringList SDLInteraction::getResolutions() const |
|
56 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
57 |
QStringList result; |
555 | 58 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
59 |
SDL_Rect **modes; |
555 | 60 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
61 |
modes = SDL_ListModes(NULL, SDL_FULLSCREEN); |
555 | 62 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
63 |
if((modes == (SDL_Rect **)0) || (modes == (SDL_Rect **)-1)) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
64 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
65 |
result << "640x480"; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
66 |
} else |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
67 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
68 |
for(int i = 0; modes[i]; ++i) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
69 |
if ((modes[i]->w >= 640) && (modes[i]->h >= 480)) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
70 |
result << QString("%1x%2").arg(modes[i]->w).arg(modes[i]->h); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
71 |
} |
555 | 72 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
73 |
return result; |
555 | 74 |
} |
2191 | 75 |
|
2428 | 76 |
void SDLInteraction::addGameControllerKeys() const |
77 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
78 |
QStringList result; |
2428 | 79 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
80 |
int i = 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
81 |
while(i < 1024 && sdlkeys[i][1][0] != '\0') |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
82 |
i++; |
2428 | 83 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
84 |
// Iterate through all game controllers |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
85 |
for(int jid = 0; jid < SDL_NumJoysticks(); jid++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
86 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
87 |
SDL_Joystick* joy = SDL_JoystickOpen(jid); |
3697 | 88 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
89 |
// Retrieve the game controller's name and strip "Controller (...)" that's added by some drivers (English only) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
90 |
QString joyname = QString(SDL_JoystickName(jid)).replace(QRegExp("^Controller \\((.*)\\)$"), "\\1"); |
2428 | 91 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
92 |
// Connected Xbox 360 controller? Use specific button names then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
93 |
// Might be interesting to add 'named' buttons for the most often used gamepads |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
94 |
bool isxb = joyname.contains("Xbox 360"); |
2428 | 95 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
96 |
// This part of the string won't change for multiple keys/hats, so keep it |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
97 |
QString prefix = QString("%1 (%2): ").arg(joyname).arg(jid + 1); |
2428 | 98 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
99 |
// Register entries for missing axes not assigned to sticks of this joystick/gamepad |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
100 |
for(int aid = 0; aid < SDL_JoystickNumAxes(joy) && i < 1021; aid++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
101 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
102 |
// Again store the part of the string not changing for multiple uses |
5252 | 103 |
QString axis = prefix + HWApplication::translate("binds (keys)", "Axis") + QString(" %1 ").arg(aid + 1); |
3697 | 104 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
105 |
// Entry for "Axis Up" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
106 |
sprintf(sdlkeys[i][0], "j%da%du", jid, aid); |
5252 | 107 |
sprintf(sdlkeys[i++][1], "%s", ((isxb && aid < 5) ? (prefix + HWApplication::translate("binds (keys)", xbox360axes[aid * 2])) : axis + HWApplication::translate("binds (keys)", "(Up)")).toStdString().c_str()); |
2428 | 108 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
109 |
// Entry for "Axis Down" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
110 |
sprintf(sdlkeys[i][0], "j%da%dd", jid, aid); |
5252 | 111 |
sprintf(sdlkeys[i++][1], "%s", ((isxb && aid < 5) ? (prefix + HWApplication::translate("binds (keys)", xbox360axes[aid * 2 + 1])) : axis + HWApplication::translate("binds (keys)", "(Down)")).toStdString().c_str()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
112 |
} |
2428 | 113 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
114 |
// Register entries for all coolie hats of this joystick/gamepad |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
115 |
for(int hid = 0; hid < SDL_JoystickNumHats(joy) && i < 1019; hid++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
116 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
117 |
// Again store the part of the string not changing for multiple uses |
5252 | 118 |
QString hat = prefix + (isxb ? (HWApplication::translate("binds (keys)", xb360dpad) + QString(" ")) : HWApplication::translate("binds (keys)", "Hat") + QString(" %1 ").arg(hid + 1)); |
2428 | 119 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
120 |
// Entry for "Hat Up" |
3697 | 121 |
sprintf(sdlkeys[i][0], "j%dh%du", jid, hid); |
5252 | 122 |
sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Up)")).toStdString().c_str()); |
2428 | 123 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
124 |
// Entry for "Hat Down" |
3697 | 125 |
sprintf(sdlkeys[i][0], "j%dh%dd", jid, hid); |
5252 | 126 |
sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Down)")).toStdString().c_str()); |
2428 | 127 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
128 |
// Entry for "Hat Left" |
3697 | 129 |
sprintf(sdlkeys[i][0], "j%dh%dl", jid, hid); |
5252 | 130 |
sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Left)")).toStdString().c_str()); |
2428 | 131 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
132 |
// Entry for "Hat Right" |
3697 | 133 |
sprintf(sdlkeys[i][0], "j%dh%dr", jid, hid); |
5252 | 134 |
sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Right)")).toStdString().c_str()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
135 |
} |
3697 | 136 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
137 |
// Register entries for all buttons of this joystick/gamepad |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
138 |
for(int bid = 0; bid < SDL_JoystickNumButtons(joy) && i < 1022; bid++) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
139 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
140 |
// Buttons |
3697 | 141 |
sprintf(sdlkeys[i][0], "j%db%d", jid, bid); |
5252 | 142 |
sprintf(sdlkeys[i++][1], "%s", (prefix + ((isxb && bid < 10) ? (HWApplication::translate("binds (keys)", xb360buttons[bid]) + QString(" ")) : HWApplication::translate("binds (keys)", "Button") + QString(" %1").arg(bid + 1))).toStdString().c_str()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
143 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
144 |
// Close the game controller as we no longer need it |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
145 |
SDL_JoystickClose(joy); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
146 |
} |
3697 | 147 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
148 |
// Terminate the list |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
149 |
sdlkeys[i][0][0] = '\0'; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
150 |
sdlkeys[i][1][0] = '\0'; |
2428 | 151 |
} |
152 |
||
2515
51d3f4b6293a
revert audio to use SDL_mixer -- also frontend uses it, so it needs sdlmixer sources
koda
parents:
2494
diff
changeset
|
153 |
void SDLInteraction::SDLMusicInit() |
51d3f4b6293a
revert audio to use SDL_mixer -- also frontend uses it, so it needs sdlmixer sources
koda
parents:
2494
diff
changeset
|
154 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
155 |
if (musicInitialized == 0) { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
156 |
SDL_Init(SDL_INIT_AUDIO); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
157 |
Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
158 |
musicInitialized = 1; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
159 |
} |
2515
51d3f4b6293a
revert audio to use SDL_mixer -- also frontend uses it, so it needs sdlmixer sources
koda
parents:
2494
diff
changeset
|
160 |
} |
51d3f4b6293a
revert audio to use SDL_mixer -- also frontend uses it, so it needs sdlmixer sources
koda
parents:
2494
diff
changeset
|
161 |
|
51d3f4b6293a
revert audio to use SDL_mixer -- also frontend uses it, so it needs sdlmixer sources
koda
parents:
2494
diff
changeset
|
162 |
|
2399
ddde0ac1472b
fix a bug that prevented from hearing team voicepacks if frontend started with music disabled
koda
parents:
2392
diff
changeset
|
163 |
void SDLInteraction::StartMusic() |
1223
41d7283934c1
Hackish way to play music in frontend... to be fixed
unc0rr
parents:
1191
diff
changeset
|
164 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
165 |
SDLMusicInit(); |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5085
diff
changeset
|
166 |
QFile tmpfile; |
2515
51d3f4b6293a
revert audio to use SDL_mixer -- also frontend uses it, so it needs sdlmixer sources
koda
parents:
2494
diff
changeset
|
167 |
|
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5085
diff
changeset
|
168 |
tmpfile.setFileName(cfgdir->absolutePath() + "/Data/Music/main_theme.ogg"); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5085
diff
changeset
|
169 |
if (!tmpfile.exists()) tmpfile.setFileName(datadir->absolutePath() + "/Music/main_theme.ogg"); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
170 |
if (music == NULL) { |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5085
diff
changeset
|
171 |
music = Mix_LoadMUS(QFileInfo(tmpfile).absoluteFilePath().toLocal8Bit().constData()); |
3697 | 172 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
173 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
174 |
Mix_VolumeMusic(MIX_MAX_VOLUME - 28); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
175 |
Mix_FadeInMusic(music, -1, 1750); |
1223
41d7283934c1
Hackish way to play music in frontend... to be fixed
unc0rr
parents:
1191
diff
changeset
|
176 |
} |
41d7283934c1
Hackish way to play music in frontend... to be fixed
unc0rr
parents:
1191
diff
changeset
|
177 |
|
41d7283934c1
Hackish way to play music in frontend... to be fixed
unc0rr
parents:
1191
diff
changeset
|
178 |
void SDLInteraction::StopMusic() |
41d7283934c1
Hackish way to play music in frontend... to be fixed
unc0rr
parents:
1191
diff
changeset
|
179 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
180 |
if (music != NULL) { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
181 |
// fade out music to finish 0,5 seconds from now |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
182 |
while(!Mix_FadeOutMusic(1000) && Mix_PlayingMusic()) { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
183 |
SDL_Delay(100); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
184 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2531
diff
changeset
|
185 |
} |
1223
41d7283934c1
Hackish way to play music in frontend... to be fixed
unc0rr
parents:
1191
diff
changeset
|
186 |
} |
2402
edd12b259e7c
revert to manual startup of frontend's OpenAL session (keeping voices' bug fixed)
koda
parents:
2399
diff
changeset
|
187 |