示例#1
0
void LifeWidget::paintEvent(QPaintEvent *event)
{
	QPainter painter;
    painter.begin(this);
	
	paintGL();

	painter.setRenderHint(QPainter::Antialiasing);

	updateHud();
	gameHud->draw(&painter);

	painter.end();
}
示例#2
0
void Scene::paintScene()
{
  if (!is_startCB_launched) {
    is_startCB_launched = true;
    UAppli::addTimeout(500, 1, ucall(this, &Scene::initScene));
  }
  if (!is_visible || !is_initialized) return;

  // at least one postponed Key Release event
  if (gw.pendingPostponedKRs()) gw.flushPostponedKRs();

  // Performs world calculation
  ProfileTime& tsimul = ::g.times.simul;
  tsimul.start();
  if (World::current())
    World::current()->compute(tsimul.start_time.tv_sec, tsimul.start_time.tv_usec);
  tsimul.stop();
  trace(DBG_WO, "world computed");
  
  // General rendering
  ProfileTime& trender = ::g.times.render;
  trender.start();
  ::g.render.render();
  trender.stop();

  // Displays misc infos
  if (Hud::hud()->isVisible()) {
    updateHud();
    hudbox.show(true);
  }
  else hudbox.show(false);

  // check if video capture is running
  if (gw.capture.isCapturingVideo()) gw.capture.writeVideoFrame();
  cycles++;		// increments cycles
}