1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
#ifndef _CLASSES_H_
#define _CLASSES_H_
#include "AIE.h"
#include "math.h"
//class Vectors;
//class Sprite;
const int iScreenWidth = 1280;
const int iScreenHeight = 780;
//vectors class
class Vectors{
public:
Vectors();
~Vectors();
protected:
//Struct for the vector points
struct Point2D{
float x;
float y;
};
//Struct for the clickable objects in the menu
struct ClickableObject{
Point2D position;
int sprite;
int width;
int height;
};
//stuct for all the moving objects in the game
struct MovableObject{
Point2D position;
Point2D speed;
int sprite;
int width;
int height;
};
public:
Point2D pointSubtract(Point2D &v, float s);
Point2D pointAdd(Point2D &v, float s);
Point2D multiplyScalar(Point2D &v, float s);
Point2D pointSubtract(Point2D &v, Point2D &v2);
Point2D pointAdd(Point2D &v, Point2D &v2);
Point2D getNormal(Point2D &v);
float getMagnitude(Point2D &v);
};
//Class for building Sprites
//class Sprite{
//public:
// Sprite();
// ~Sprite();
//
//
//
// friend class Vectors;
//
//};
//Class with everything for the game inside
class Game: public Vectors{
public:
Game();
~Game();
//size of the mouse sprite
int mouseW;
int mouseH;
//Struct for the game setup
struct GameMenu{
bool playGame;
bool gamePause;
bool gameOver;
bool escape;
};
//size of the bullet sprites
int bullets;
int bulletsH;
int bulletsW;
//player sprite size and if they died or not
int playerOne;
int playerOneW;
int playerOneH;
int playerOneScore;
bool playerOneDied;
//enemy sprite size and if they died or not
int enemyH;
int enemyW;
bool enemyDied;
//size of menu items
int playGameButtonW;
int playGameButtonH;
int exitGameButtonW;
int exitGameButtonH;
//speed of variables
float speed;
//framecounter and hits
int frameCounter;
int hits;
void setgame();
unsigned int bgImage;
//prototyping the gamesetup
bool testOnScreen(MovableObject &obj);
void updateBulletCollision (MovableObject &obj);
bool checkBulletCollision (MovableObject &bullets, MovableObject &playerOne);
bool checkCollision(MovableObject &obj1, MovableObject &obj2);
void initMenu(ClickableObject &playGameButton, ClickableObject &exitGameButton, MovableObject &mouse);
void drawMenu(ClickableObject &playGameButton, ClickableObject &exitGameButton);
void updateMenu(unsigned int bgImage, MovableObject &mouse, MovableObject &enemy, ClickableObject &exitGameButton, ClickableObject &playGameButton, MovableObject &bullets, MovableObject &playerOne);
void initGame(MovableObject &bullets, MovableObject &playerOne, MovableObject &enemy);
void destroyGame(MovableObject &bullets, MovableObject &playerOne, MovableObject &enemy);
void gameScore();
void move(MovableObject &playerOne);
void updateGame(MovableObject &playerOne);
void drawGame(MovableObject &bullets, MovableObject &playerOne, MovableObject &enemy);
//friend class Vectors;
};
#endif
|