/********************************************* * CALLBACK * The main interaction loop of the engine. * This gets called from OpenGL. It give us our * interface pointer (where we get our events from) * as well as a void pointer which we know is our * game class. *********************************************/ void callBack(const Interface *pUI, void *p) { // we know the void pointer is our game class so // cast it into the game class. Gun *pGun = (Gun *)p; // check the paddle pGun->move(pUI->isUp(), pUI->isDown()); // draw it pGun->draw(); }
void GunFactory::createBlaster(){ sf::Vector2f location(0,0); Gun* gunPtr = new Gun(location, 12, this->fSI); this->fSI->model->guns->push_back(gunPtr); GunView* gunViewPtr = new GunView(this->fSI->window, this->fSI->assets, gunPtr); this->fSI->view->views->push_back(gunViewPtr); // Now let's center this Gun location.x = (this->fSI->model->game->getWidth() - gunPtr->getSize().getWidth())/2; location.y = this->fSI->model->game->getHeight() - gunPtr->getSize().getHeight(); gunPtr->move(location); }