I am currently in a object oriented college course and the assignment is to make the old school asteroids game in openGL. I am using visual studio to do my writing and I seem to have run into a problem rather early on. To begin with I am simply trying to draw in 5 large asteroids (i have 3 separate classes for each size with a parent class of Rock)I have set up a vector by the name of rocks in my class definition
std::vector<Rock*> rocks;
Next in the constructor i called createRocks()
1 2 3 4 5
Game::Game(Point tl, Point br)
: topLeft(tl), bottomRight(br)
{
createRocks();
}
which led me to...
1 2 3 4 5 6 7
void Game::createRocks()
{
for (int i = 0; i < 5; i++)
{
rocks.push_back(new BigRock());
}
}
now all this compiles fine but when I add in my draw function the screen that until now just displays black screen for the GL environment now displays white and becomes stuck in a loading loop.
1 2 3 4 5 6 7 8 9 10 11 12
void Game::draw(const Interface & ui)
{
vector<Rock*>::iterator it = rocks.begin();
while (it != rocks.end())
{
Rock* pRock = *it;
if (pRock->isAlive() != false)
{
pRock->draw();
}
}
}
I am unsure what is wrong with this section of code but when this is commented in it breaks it.
now i apologize in advance if i dont have enough information provided this is my first time posting here.