• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

src/cannonball/header/Player.h

Go to the documentation of this file.
00001 #pragma once
00002 #include <render.h>
00003 #include <wchar.h>
00004 #include "Level.h"
00005 #include "SaveState.h"
00006 
00007 
00008 #define STANDARD_BALL 0
00009 #define FAST_BALL 1
00010 #define STRONG_BALL 2
00011 #define EXPLOSIVE_BALL 3
00012 #define BALL_TYPE_COUNT 4
00013 
00014 #define STARTING_BALLS_COUNT 5;
00015 
00016 
00018 class Player
00019 {
00020 public:
00022         Player(Gui* gui, Level* level, IAudio* audio, IRender* render, Camera& camera);
00023         ~Player(void);
00024 
00026         void loadCannonball(IPhysic* physic);
00027 
00029         void loadBallLabels();
00030         
00032         void setBallType(int ballType);
00033         
00035         void applyForce(float3 vec);
00036         
00038         float3 getCannonPosition();
00039         float3 getMovingCannonPosition(bool slowDown);
00040         
00042         void restart();
00043         
00045         bool checkWinCondition();
00046         
00048         void resetCannonLabels();
00049 
00051         void resetOtherCannonBalls();
00052 
00054         void saveGameState(int saveSlot, float3 cameraPosition);
00055 
00058         float3 loadGameState(int saveSlot, float3 cameraPosition);
00059 
00060         void saveGameStatesToFiles();
00061 
00063         void setWinLabel(pIControl winLabel) { m_winLabel = winLabel; }
00064         void setGameOver(pIControl gameOver) { m_gameOver = gameOver; }
00065         void setBallsLeftLabel(pIControl ballsLeft);
00066 
00068         void explosion();
00069         
00071         void playExplosionSound();
00072 
00074         bool isMoving();
00075         
00077         bool outOfBalls();
00078         
00080         bool selectedBallAvailable() { return m_ballCount[m_selectedBall] > 0; }
00081         
00083         int getSelectedBall() { return m_selectedBall; }
00084 
00086         void checkForLevelObjects();
00087 
00089         void loadNewLevel(int levelNumber);
00090 
00092         void resetSaveLabel() { m_saved->setVisible(false); m_loaded->setVisible(false); }
00093 
00095         int getCurrentLevel() { return m_currentLevel; }
00096 
00097 private:
00098         Camera& m_camera;
00099         //pIBody m_cannonballBody;
00100         pIBody m_cannonballBodies[4];
00101         //pIGeometry m_cannonballGeometry;
00102         pIGeometry m_cannonballGeometries[4];
00103         pInstance m_cannonballInstances[4];
00104         pIControl m_cannonballLabels[4];
00105         pIControl m_ballCountLabel;
00106         //pITexture m_cannonballTexture;
00107         pIControl m_winLabel;
00108         pIControl m_gameOver;
00109         pIControl m_ballsLeftLabel;
00110         pIControl m_saved;
00111         pIControl m_loaded;
00112         pBuffer m_cannonSoundBuffer;
00113         pSound m_cannonSound;
00114         pBuffer m_explosionBuffer;
00115         pSound m_explosionSound;
00116         Gui* m_gui;
00117         IRender* m_render;
00118         IAudio* m_audio;
00119         Level* m_level;
00120 
00121         int m_selectedBall;
00122         //int m_ballsLeft;
00123         int m_ballCount[BALL_TYPE_COUNT];
00124         bool m_alreadyShot;
00125 
00126         int m_currentLevel;
00127         wchar* m_levelNames[6];
00128         wchar* m_saveFilenames[9];
00129         
00130         float3 m_startPosition;
00131         float3 m_ballOffPosition;
00132 
00133         SaveState m_saveStates[9];
00134         //Levelnames m_levelNames;
00135 };

Generated on Fri Jun 18 2010 17:48:39 for Cannonball by  doxygen 1.7.0