示例#1
0
void GCNPlatform::pushBlocker(RLMachine& machine) {
  if (blocker_ == NULL) {
    // Block the world!
    SDLEventSystem& event = dynamic_cast<SDLEventSystem&>(
        machine.system().event());
    GraphicsSystem& graphics = machine.system().graphics();
    machine.pushLongOperation(new GCNPlatformBlocker(event, graphics,
                                                     shared_from_this()));
  }
}
LoadGameLongOperation::LoadGameLongOperation(RLMachine& machine) {
  // Render the current state of the screen
  GraphicsSystem& graphics = machine.system().graphics();

  boost::shared_ptr<Surface> currentWindow = graphics.renderToSurface();
  Size s = currentWindow->size();

  // Blank dc0 (because we won't be using it anyway) for the image
  // we're going to render to
  boost::shared_ptr<Surface> dc0 = graphics.getDC(0);
  dc0->fill(RGBAColour::Black());

  machine.pushLongOperation(this);
  machine.pushLongOperation(
      new FadeEffect(machine, dc0, currentWindow, s, 250));

  // We have our before and after images to use as a transition now. Reset the
  // system to prevent a brief flash of the previous contents of the screen for
  // whatever number of user preceivable milliseconds.
  machine.system().reset();
}
bool LoadGameLongOperation::operator()(RLMachine& machine) {
  load(machine);
  // Warning: the stack has now been nuked and |this| is an invalid.

  // Render the current state of the screen
  GraphicsSystem& graphics = machine.system().graphics();

  boost::shared_ptr<Surface> currentWindow = graphics.renderToSurface();
  Size s = currentWindow->size();

  // Blank dc0 (because we won't be using it anyway) for the image
  // we're going to render to
  boost::shared_ptr<Surface> blankScreen = graphics.buildSurface(s);
  blankScreen->fill(RGBAColour::Black());

  machine.pushLongOperation(
      new FadeEffect(machine, currentWindow, blankScreen, s, 250));

  // At this point, the stack has been nuked, and this current
  // object has already been deleted, leaving an invalid
  // *this. Returning false is the correct thing to do since
  // *returning true will pop an unrelated stack frame.
  return false;
}