Beispiel #1
0
pair<double, double> EfeitoVisual::positionScreen(char * type)
{
    pair<double, double> val;
    if (type == "center") {
        val.first = ((GetSystemMetrics(SM_CXSCREEN) - sizeScreen().first) / 2);
        val.second = ((GetSystemMetrics(SM_CYSCREEN) - sizeScreen().second) / 3);
    }
    return val;
}
bool SDLRenderer::blitBackBufferToScreen() {
  IntegerSize sizeBackBuffer(m_pBackBufferSurface->sizePixels());
  SDL_Rect rectBackBuffer(convertSizeToRect(sizeBackBuffer));
  IntegerSize sizeScreen(m_pScreenSurface->sizePixels());
  SDL_Rect rectScreen(convertSizeToRect(sizeScreen));
  int result = SDL_BlitSurface(
      m_pBackBufferSurface->rawSurfacePtr(),
      &rectBackBuffer,
      m_pScreenSurface->rawSurfacePtr(),
      &rectScreen);
  bool didRender = (result == 0);
  if (!didRender) {
    return false;
  }
  SDL_UpdateRect(
      m_pScreenSurface->rawSurfacePtr(),
      rectScreen.x,
      rectScreen.y,
      rectScreen.w,
      rectScreen.h);
#ifdef DEBUG
  std::cout << "SDLRenderer::blitBackBufferToScreen result " << result << " ";
  std::cout << (didRender ? "" : "not ") << "did render" << std::endl;
  std::cout << "sizeBackBuffer " << sizeBackBuffer << std::endl;
  std::cout << "sizeScreen " << sizeScreen << std::endl;
#endif
  return didRender;
}