void display(sf::RenderWindow *window) { if (frames==0) sfclock.restart(); // Draw using SFML window->pushGLStates(); window->resetGLStates(); //insert SFML drawing code here (any part you are using that does not involve opengl code) window->popGLStates(); //set up the background color of the window. This does NOT clear the window. Right now it is (0,0,0) which is black glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); //this command actually clears the window. glEnable(GL_DEPTH_TEST); v.draw(raytrace); //simply delegate to our view class that has all the data and does all the rendering if (frames>500) { sf::Time t = sfclock.getElapsedTime(); frame_rate = frames/t.asSeconds(); frames = 0; } else { frames++; } stringstream str; // Finally, display the rendered frame on screen window->display(); // cout << "Rendering" << endl; }
//Prints the time and calls the plot and draw function of the view class to print the gameboard void Model::display(View& view) { std::cout << "Time: " << time << std::endl; view.clear(); for (std::list<GameObject*>::iterator act = active_ptrs.begin(); act != active_ptrs.end(); ++act) view.plot(*act); view.draw(); }
void display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); //feed the change in angle to the draw method v.draw(deltaXAngle, deltaYAngle); glutSwapBuffers(); }
void Entity::draw( void *drawState ) { if (visible) { View* view = type->getCore()->getViewSafe( type->getView() ); if (view != nullptr && has(view->required)) { view->draw( *this, drawState ); } } }
void Model::display(View& view) { cout << "Time: " << time << endl; view.clear(); for (int i = 0; i < num_objects; i++) { view.plot(object_ptrs[i]); } view.draw(); }
void Model::display(View &view) { cout << "Time: " << timer << endl; view.clear(); for (int i = 0; i < num_objects; i++) { if (object_ptrs[i]->is_alive() == true) { view.plot(object_ptrs[i]); } } view.draw(); }
void Turret::draw (View& view) { float absolute_orientation = tank->get_orientation () + orientation; #ifdef UGLY_SHADOWS_ENABLED view.draw(shadow, tank->get_pos () + FloatVector2d (10,10), absolute_orientation); view.draw(shadow, tank->get_pos () + FloatVector2d (15,15), absolute_orientation); view.draw(shadow, tank->get_pos () + FloatVector2d (20,20), absolute_orientation); view.draw(shadow, tank->get_pos () + FloatVector2d (25,25), absolute_orientation); #endif sur.set_angle((absolute_orientation + Math::pi) / Math::pi * 180.0f); view.get_sc().color().draw(sur, tank->get_pos().x, tank->get_pos().y); if (fireing && reloading == 0 && tank->ammo > 0.0) { fire_sur.set_angle(Math::rad2deg(absolute_orientation + Math::pi)); view.get_sc().color().draw(fire_sur, tank->get_pos().x, tank->get_pos().y); fireing = false; reloading = reloading_speed; } }
/** * Re-draw each View onto the back buffer, then present it. */ void Display::draw() const { // Clear the back frame to black SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF); SDL_RenderClear(renderer); // Redraw each View for (auto viewName : viewNameStack) { View* view = getViewByName(viewName); if (view->isVisible()) { view->draw(renderer); } } // Present the back frame SDL_RenderPresent(renderer); }
int main() { Model* m = new Model(); View* v = new CSLView(); //View* v = new SFMLView(); v->setModel(m); while(v->run()) { v->update(); v->draw(); } delete v; delete m; return EXIT_SUCCESS; }
void ScreenController::draw(View &view){ // Clean the Window this->fSI->window->clear(); view.draw(); this->fSI->window->display(); }