Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro-2pick
Commits
bd8b1f92
Commit
bd8b1f92
authored
Dec 15, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement YGOPRO_USE_IRRKLANG switch
parent
cc086f3f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
5 deletions
+29
-5
gframe/config.h
gframe/config.h
+0
-1
gframe/game.cpp
gframe/game.cpp
+5
-0
gframe/sound_manager.cpp
gframe/sound_manager.cpp
+16
-3
gframe/sound_manager.h
gframe/sound_manager.h
+8
-1
No files found.
gframe/config.h
View file @
bd8b1f92
...
...
@@ -48,7 +48,6 @@ inline int _wtoi(const wchar_t * s) {
#endif
#include <irrlicht.h>
#include <irrKlang.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "CGUITTFont.h"
...
...
gframe/game.cpp
View file @
bd8b1f92
...
...
@@ -640,9 +640,14 @@ bool Game::Initialize() {
if
(
!
soundManager
.
Init
())
{
chkEnableSound
->
setChecked
(
false
);
chkEnableSound
->
setEnabled
(
false
);
chkEnableSound
->
setVisible
(
false
);
chkEnableMusic
->
setChecked
(
false
);
chkEnableMusic
->
setEnabled
(
false
);
chkEnableMusic
->
setVisible
(
false
);
scrSoundVolume
->
setVisible
(
false
);
scrMusicVolume
->
setVisible
(
false
);
chkMusicMode
->
setEnabled
(
false
);
chkMusicMode
->
setVisible
(
false
);
}
env
->
getSkin
()
->
setFont
(
guiFont
);
env
->
setFocus
(
wMainMenu
);
...
...
gframe/sound_manager.cpp
View file @
bd8b1f92
#include "sound_manager.h"
#ifdef IRRKLANG_STATIC
#include "../ikpmp3/ikpMP3.h"
#endif
namespace
ygo
{
SoundManager
soundManager
;
bool
SoundManager
::
Init
()
{
#ifdef YGOPRO_USE_IRRKLANG
bgm_scene
=
-
1
;
RefreshBGMList
();
engineSound
=
irrklang
::
createIrrKlangDevice
();
...
...
@@ -21,6 +19,9 @@ bool SoundManager::Init() {
#endif
return
true
;
}
#endif // YGOPRO_USE_IRRKLANG
// TODO: Implement other sound engines
return
false
;
}
void
SoundManager
::
RefreshBGMList
()
{
RefershBGMDir
(
L""
,
BGM_DUEL
);
...
...
@@ -64,6 +65,7 @@ void SoundManager::RefershBGMDir(std::wstring path, int scene) {
#endif
}
void
SoundManager
::
PlaySoundEffect
(
int
sound
)
{
#ifdef YGOPRO_USE_IRRKLANG
if
(
!
mainGame
->
chkEnableSound
->
isChecked
())
return
;
switch
(
sound
)
{
...
...
@@ -191,8 +193,10 @@ void SoundManager::PlaySoundEffect(int sound) {
break
;
}
engineSound
->
setSoundVolume
(
mainGame
->
gameConf
.
sound_volume
);
#endif
}
void
SoundManager
::
PlayMusic
(
char
*
song
,
bool
loop
)
{
#ifdef YGOPRO_USE_IRRKLANG
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
return
;
if
(
!
engineMusic
->
isCurrentlyPlaying
(
song
))
{
...
...
@@ -200,8 +204,10 @@ void SoundManager::PlayMusic(char* song, bool loop) {
soundBGM
=
engineMusic
->
play2D
(
song
,
loop
,
false
,
true
);
engineMusic
->
setSoundVolume
(
mainGame
->
gameConf
.
music_volume
);
}
#endif
}
void
SoundManager
::
PlayBGM
(
int
scene
)
{
#ifdef YGOPRO_USE_IRRKLANG
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
return
;
if
(
!
mainGame
->
chkMusicMode
->
isChecked
())
...
...
@@ -219,14 +225,21 @@ void SoundManager::PlayBGM(int scene) {
BufferIO
::
EncodeUTF8
(
fname
,
BGMName
);
PlayMusic
(
BGMName
,
false
);
}
#endif
}
void
SoundManager
::
StopBGM
()
{
#ifdef YGOPRO_USE_IRRKLANG
engineMusic
->
stopAllSounds
();
#endif
}
void
SoundManager
::
SetSoundVolume
(
double
volume
)
{
#ifdef YGOPRO_USE_IRRKLANG
engineSound
->
setSoundVolume
(
volume
);
#endif
}
void
SoundManager
::
SetMusicVolume
(
double
volume
)
{
#ifdef YGOPRO_USE_IRRKLANG
engineMusic
->
setSoundVolume
(
volume
);
#endif
}
}
gframe/sound_manager.h
View file @
bd8b1f92
...
...
@@ -3,7 +3,12 @@
#include "config.h"
#include "game.h"
#include <vector>
#ifdef YGOPRO_USE_IRRKLANG
#include <irrKlang.h>
#ifdef IRRKLANG_STATIC
#include "../ikpmp3/ikpMP3.h"
#endif
#endif
namespace
ygo
{
...
...
@@ -11,9 +16,11 @@ class SoundManager {
private:
std
::
vector
<
std
::
wstring
>
BGMList
[
8
];
int
bgm_scene
;
#ifdef YGOPRO_USE_IRRKLANG
irrklang
::
ISoundEngine
*
engineSound
;
irrklang
::
ISoundEngine
*
engineMusic
;
irrklang
::
ISound
*
soundBGM
;
#endif
void
RefershBGMDir
(
std
::
wstring
path
,
int
scene
);
public:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment