// $Id: settingsdisplay.h,v 1.5 2006/08/26 19:40:49 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. #ifndef _SETTINGSDISPLAY_H_ #define _SETTINGSDISPLAY_H_ #include "settings.h" #include "SDL.h" #include "SDL_image.h" #include "enums.h" #include #include namespace FS { class SettingsDisplay { private: static const int NUM_OPTIONS = 5; enum SettingsOptions { CONTROL, SOUND, SIZE, OK, CANCEL }; static const int TICK0_X_OFFSET = 110; static const int TICK1_X_OFFSET = 180; static const int TICK_Y_OFFSET = 36; static const int NUM_IMAGES = 12; static const int FAINT_OFFSET = 6; enum SettingsImageIDs { IMAGE_CONTROL, IMAGE_SOUND, IMAGE_SIZE, IMAGE_OK, IMAGE_CANCEL, IMAGE_TICK, IMAGE_CONTROL_FAINT, IMAGE_SOUND_FAINT, IMAGE_SIZE_FAINT, IMAGE_OK_FAINT, IMAGE_CANCEL_FAINT, IMAGE_TICK_FAINT }; // enum SettingsImageIDs SDL_Surface * screen; // from GameManager SDL_Surface * background; SDL_Surface * my_images[NUM_IMAGES]; SDL_Rect option_rects[NUM_OPTIONS]; SDL_Rect dirty_rects[2]; Settings * my_settings; int current_option; int last_option; void init_rects(); void do_redraw(); void draw_tick(int option, bool highlighted); bool scratch_joystick_selected; bool scratch_sound; bool scratch_fullscreen; void init_scratch(); void write_scratch(); void swap_scratch(int option); public: SettingsDisplay(SDL_Surface * s, Settings * _my_settings); ~SettingsDisplay(); void start_draw(); // Returns true if user has selected 'OK' or 'Cancel' or // pressed 'ESC' - all processing finished. bool redraw(KeyboardEvent * events, int n); }; // class SettingsDisplay } // namespace FS #endif