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 * Interface showing various informations about the game. 00020 *****************************************************************************/ 00021 00022 #ifndef WEAPON_MENU_H 00023 #define WEAPON_MENU_H 00024 00025 #include "../graphic/sprite.h" 00026 #include "../include/base.h" 00027 #include "../character/character.h" 00028 #include "../team/team.h" 00029 #include "../weapon/weapon.h" 00030 #include <vector> 00031 00032 class WeaponMenuItem 00033 { 00034 public: 00035 Point2i position; 00036 double scale; 00037 Weapon* weapon; 00038 Sprite *weapon_icon; 00039 uint zoom_start_time; 00040 uint weapon_type; 00041 00042 private: 00043 bool zoom, dezoom; 00044 00045 public: 00046 WeaponMenuItem(uint num_sort); 00047 void Reset(); 00048 00049 void Draw(); 00050 void ChangeZoom(); 00051 00052 bool MouseOn(const Point2i &mousePos); 00053 00054 private: 00055 void ComputeScale(); 00056 }; 00057 00058 class WeaponsMenu 00059 { 00060 public: 00061 Sprite *my_button1; 00062 Sprite *my_button2; 00063 Sprite *my_button3; 00064 Sprite *my_button4; 00065 Sprite *my_button5; 00066 00067 private: 00068 std::vector<WeaponMenuItem> boutons; 00069 typedef std::vector<WeaponMenuItem>::iterator iterator; 00070 typedef std::vector<WeaponMenuItem>::const_iterator const_iterator; 00071 00072 bool display; 00073 bool show; // True during the motion to show the weapon menu. 00074 bool hide; // True during the motion to hide the weapon menu. 00075 00076 uint motion_start_time; 00077 00078 uint nbr_weapon_type; // number of weapon type = number of rows 00079 uint max_weapon; // max number of weapon in a weapon type = number of lines 00080 00081 public: 00082 WeaponsMenu(); 00083 00084 // Return true if mouse click on a button 00085 bool ActionClic(const Point2i &mousePos); 00086 00087 void Draw(); 00088 void Reset(); 00089 00090 int GetX() const; 00091 int GetY() const; 00092 Point2i GetPosition() const; 00093 int GetWidth() const; 00094 int GetHeight() const; 00095 Point2i GetSize() const; 00096 bool IsDisplayed() const; 00097 00098 void NewItem(Weapon* new_item, uint num_sort); 00099 void SwitchDisplay(); 00100 void Hide(); 00101 00102 void MouseOver(const Point2i &mousePos); 00103 00104 private: 00105 void ComputeSize(); 00106 void Show(); 00107 void ShowMotion(int nr_bottons, int button_no, iterator it, int column); 00108 bool HideMotion(int nr_buttons, int button_no, iterator it, int column); 00109 }; 00110 00111 #endif