00001 #ifndef GAME_H_INCLUDED
00002 #define GAME_H_INCLUDED
00003
00004
00005 #include <vector>
00006 #include <sstream>
00007 #include <stdexcept>
00008
00009 #include "Horde3D.h"
00010 #include "Airplane.h"
00011 #include "IShootable.h"
00012
00013
00014 class World;
00015 class Player;
00016 class Enemy;
00017 class Physics;
00018 class IShootable;
00019
00020
00022
00031 class Game {
00032 private:
00033 World* _world;
00034 Player* _player;
00035 Physics* _physics;
00036 Airplane* _airplane;
00037 std::vector<Enemy*> _enemies;
00038 int _numberOfEnemies, _bodyCount, _statMode;
00039 bool _debugViewMode, _wireframeMode, _isSplashScreenDeactivated;
00040 float _runtime, _windowWidth, _windowHeight;
00041
00042
00043 H3DRes _fontMatRes, _panelMatRes, _crossHairMatRes, _weaponMatRes, _waterplaneTexRes;
00044 H3DRes _pipeRes, _hdrPipeRes, _forwardPipeRes, _reflectionPipeRes;
00045 H3DNode _splashCam, _cam, _reflectionCam, _weapon;
00046 public:
00047 Game();
00048 ~Game();
00049
00050 void update(const float timeStep, const float fps);
00051 bool init();
00052 void resize(int width, int height);
00053 void release();
00054 void recycleEnemy(Enemy* oldEnemy);
00055 std::vector<Enemy*> getEnemies() const;
00056 Airplane* getAirplane() const;
00057 H3DRes getReflectionTexture() const;
00058 bool hasPlayerAtLevelBounds(const Vec3 playerPosition) const;
00059 void keyStateChange(int key, bool state);
00060 void mouseMoveEvent(float dX, float dY);
00061 void mouseButtonEvent(int button, bool action);
00062
00063 static void advanceEmitter(H3DNode emitter, const float timeStep);
00064 static H3DNode addLight(H3DNode parent, const char* name,
00065 const float px, const float py, const float pz,
00066 const float rx, const float ry, const float rz,
00067 const int length, const int fov, const int shadowCount,
00068 const float r, const float g, const float b);
00069 private:
00070 void displayHUD() const;
00071 void displayStats(const float timeStep, const float fps) const;
00072 bool createMoreEnemies() const;
00073 };
00074
00075
00079 struct Values {
00083 static const char* CONTENT_DIR;
00087 static const float WALKING_SPEED_KM_H;
00091 static const float AIRPLANE_SPEED_KM_H;
00095 static const float BULLET_SPEED_M_S;
00099 static const float SHOOTING_DISTANCE;
00103 static const int MAX_HEALTH;
00107 static const int WORLD_SCALE;
00111 static const int MAX_BODY_COUNT;
00115 static const int NUMBER_OF_ENEMIES;
00119 static const float CHAINGUN_RECOIL;
00123 static const float BOLTER_RECOIL;
00124 };
00125
00126 #endif