aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2016-11-27 17:13:13 -0500
committerClyne Sullivan <tullivan99@gmail.com>2016-11-27 17:13:13 -0500
commit95f6378e62cc6a7f25305d6f2317ad25d459f9c0 (patch)
treed29e16eb5b129c1541840c9278880bdc7285c2d8
parent3437e928e978939aa4c85369ab597e08f00ab93b (diff)
dialog clicks are back baybee
-rw-r--r--assets/sounds/click.wavbin17684 -> 17684 bytes
-rw-r--r--include/events.hpp2
-rw-r--r--include/ui.hpp1
-rw-r--r--src/config.cpp5
-rw-r--r--src/engine.cpp1
-rw-r--r--src/ui.cpp11
-rw-r--r--src/window.cpp4
7 files changed, 14 insertions, 10 deletions
diff --git a/assets/sounds/click.wav b/assets/sounds/click.wav
index 976fb42..bdcedba 100644
--- a/assets/sounds/click.wav
+++ b/assets/sounds/click.wav
Binary files differ
diff --git a/include/events.hpp b/include/events.hpp
index f38d4e6..2daae56 100644
--- a/include/events.hpp
+++ b/include/events.hpp
@@ -1,4 +1,4 @@
-z#ifndef EVENTS_HPP_
+#ifndef EVENTS_HPP_
#define EVENTS_HPP_
/**
diff --git a/include/ui.hpp b/include/ui.hpp
index 85c5997..8d517c7 100644
--- a/include/ui.hpp
+++ b/include/ui.hpp
@@ -82,6 +82,7 @@ namespace ui {
*/
void initFonts(void);
+ void initSounds(void);
void destroyFonts(void);
diff --git a/src/config.cpp b/src/config.cpp
index d18016f..844bf39 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -59,9 +59,8 @@ namespace game {
}
void update(void) {
- Mix_Volume(0, VOLUME_MASTER);
- Mix_Volume(1, VOLUME_SFX * (VOLUME_MASTER / 100.0f));
- Mix_VolumeMusic(VOLUME_MUSIC * (VOLUME_MASTER / 100.0f));
+ Mix_Volume(0, static_cast<int>(VOLUME_SFX * (VOLUME_MASTER / 100)));
+ Mix_VolumeMusic(static_cast<int>(VOLUME_MUSIC * (VOLUME_MASTER / 100)));
}
void save(void) {
diff --git a/src/engine.cpp b/src/engine.cpp
index 5e8b3e5..8db4689 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -32,6 +32,7 @@ void Engine::init(void) {
systems.configure();
+ ui::initSounds();
game::config::update();
getSystem<PlayerSystem>()->create();
}
diff --git a/src/ui.cpp b/src/ui.cpp
index 9439e30..ac7a400 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -204,12 +204,14 @@ namespace ui {
#ifdef DEBUG
DEBUG_printf("Initialized FreeType2.\n",NULL);
#endif // DEBUG
+
+ fontSize = 0;
+ }
+
+ void initSounds(void) {
dialogClick = Mix_LoadWAV("assets/sounds/click.wav");
battleStart = Mix_LoadWAV("assets/sounds/frig.wav");
sanic = Mix_LoadWAV("assets/sounds/sanic.wav");
- //Mix_Volume(1,50);
-
- fontSize = 0;
}
void destroyFonts(void) {
@@ -937,7 +939,8 @@ namespace ui {
static unsigned int rtext_oldsize = 0;
if (rtext_oldsize != rtext.size()) {
if (!isspace(rtext[(rtext_oldsize = rtext.size()) - 1]))
- Mix_PlayChannel(1, dialogClick, 0);
+ Mix_PlayChannel(0, dialogClick, 0);
+
}
} else {
diff --git a/src/window.cpp b/src/window.cpp
index f878ec3..29bd7c7 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -74,10 +74,10 @@ void WindowSystem::receive(const WindowResizeEvent &wre)
{
game::SCREEN_WIDTH = wre.x;
game::SCREEN_HEIGHT = wre.y;
-
+
glViewport(0, 0, wre.x, wre.y);
SDL_SetWindowSize(window, wre.x, wre.y);
-}
+}
#include <ui.hpp>