Example #1
0
void CStatusScreenGalaxy::scaleToResolution()
{
    SDL_Rect gameres = gVideoDriver.getGameResolution().SDLRect();
    int scaleFac = gameres.h/200;
    GsWeakSurface weakBlit(gVideoDriver.getBlitSurface());

    if(scaleFac < 0) scaleFac = 1;

    auto biggerRect = mStatusSurface.getSDLSurface()->clip_rect;
    biggerRect.w *= scaleFac;
    biggerRect.h *= scaleFac;

    mStatusSfcTransformed.createRGBSurface(biggerRect);

    // NOTE: Colorkey confusion in legacy version. This fixes the problem
#if SDL_VERSION_ATLEAST(2, 0, 0)
#else
    if(scaleFac == 1)
    {
        mStatusSfcTransformed.applyDisplayFormat();
        mStatusSfcTransformed.fillRGB(0x0, 0xFE, 0xFF);
        mStatusSfcTransformed.setColorKey(0x0, 0xFE, 0xFF);
    }
#endif

    mStatusSurface.blitScaledTo(mStatusSfcTransformed);

    // Modern makes the hud a small bit semi transparent
    const auto &optModern = gBehaviorEngine.mOptions[GameOption::MODERN];
    if (optModern.value)
    {
        mStatusSfcTransformed.setAlpha(244);
    }
}
Example #2
0
void CCredits::render()
{
    GsFont &creditFont = gGraphics.getFont(0);
    mpMap->animateAllTiles();
    gVideoDriver.blitScrollSurface();

    mDrawSfc.fillRGB(0, 0, 0);

    for(int j=0 ; j<54 ; j++)
    {
        if(m_scrolly+(j<<3) > -8 && m_scrolly+(j<<3) < gVideoDriver.getGameResolution().h)
        {
            creditFont.drawFont( mDrawSfc, m_scrolltext[j], m_mid[j], m_scrolly+(j<<3), true);
        }
    }

    GsWeakSurface weakBlit(gVideoDriver.getBlitSurface());
    mDrawSfc.blitScaledTo(weakBlit);
}