Skip to content

Commit

Permalink
Fixed ifdef out of audio
Browse files Browse the repository at this point in the history
  • Loading branch information
Krishna committed Mar 29, 2010
1 parent 0d33e21 commit ced93d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 6 additions & 6 deletions viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define DEFAULT_GAME_SPEED 50
#define WIDTH 16
#define HEIGHT 10
#define ENABLE_SOUND 1

using namespace std;

Viewer::Viewer()
Expand Down Expand Up @@ -150,7 +150,7 @@ void Viewer::on_realize()


// Load music
#ifndef ENABLE_AUDIO
#ifdef ENABLE_AUDIO
introMusic = sm.LoadSound("intro.ogg");
backgroundMusic = sm.LoadSound("lumines.ogg");
moveSound = sm.LoadSound("move.ogg");
Expand Down Expand Up @@ -1100,7 +1100,7 @@ bool Viewer::on_button_press_event(GdkEventButton* event)
soundOnTex = soundOffTex;
soundOffTex = temp;
disableSound = !disableSound;
#ifndef ENABLE_AUDIO
#ifdef ENABLE_AUDIO
if (!disableSound)
sm.PlaySound(introMusic, -1);
else
Expand Down Expand Up @@ -1152,7 +1152,7 @@ bool Viewer::on_button_release_event(GdkEventButton* event)
if (clickedButton && loadScreen)
{
loadScreen = false;
#ifndef ENABLE_AUDIO
#ifdef ENABLE_AUDIO
sm.StopSound(introMusic);
if (!disableSound)
sm.PlaySound(backgroundMusic, -1);
Expand Down Expand Up @@ -1768,7 +1768,7 @@ bool Viewer::on_key_press_event( GdkEventKey *ev )
if (gameOver)
return true;

#ifndef ENABLE_AUDIO
#ifdef ENABLE_AUDIO
if (loadScreen || !disableSound)
{
if (ev->keyval == GDK_Left || ev->keyval == GDK_Right)
Expand Down Expand Up @@ -2385,7 +2385,7 @@ void Viewer::readFile(char *filename)
void Viewer::toggleSound()
{
disableSound = !disableSound;
#ifndef ENABLE_AUDIO
#ifdef ENABLE_AUDIO
if (disableSound)
{
sm.StopSound(introMusic);
Expand Down
4 changes: 4 additions & 0 deletions viewer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <vector>
#include "particle.hpp"
#include <GL/glu.h>
//#define ENABLE_SOUND 1

// The "main" OpenGL widget
class Viewer : public Gtk::GL::DrawingArea {
public:
Expand Down Expand Up @@ -192,7 +194,9 @@ class Viewer : public Gtk::GL::DrawingArea {
bool loadTexture;
bool loadBumpMapping;
bool transluceny;
#ifdef ENABLE_SOUND
SoundManager sm;
#endif
int backgroundMusic;
int turnSound;
int moveSound;
Expand Down

0 comments on commit ced93d3

Please sign in to comment.