Skip to content

Commit

Permalink
Fixed up some of the menus
Browse files Browse the repository at this point in the history
  • Loading branch information
Krishna committed Mar 28, 2010
1 parent 5a7b80b commit 0da8f67
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
12 changes: 5 additions & 7 deletions appwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ AppWindow::AppWindow()

// Slots to connect to functions
sigc::slot1<void, Viewer::DrawMode> draw_slot = sigc::mem_fun(m_viewer, &Viewer::setDrawMode);
sigc::slot0<void> buffer_slot = sigc::mem_fun(m_viewer, &Viewer::toggleBuffer);
sigc::slot0<void> sound_slot = sigc::mem_fun(m_viewer, &Viewer::toggleSound);

// Set up the application menu
// The slot we use here just causes AppWindow::hide() on this,
Expand All @@ -25,19 +25,17 @@ AppWindow::AppWindow()
m_menu_app.items().push_back(MenuElem("_Quit", Gtk::AccelKey("q"),
sigc::mem_fun(*this, &AppWindow::hide)));

m_menu_drawMode.items().push_back(MenuElem("_Face", Gtk::AccelKey("f"), sigc::bind( draw_slot, Viewer::FACE ) ) );
m_menu_drawMode.items().push_back(MenuElem("_Texture 1", Gtk::AccelKey("t"), sigc::mem_fun(m_viewer, &Viewer::toggleTexture ) ) );
m_menu_drawMode.items().push_back(MenuElem("_Bump Mapping 1", Gtk::AccelKey("b"), sigc::mem_fun(m_viewer, &Viewer::toggleBumpMapping ) ) );
m_menu_drawMode.items().push_back(MenuElem("_Textures", Gtk::AccelKey("t"), sigc::mem_fun(m_viewer, &Viewer::toggleTexture ) ) );
m_menu_drawMode.items().push_back(MenuElem("_Bump Mapping", Gtk::AccelKey("b"), sigc::mem_fun(m_viewer, &Viewer::toggleBumpMapping ) ) );
m_menu_drawMode.items().push_back(MenuElem("_Translucency", Gtk::AccelKey("u"), sigc::mem_fun(m_viewer, &Viewer::toggleTranslucency ) ) );
m_menu_drawMode.items().push_back(MenuElem("_Move Light Source", Gtk::AccelKey("l"), sigc::mem_fun(m_viewer, &Viewer::toggleMoveLightSource ) ) );
m_menu_drawMode.items().push_back(MenuElem("Motion _Blur", Gtk::AccelKey("m"), sigc::mem_fun(m_viewer, &Viewer::toggleMotionBlur ) ) );

m_menu_buffer.items().push_back(CheckMenuElem("_Double Buffer", Gtk::AccelKey("b"), buffer_slot ));
m_menu_drawMode.items().push_back(CheckMenuElem("_Enable Sound", Gtk::AccelKey("s"), sound_slot ));

// Set up the menu bar
m_menubar.items().push_back(Gtk::Menu_Helpers::MenuElem("_File", m_menu_app));
m_menubar.items().push_back(Gtk::Menu_Helpers::MenuElem("_Draw Mode", m_menu_drawMode));
m_menubar.items().push_back(Gtk::Menu_Helpers::MenuElem("_Buffer", m_menu_buffer));
m_menubar.items().push_back(Gtk::Menu_Helpers::MenuElem("_Game Settings", m_menu_drawMode));

// Set up the score label
scoreLabel.set_text("Score:\t0");
Expand Down
15 changes: 14 additions & 1 deletion viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,6 @@ bool Viewer::on_button_release_event(GdkEventButton* event)
startScalePos[1] = 0;
if (clickedButton && loadScreen)
{
clickedButton = false;
loadScreen = false;
sm.StopSound(introMusic);
if (!disableSound)
Expand Down Expand Up @@ -2411,3 +2410,17 @@ void Viewer::readFile(char *filename)
}
}
}

void Viewer::toggleSound()
{
disableSound = !disableSound;
if (disableSound)
{
sm.StopSound(introMusic);
sm.StopSound(backgroundMusic);
}
else if (loadScreen)
sm.PlaySound(introMusic, -1);
else
sm.PlaySound(backgroundMusic, 1);
}
1 change: 1 addition & 0 deletions viewer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class Viewer : public Gtk::GL::DrawingArea {
void toggleTranslucency();
void toggleMoveLightSource();
void toggleMotionBlur();
void toggleSound();
void makeRasterFont();
void printString(const char *s);

Expand Down

0 comments on commit 0da8f67

Please sign in to comment.