00001 /****************************************************************************** 00002 * Wormux is a convivial mass murder game. 00003 * Copyright (C) 2001-2004 Lawrence Azzoug. 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00018 ****************************************************************************** 00019 * Graphical interface showing various information about the game. 00020 *****************************************************************************/ 00021 00022 #ifndef INTERFACE_H 00023 #define INTERFACE_H 00024 #include <vector> 00025 #include "weapon_menu.h" 00026 #include "../graphic/surface.h" 00027 #include "../graphic/sprite.h" 00028 #include "../gui/progress_bar.h" 00029 #include "../include/base.h" 00030 #include "../character/character.h" 00031 #include "../team/team.h" 00032 00033 #ifdef WIN32 00034 #undef interface 00035 #endif 00036 00037 class Interface 00038 { 00039 00040 public: 00041 Character *character_under_cursor; 00042 Weapon* weapon_under_cursor; 00043 WeaponsMenu weapons_menu; 00044 Team * tmp_team; 00045 00046 private: 00047 // Timers 00048 Text * global_timer; 00049 Text * timer; 00050 uint remaining_turn_time; 00051 00052 // Character information 00053 Text * t_character_name; 00054 Text * t_team_name; 00055 Text * t_player_name; 00056 00057 Text * t_character_energy; 00058 00059 // Weapon information 00060 Text * t_weapon_name; 00061 Text * t_weapon_stock; 00062 00063 bool display; 00064 int start_hide_display; 00065 int start_show_display; 00066 bool display_timer; 00067 EnergyBar energy_bar; 00068 ProgressBar wind_bar; 00069 00070 Surface game_menu; 00071 Surface clock_background; 00072 Surface small_background_interface; 00073 Sprite * clock; 00074 Surface wind_icon; 00075 Surface wind_indicator; 00076 Point2i bottom_bar_pos; 00077 00078 static Interface * singleton; 00079 00080 private: 00081 Interface(); 00082 ~Interface(); 00083 00084 public: 00085 static Interface * GetInstance(); 00086 WeaponsMenu & GetWeaponsMenu() { return weapons_menu; }; 00087 00088 void Reset(); 00089 void Draw(); 00090 00091 void DrawCharacterInfo(); 00092 void DrawTeamEnergy() const; 00093 void DrawWeaponInfo() const; 00094 void DrawWindIndicator(const Point2i &wind_bar_pos, const bool draw_icon) const; 00095 void DrawWindInfo() const; 00096 void DrawClock(const Point2i &time_pos) const; 00097 void DrawTimeInfo() const; 00098 void DrawSmallInterface() const; 00099 00100 bool IsDisplayed () const { return display; }; 00101 void EnableDisplay(bool _display); 00102 void Show(); 00103 void Hide(); 00104 bool IsVisible() const; 00105 00106 int GetWidth() const; 00107 int GetHeight() const; 00108 int GetMenuHeight() const; 00109 Point2i GetSize() const; 00110 00111 void UpdateTimer(uint utimer); 00112 void UpdateWindIndicator(int wind_value); 00113 void EnableDisplayTimer (bool _display) {display_timer = _display;}; 00114 }; 00115 00116 void AbsoluteDraw(const Surface& s, Point2i pos); 00117 void HideGameInterface(); 00118 void ShowGameInterface(); 00119 00120 #endif