コード例 #1
0
void CGUIDialog::initVorticonBackground()
{
    const SDL_Rect Rect = g_pVideoDriver->toBlitRect(mRect);
    mpBackgroundSfc.reset( CG_CreateRGBSurface( Rect ), &SDL_FreeSurface );
//#if SDL_VERSION_ATLEAST(2, 0, 0)
    //mpBackgroundSfc = mpBackgroundSfc;
//#else
    mpBackgroundSfc.reset( g_pVideoDriver->convertThroughBlitSfc( mpBackgroundSfc.get() ), &SDL_FreeSurface );
//#endif

	// Now lets draw the text of the list control
	CFont &Font = g_pGfxEngine->getFont(1);

	SDL_Surface *backSfc = mpBackgroundSfc.get();


	// Draw the character so the classical vorticon menu is drawn

	// Start with the blank space (normally it's white. Might be different in some mods)
	for( int x=8 ; x<Rect.w-8 ; x+=8 )
	{
		for( int y=8 ; y<Rect.h-8 ; y+=8 )
		{
			Font.drawCharacter( backSfc, 32, x, y );
		}
	}            

	// Now draw the borders
    drawBorderRect(backSfc, Rect);

    mpTempSfc.reset( g_pVideoDriver->convertThroughBlitSfc( backSfc ), &SDL_FreeSurface );
}
コード例 #2
0
void CMessageBoxVort::initVorticonBackground()
{
    GsRect<float> rect = getRect();

    const SDL_Rect sdlRect = gVideoDriver.toBlitRect(rect);
    mBackgroundSfc.create(0, sdlRect.w, sdlRect.h, RES_BPP, 0, 0, 0, 0);

    // Now lets draw the text of the list control
    GsFont &Font = gGraphics.getFont(1);

    // Now draw the borders
    SDL_Surface *backSfc = mBackgroundSfc.getSDLSurface();
    drawBorderRect(backSfc, sdlRect);

    // Draw the character so the classical vorticon menu is drawn

    // Start with the blank space (normally it's white. Might be different in some mods)
    for( int x=8 ; x<sdlRect.w-8 ; x+=8 )
    {
        for( int y=8 ; y<sdlRect.h-8 ; y+=8 )
        {
            Font.drawCharacter( backSfc, 32, x, y );
        }
    }

    processRendering(mBackgroundSfc.getSDLSurface());
}
コード例 #3
0
void CGUIDialog::processRendering()
{        
    CRect<Uint16> GameRes = g_pVideoDriver->getGameResolution();
    CRect<float> screenRect(0, 0, GameRes.w, GameRes.h);

    auto engine = g_pBehaviorEngine->getEngine();
    auto *blit = g_pVideoDriver->getBlitSurface();
    auto *bgSfc = mpBackgroundSfc.get();

    if( engine == ENGINE_GALAXY )
	{
        SDL_BlitSurface( bgSfc, nullptr, blit, nullptr );
	}
	else
    {
        SDL_Rect lRect;

        if( mFXhStep == 0 && mFXvStep == 0 )
        {
            lRect = g_pVideoDriver->toBlitRect(mRect);
            SDL_BlitSurface( bgSfc, nullptr, blit, &lRect );
        }
        else
        {
            CRect<float> fxRect = mRect;

            if( mFXhStep > 0 )
            {
                fxRect.w = (MAX_STEPS-mFXhStep)*(mRect.w/float(MAX_STEPS));
                fxRect.x = fxRect.x + (mRect.w-fxRect.w)/2;
            }

            if( mFXvStep > 0 )
            {
                fxRect.h = (MAX_STEPS-mFXvStep)*(mRect.h/float(MAX_STEPS));;
                fxRect.y = fxRect.y + (mRect.h-fxRect.h)/2;
            }

            lRect = g_pVideoDriver->toBlitRect(fxRect);

            // Makes the Border look more like in DOS-Keen
            if( engine == ENGINE_VORTICON && lRect.h < 16 )
                lRect.h = 16;

            auto srcRect = lRect;
            srcRect.y = srcRect.x = 0;

            if( engine == ENGINE_VORTICON )
            {
                auto *tmpSfc = mpTempSfc.get();
                SDL_FillRect( tmpSfc, &srcRect, 0xFFFFFFFF );
                drawBorderRect( tmpSfc, srcRect );
                SDL_BlitSurface( tmpSfc, &srcRect, blit, &lRect );
            }
            else
            {
                SDL_BlitSurface( bgSfc, &srcRect, blit, &lRect );
            }
        }

        if( mFXhStep > 0 || mFXvStep > 0 )
            return;
    }


	for( auto &it : mControlList )
	{
        it->processRender(screenRect);
	}       
}
コード例 #4
0
ファイル: receiversform.cpp プロジェクト: ybchain/ybcoin
void Receiver::paintEvent(QPaintEvent *e)
{
    drawBorderRect();
}