Esempio n. 1
0
void App::RenderTitleScreen()
{
    Image *gasMask = g_resource->GetImage( "graphics/gasmask.bmp" );
    
    float windowW = g_windowManager->WindowW();
    float windowH = g_windowManager->WindowH();


    float baseLine = windowH * 0.7f;

    g_renderer->SetBlendMode( Renderer::BlendModeNormal );
    g_renderer->SetDepthBuffer( false, false );
    

    //
    // Render explosions

    static float bombTimer = GetHighResTime() + 1;
    static float bombX = -1;
    
    if( GetHighResTime() > bombTimer )
    {
        bombX = frand(windowW);
        bombTimer = GetHighResTime() + 10 + frand(10);
    }

    if( bombX > 0 )
    {
        Image *blur = g_resource->GetImage( "graphics/explosion.bmp" );
        g_renderer->SetBlendMode( Renderer::BlendModeAdditive );        

        float bombSize = 500;
        Colour col(255,155,155, 255*(bombTimer-GetHighResTime())/10 );
        g_renderer->Blit( blur, bombX, baseLine-300, bombSize, bombSize, col );
    }


    //
    // Render city

    float x = 0;
    
    AppSeedRandom(0);
    
    g_renderer->SetBlendMode( Renderer::BlendModeNormal );        

    g_renderer->RectFill( 0, baseLine, windowW, windowH-baseLine, Black );

    while( x < windowW )
    {        
        float thisW = 50+sfrand(30);
        float thisH = 40+frand(140);

        g_renderer->RectFill( x, baseLine - thisH, thisW, thisH, Black );

        x += thisW;
    }

}
Esempio n. 2
0
SoundSystem::SoundSystem()
:   m_timeSync(0.0f),
    m_channels(NULL),
    m_numChannels(0),
    m_numMusicChannels(0),
    m_interface(NULL),
    m_propagateBlueprints(false)
{
    AppSeedRandom( (unsigned int) GetHighResTime() );
}
// _gradient=1 means flat, _gradient=0 means vertical
// x and z are only passed in as a means to get predicatable noise
void LandscapeRenderer::GetLandscapeColour( float _height, float _gradient, 
											unsigned int _x, unsigned int _y, RGBAColour *_colour )
{
	float heightAboveSea = _height;
    float u = iv_pow(1.0 - _gradient, 0.4);
	float v = 1.0 - heightAboveSea / m_highest;
    AppSeedRandom(_x | _y + AppRandom());
	if (heightAboveSea < 0.0) heightAboveSea = 0.0;
	v += sfrand(0.45 / (heightAboveSea + 2.0));

    int x = u * m_landscapeColour->m_width;
    int y = v * m_landscapeColour->m_height;

    if( x < 0 ) x = 0;
    if( x > m_landscapeColour->m_width - 1) x = m_landscapeColour->m_width - 1;
    if( y < 0 ) y = 0;
    if( y > m_landscapeColour->m_height - 1) y = m_landscapeColour->m_height - 1;

    *_colour = m_landscapeColour->GetPixel(x, y);    
    
    if( g_app->m_negativeRenderer ) _colour->a = 0;
}