SHARE
TWEET

Untitled

a guest May 19th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ifndef CGRAPHICS_H
  2. #define CGRAPHICS_H
  3.  
  4. #define PI           3.14159
  5. #define TWO_PI       PI*2.0
  6. #define HALF_PI      PI/2.0
  7. #include <wiisprite.h>
  8. #include "MasterHeader.h"
  9. #include "cTower.h"
  10.  
  11. class CTargaImage;
  12.  
  13. class cGraphics
  14. {
  15. private:
  16.     int m_windowWidth;
  17.     int m_windowHeight;
  18.  
  19.     int npcX, npcY;
  20.     bool isAnimated;
  21.    
  22.     float mRotation; //to be passed to sprite rotate function
  23.    
  24.     static cGraphics* pGraphics;
  25.    
  26.     //images for the different creeps
  27.     Image mSnailImage[2];
  28.     Image mAphidImage[2];
  29.     Image mWhiteFlyImage[2];
  30.     Image mCrabGrassImage[2];
  31.     Image mDandelionImage[2];
  32.     Image mNutGrassImage[2];
  33.  
  34.     //images for the greenhouse and towers and healthbar
  35.     Image mInsecticide;
  36.     Image mBugBomb;
  37.     Image mRoachMotel;
  38.     Image mWeedSpray;
  39.    
  40.     Image mTowerImage;
  41.     Image mTowerArrayImage;
  42.     Image mGreenHouse;
  43.     Image mHealthBar;
  44.     Image mBackground;
  45.     Image mCursor;
  46.    
  47.     //array of sprites for the creeps
  48.     Sprite mSprites[6];
  49.     Sprite mBackgroundEX;
  50.     Sprite mHealthBarEX;
  51.     Sprite mGreenHouseEX;
  52.     Sprite mCursorSprite;
  53.    
  54.     //Sprites to draw the tower when in build mode
  55.     Sprite mCInsecticide, mCBugBomb, mCRoachMotel, mCWeedSpray;
  56.    
  57.     // Define array containing current, hardcoded max number of towers
  58.     Sprite mTowerSprites[12][16];
  59.    
  60.     Sprite mTowerImageEX;
  61.    
  62.     void SetRotation(npcDirection direction);
  63. public:
  64.     cGraphics();
  65.     virtual ~cGraphics();
  66.     static cGraphics* GetInstance();
  67.     bool Shutdown();
  68.  
  69.     void Prepare(float dt);
  70.     void Render();
  71.     void UpdateNPC(int image, int posX, int posY);
  72.    
  73.    
  74.     //functions to draw the npc's, must accept an npc index and
  75.     //img index for the animation
  76.     void DrawSnail(npcDirection direction, int npcIndex, int imgIndex, int posX, int posY);
  77.     void DrawAphid(npcDirection direction, int npcIndex, int imgIndex, int posX, int posY);
  78.     void DrawDandilion(npcDirection direction, int npcIndex, int imgIndex, int posX, int posY);
  79.     void DrawCrab(npcDirection direction, int npcIndex, int imgIndex, int posX, int posY);
  80.     void DrawWhiteFly(npcDirection direction, int npcIndex, int imgIndex, int posX, int posY);
  81.     void DrawNutGrass(npcDirection direction, int npcIndex, int imgIndex, int posX, int posY);
  82.    
  83.     //functions to draw the towers, must accept the x and y index
  84.     void DrawInsecticide(int imgIndex, int xIndex, int yIndex);
  85.     void DrawBugBomb(int imgIndex, int xIndex, int yIndex);
  86.     void DrawRoachMotel(int imgIndex, int xIndex, int yIndex);
  87.     void DrawWeedSpray(int imgIndex, int xIndex, int yIndex);
  88.    
  89.     void DrawInsecticide(int xPos, int yPos);
  90.     void DrawBugBomb(int xPos, int yPos);
  91.     void DrawRoachMotel(int xPos, int yPos);
  92.     void DrawWeedSpray(int xPos, int yPos);
  93.    
  94.     void DrawCursor(int posX, int posY);
  95.    
  96.     // This one is for the cursor
  97.     void DrawTower(TowerType type, int posX, int posY);
  98.    
  99.     // This one is for the play field/grid
  100.     void DrawTower(TowerType tupe, int imgIndex, int xIndex, int yIndex);
  101.     void DrawGreenHouse(int image, int posX, int posY);
  102.     void DrawHealthBar(int image, int posX, int posY);
  103.  
  104.     //Layer Manager
  105.     LayerManager * mLayerManager;
  106.  
  107.    
  108. };
  109.  
  110. #endif
RAW Paste Data
Want to get better at C++?
Learn to code C++ in 2017
Top