Ejemplo n.º 1
0
//!-----------------------------------------------------------------------------
//! MAIN
//!-----------------------------------------------------------------------------
int main(int argc, char** argv, char** envp)
{
  // open window
  sf::RenderWindow window(sf::VideoMode(WINDOW_W, WINDOW_H), WINDOW_TITLE);
  window.setFramerateLimit(MAX_FPS);

  // create game objects
  n1.neighbours[0] = &n2;
  n1.neighbours[1] = &n3;
  n2.neighbours[2] = &n3;

  // main loop
  while (window.isOpen())
  {
    // deal with events
    if(treatEvents(window) == STOP)
      window.close();

    // update the game
    if(update(getDelta()) == STOP)
      window.close();

    // redraw the game
    renderTo(window);
    window.display();
  }

  // quit
  return EXIT_SUCCESS;
}
Ejemplo n.º 2
0
/*!
   \brief Render the plot to a paint device ( f.e a QPrinter )

   A convenience method, that calculates the target rectangle
   from the paintdevice metrics.

   \sa renderTo(QPainter *, const QRect &)
*/
void QwtPolarPlot::renderTo( QPaintDevice &paintDev ) const
{
#if QT_VERSION < 0x040000
  QPaintDeviceMetrics mpr( &paintDev );
  int w = mpr.width();
  int h = mpr.height();
#else
  int w = paintDev.width();
  int h = paintDev.height();
#endif

  const QRect rect( 0, 0, w, h );

  QPainter p( &paintDev );
  renderTo( &p, rect );

}