Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

HUD.h

Go to the documentation of this file.
00001 /*
00002 CS Senior Project 2003
00003 Team : Leftfield
00004 Project : ModernWarfare
00005 Members :
00006 - Russ Christensen              <rchriste@cs.utah.edu>
00007 - Todd Smith                    <tcsmith@cs.utah.edu>
00008 - Usit Duongsaa                 <duongsaa@cs.utah.edu>
00009 Copyright 2003 Russ Christensen, Usit Duongsaa, and Todd Smith. All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00012 
00013 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
00014 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
00015 THIS SOFTWARE IS PROVIDED BY RUSS CHRISTENSEN, USIT DUONGSAA, AND TODD SMITH ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RUSS, USIT, TODD OR OTHER CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00016 */
00017 
00022 #pragma once
00023 
00024 #include "..\AEngine\AEngine.h"
00025 #include "Singleton.h"
00026 #include "City.h"
00027 #include "Icon.h"
00028 #include "Map.h"
00029 #include "BattleEntry.h"
00030 
00031 class HUD : public Singleton<HUD>
00032 {
00033 public:
00034   static const int BUILD_LT_ICON = 0;
00035   static const int BUILD_HT_ICON = 1;
00036   static const int BUILD_RL_ICON = 2;
00037   static const int BUILD_AR_ICON = 3;
00038   static const int BUILD_JT_ICON = 4;
00039   static const int ICON_COUNT = 5;
00040 
00042   static const int BLINK_RATE = 18;
00043 
00045   static const int BG_RENDER_PRIORITY = 5;
00046   static const int ICON_RENDER_PRIORITY = 6;
00047   static const int POPUP_HELP                   = 7;
00048 
00050   static const Vec3D COLOR_INACTIVE_BATTLE;
00051   static const Vec3D COLOR_CITY_OUTLINE;
00052 
00054   static void init(istream& in);
00056   static void setPlayer(Player* player);
00058   static void setSelectedCity(City* city);
00060   static void setSelectedUnit(MilitaryUnit* unit);
00062   static void setSelectedGroupType(int groupType);
00063   static void clearSelections();
00065   static void setWorldMap(Map::WorldMap& map);
00067   static bool processOverheadInput();
00069   static void update();
00071   static void render();
00073   static void shutdown();
00074 
00075   static bool isButtonStopClicked();
00076   static bool isButtonCallRFMUnitTypeClicked( int unitType );
00077 
00078 private:
00079   Player* m_pPlayer;
00080   City* m_pSelectedCity;
00081   MilitaryUnit* m_pSelectedUnit;
00082   int m_selectedGroupType;
00083   // positions for each element of the HUD
00084   float m_startX;
00085   float m_startY;
00086   float m_endX;
00087   float m_endY;
00088   // minimap 
00089   float m_mapBorderX1;
00090   float m_mapBorderY1;
00091   float m_mapBorderX2;
00092   float m_mapBorderY2;
00093   // where to draw the map. coords are [0]: upper left, [1]: lower right
00094   Vec2D m_mapDims[2];
00095   float m_mapCityOutlineSize;
00096   float m_mapCitySize;
00097   float m_mapUnitSize;
00098   // info box
00099   float m_infoBorderX1;
00100   float m_infoBorderY1;
00101   float m_infoBorderX2;
00102   float m_infoBorderY2;
00103   // where center of unit portrait is
00104   Vec2D m_infoPortraitCenter;
00105   Vec2D m_infoPortraitSize;
00106   // build queue
00107   Vec2D m_buildQIconSize;
00108   Vec2D m_buildQIconCoords[9];
00109   Vec2D m_buildQTimerCoords;
00110   float m_buildQTimerTextSize;
00111   Vec3D m_buildQTimerTextColor;
00112   
00113 
00114   // money box
00115   float m_moneyBorderX1;
00116   float m_moneyBorderY1;
00117   float m_moneyBorderX2;
00118   float m_moneyBorderY2;
00119   // where to draw amount of $$
00120   float m_moneyTextX;
00121   float m_moneyTextY;
00122   float m_moneyTextSize;
00123   Vec3D m_moneyTextColor;
00124  
00125   // actions box
00126   Vec2D m_actionsBorderStart;
00127   Vec2D m_actionsBorderEnd;
00128 
00129   // map box
00130   Vec2D m_mapBorderStart;
00131   Vec2D m_mapBorderEnd;
00132 
00133   // info box
00134   Vec2D m_infoBorderStart;
00135   Vec2D m_infoBorderEnd;
00136 
00137   // build menu
00138   float m_iconTextXOffset;
00139   float m_iconTextYOffset;
00140   float m_iconTextSize;
00141   Vec3D m_iconTextColor;
00142 
00143   // econ info/button
00144   float m_econInfoTextX;
00145   float m_econInfoTextY;
00146 
00147   Icon m_iconUpgradeEcon;
00148   Icon m_iconBuildLT;
00149   Icon m_iconBuildHT;
00150   Icon m_iconBuildRL;
00151   Icon m_iconBuildAR;
00152   Icon m_iconBuildJT;
00153   vector<Icon*> m_buildIcons;
00154   // switch to overhead icon
00155   Icon m_iconOverhead;
00156 
00157   Icon m_iconCallRFM;           // call reinforcement icon
00158   Vec2D m_panelCallRFMCoord;
00159   Vec2D m_panelCallRFMSize;
00160   bool m_showCallRFMPanel;
00161   vector<Icon> m_iconCallUnitType;
00162   Vec2D cammRFMTextPos;
00163 
00164   Icon m_iconJetGuard;
00165   Icon m_iconJetBomb;
00166   Icon m_iconStop;  
00167 
00168   Map::WorldMap m_map;
00169   Rect m_miniMapBounds;
00170   // scale factor = miniMapSize/actualMapSize
00171   Vec2D m_miniMapScale;
00172 
00173   ATexture m_portraits[UnitTypes::COUNT];
00174   
00175   bool m_blinkOn;
00176   int m_blinkCount;
00177 
00178   // gets the index of the next/previous battle the player is involved in
00179   void switchToNextBattle();
00180   void switchToPrevBattle();
00181   // switch to overhead mode
00182   void switchToOverhead();
00183 
00184   void renderMiniMap();
00185   bool processMiniMapInput(const Vec2D& mouse);
00186   Vec2D translateMiniMapToWorld(const Vec2D& mmPos);
00187   Vec3D translateMiniMapToWorld3D(const Vec2D& mmPos);
00188   Vec2D translateWorldToMiniMap(const Vec2D& wPos);
00189   Vec2D translateWorldToMiniMap(const Vec3D& wPos);
00190 
00191 
00192 };
00193 
00194 inline void HUD::setPlayer(Player* player) { HUD::getObj().m_pPlayer = player; }
00195 inline void HUD::setSelectedCity(City* city)
00196 {
00197         HUD::getObj().m_pSelectedCity = city;
00198         if(city!=NULL)  HUD::getObj().m_showCallRFMPanel=false;
00199 }
00200 inline void HUD::setSelectedUnit(MilitaryUnit* unit)
00201 {
00202         HUD::getObj().m_pSelectedUnit = unit;
00203         if(unit!=NULL)  HUD::getObj().m_showCallRFMPanel=false;
00204 }
00205 inline void HUD::setSelectedGroupType(int groupType)
00206 {
00207         HUD::getObj().m_selectedGroupType = groupType;
00208         if(groupType!=-1) HUD::getObj().m_showCallRFMPanel=false;
00209 }

Generated on Wed Apr 23 05:50:15 2003 for Modern Warfare by doxygen1.3-rc2