コード例 #1
0
ファイル: display_manager.cpp プロジェクト: danzat/scummvm
// return true if we really rendered or no dirty. False otherwise
bool DisplayManager::renderAll() {
	DEBUG_ENTER_FUNC();

#ifdef USE_DISPLAY_CALLBACK
	if (!_masterGuRenderer.isRenderFinished()) {
		PSP_DEBUG_PRINT("Callback render not finished.\n");
		return false;	// didn't render
	}
#endif /* USE_DISPLAY_CALLBACK */

	// This is cheaper than checking time, so we do it first
	// Any one of these being dirty causes everything to draw
	if (!_screen->isDirty() &&
		!_overlay->isDirty() &&
		!_cursor->isDirty() &&
		!_keyboard->isDirty() &&
		!_imageViewer->isDirty()) {
		PSP_DEBUG_PRINT("Nothing dirty\n");
		return true;	// nothing to render
	}

	if (!isTimeToUpdate())
		return false;	// didn't render

	PSP_DEBUG_PRINT("dirty: screen[%s], overlay[%s], cursor[%s], keyboard[%s], imageViewer[%s]\n",
	                _screen->isDirty() ? "true" : "false",
	                _overlay->isDirty() ? "true" : "false",
	                _cursor->isDirty() ? "true" : "false",
	                _keyboard->isDirty() ? "true" : "false",
					_imageViewer->isDirty() ? "true" : "false",
	               );

	_masterGuRenderer.guPreRender();	// Set up rendering

	_screen->render();
	_screen->setClean();				// clean out dirty bit

	if (_imageViewer->isVisible())
		_imageViewer->render();
	_imageViewer->setClean();

	if (_overlay->isVisible())
		_overlay->render();
	_overlay->setClean();

	if (_cursor->isVisible())
		_cursor->render();
	_cursor->setClean();

	if (_keyboard->isVisible())
		_keyboard->render();
	_keyboard->setClean();

	_masterGuRenderer.guPostRender();

	return true;	// rendered successfully
}
コード例 #2
0
void ml_update(float wx, float wy)
{
  if (!g_bIsInitialized)
    return;

  wx = wx + 1.5f; // map world to logical coordinates

  int mx = WORLD_TO_MAP(wx), my = WORLD_TO_MAP(wy);

  if (!isTimeToUpdate(mx, my))
    return;

  float theta = g_map[my][mx].orientation;
  Index2D idx = ori2dir[(int)(theta + 180.0f) % 360];

  while (mx % 3 != 0)
    mx = mp(mx + idx.x) % MAP_DIM;

  while (my % 3 != 0)
    my = mp(my + idx.y) % MAP_DIM;

  removeLevels(mx, my);
  addOneLevel();
}