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 * Energy (progress) bar of a team 00020 *****************************************************************************/ 00021 00022 #ifndef TEAM_ENERGY_H 00023 #define TEAM_ENERGY_H 00024 00025 #include "../graphic/text.h" 00026 #include "../graphic/sprite.h" 00027 #include "../gui/EnergyBar.h" 00028 #include "../object/physical_obj.h" 00029 00030 class Team; 00031 00032 typedef enum { 00033 // Energy bar are waiting for a new change 00034 EnergyStatusOK, 00035 00036 // Energy bar can change their values 00037 EnergyStatusValueChange, 00038 00039 // Energy bar can change there ranking 00040 EnergyStatusRankChange, 00041 00042 // Waiting for a change to be finished before moving 00043 EnergyStatusWait 00044 } energy_t; 00045 00046 class TeamEnergy 00047 { 00048 private : 00049 EnergyBar energy_bar; 00050 // displayed value 00051 uint value; 00052 // team value 00053 uint new_value; 00054 // initial energy 00055 uint max_value; 00056 00057 Team *team; 00058 Sprite *icon; 00059 Text * t_team_energy; 00060 00061 int dx; 00062 int dy; 00063 00064 uint rank; 00065 uint new_rank; 00066 00067 std::string team_name; 00068 00069 uint move_start_time; 00070 00071 public : 00072 uint rank_tmp; 00073 energy_t status; 00074 00075 TeamEnergy(Team * _team); 00076 ~TeamEnergy(); 00077 void Config(uint _current_energy, 00078 uint _max_energy); 00079 00080 void Refresh(); 00081 void Draw(const Point2i& pos); 00082 00083 void SetValue(uint nv_energie); 00084 00085 void SetRanking(uint classem); // no animation 00086 void NewRanking(uint nv_classem); 00087 // Move energy bar (change ranking) 00088 void Move(); 00089 bool IsMoving() const; 00090 // Move energy bar immediatly to there destination 00091 void FinalizeMove(); 00092 }; 00093 00094 #endif /* TEAM_ENERGY_H */