// $Id: pausemenu.cc,v 1.2 2007/02/25 13:34:56 matthew Exp $ // Fish Supper // Copyright (C) 2006 Matthew Clarke // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. #include "pausemenu.h" #include // ******************* // *** CONSTRUCTOR *** // ******************* FS::PauseMenu::PauseMenu() { // ... } // FS::PauseMenu::PauseMenu // ****************** // *** DESTRUCTOR *** // ****************** FS::PauseMenu::~PauseMenu() { // ... } // FS::PauseMenu::~PauseMenu // ************************ // *** MEMBER FUNCTIONS *** // ************************ // ************************************************** void FS::PauseMenu::reset() { current_selection = PMS_CONTINUE; // this is the default } // FS::PauseMenu::reset // ************************************************** FS::PauseMenu::PauseMenuSelection FS::PauseMenu::update(KeyboardEvent * events, int n) { bool selection_made = false; int i = 0; while (i < n) { if (events[i] == ESCAPE_PRESSED) { current_selection = PMS_CONTINUE; selection_made = true; break; } else if (events[i] == JUMP_KEY_PRESSED) { selection_made = true; break; } else if (events[i] == UP_KEY_PRESSED || events[i] == DOWN_KEY_PRESSED) { current_selection = ((current_selection == PMS_CONTINUE) ? PMS_QUIT : PMS_CONTINUE); } // if ... else ++i; } // while if (selection_made) { return current_selection; } else { return PMS_NONE; } // if ... else } // FS::PauseMenu::update // ************************************************** FS::ImageIDs FS::PauseMenu::get_image_id() { return ((current_selection == PMS_CONTINUE) ? PAUSE_MENU_CONTINUE : PAUSE_MENU_QUIT); } // FS::PauseMenu::get_image_id // **************************************************