Skip to content
Permalink
master
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
#include "Cube.h"
//We can either hard code the values in GameObject (like in Cube())
//or
//We can use the GameEngine constructors to fill the values ( like in Cube(x, y, z, size))
Cube::Cube()
{
position.x = 0.0f;
position.y = 0.0f;
position.z = 0.0f;
r = 1.0f;
g = 0.0f;
b = 1.0f;
size = 1.0f;
}
Cube::Cube(float _x, float _y, float _z, float _size)
:GameObject(_x, _y, _z) //note the use of GameObject constructor
{
size = _size;
}
Cube::Cube(float _x, float _y, float _z,
float _r, float _g, float _b,
float _size):
GameObject(_x, _y, _z, _r, _g, _b) //note the use of GameObject constructor
{
size = _size;
}
//Position and colour a cube in the scene
void Cube::Draw()
{
glPushMatrix();
glTranslatef(position.x, position.y, position.z);
glColor3f(r, g, b);
glutSolidCube(size);
//glutWireCube(size) - if you'd rather see through it
glPopMatrix();
}
void Cube::Update(float deltaTime)
{
//Cubes are static at the moment so nothing changes for them
}