Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
217CR-Deferral-Assignment-Basic-Project/GameObject.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
31 lines (25 sloc)
1.11 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <GL/glew.h> | |
#include <GL/freeglut.h> | |
#include <map> | |
//A basic abstract class that all game objects in the scene are based off | |
// abstract = We never will make a direct instance of GameObject but will make classes inherit from it | |
class GameObject | |
{ | |
public: | |
// -- variables -- | |
float x, y, z; //position | |
float r, g, b; //colour | |
static std::map<char, bool> keys; //save key presses and let game objects access them | |
static std::map<int, bool> specialKeys; //static = one instance of these variables for the whole class (top of .cpp) | |
// -- constructors/destructors -- | |
GameObject(); //default constructor - aka no values passed in (position at 0,0,0 - colour magenta) | |
GameObject(float _x, float _y, float _z); //pass in a position (no colour passed in so defaults to white) | |
GameObject(float _x, float _y, float _z, | |
float _r, float _g, float _b); //pass in a position, colour | |
~GameObject(); //default destructor | |
// -- functions -- | |
//pure virtual so all classes that derive from this one need to include a definion for these | |
virtual void Draw() = 0; | |
virtual void Update(float deltaTime) = 0; | |
}; |