]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
dialog clicks are back baybee
authorClyne Sullivan <tullivan99@gmail.com>
Sun, 27 Nov 2016 22:13:13 +0000 (17:13 -0500)
committerClyne Sullivan <tullivan99@gmail.com>
Sun, 27 Nov 2016 22:13:13 +0000 (17:13 -0500)
assets/sounds/click.wav
include/events.hpp
include/ui.hpp
src/config.cpp
src/engine.cpp
src/ui.cpp
src/window.cpp

index 976fb42fab64abb528361a39e21193741ab7787f..bdcedba45654eb216689c515bff83339e1e8e602 100644 (file)
Binary files a/assets/sounds/click.wav and b/assets/sounds/click.wav differ
index f38d4e67d75883644b3a58276311693fcc99d25b..2daae5608c0243275f84fd206cdc99be28333950 100644 (file)
@@ -1,4 +1,4 @@
-z#ifndef EVENTS_HPP_
+#ifndef EVENTS_HPP_
 #define EVENTS_HPP_
 
 /**
index 85c5997a30e9672ba2bf5f29e67fff6fb85fa734..8d517c79f0989ce261e52b7baf0035e0a5a95c34 100644 (file)
@@ -82,6 +82,7 @@ namespace ui {
        */
 
        void initFonts(void);
+       void initSounds(void);
 
        void destroyFonts(void);
 
index d18016ffaf028adce40ef9ae5feb7304a0e9077b..844bf3962c85e55de9f72d9c5cb819d2389ad7d8 100644 (file)
@@ -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) {
index 5e8b3e58c85b12553d723f705b2ae93a0214b92a..8db46890641e94f4dff6fc91bcb9ac11141ae9a5 100644 (file)
@@ -32,6 +32,7 @@ void Engine::init(void) {
 
     systems.configure();
 
+    ui::initSounds();
        game::config::update();
        getSystem<PlayerSystem>()->create();
 }
index 9439e30b3e0cbc383998ce1540cbc5ddfc29f780..ac7a40035b84543b7294d5257d494cba0bc56498 100644 (file)
@@ -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 {
index f878ec31274024e9d1dab48428f754b3177642d2..29bd7c7a7b1d9961d3c849083b6c36aed5699367 100644 (file)
@@ -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>