Exemplo n.º 1
0
//**********************************************************************************************************************
// 
//**********************************************************************************************************************
void GlWidget::paintGL()
{
   getGameEngine().render(*this);
   this->swapBuffers();
}
Exemplo n.º 2
0
void PongApp::render() {
    spriteBatch->begin(SpriteBatch::eALPHA, SpriteBatch::eCUSTOMPROJECTION, matrixProjection );


    static float ftest = 0.0f;
    ftest+=0.01f;
    float camx = cosf( ftest );
    float camy = sinf( ftest );

    if (background1) {
        background1->render(camx, camy);
    }


    if (credits) credits->render();
    if (highScores) highScores->render();
    if (currentGame) currentGame->render();
    if (currentMenu) currentMenu->render();



        // top bar
    SpriteDrawInfo sdi;
    sdi.setScale(2.0f,2.0f*TOP_BAR_HEIGHT);
    sdi.setTargetPos(0, getTop()-TOP_BAR_HEIGHT);
    sdi.setSourceRect(0,0,1,0.97f);
    sdi.textureHandle = topBarTexture;
    spriteBatch->draw(&sdi);

    // volume button and exit button
    sdi.setScale(0.2, 0.1f);
    sdi.textureHandle = volumeTexture;
#ifndef MY_OS_MEEGO
    // volume button specifics
    sdi.setTargetPos( 0.7, getTop() - 0.05f );
    sdi.setSourceRect( (float)volumeIndicator/6.0f, 0.0f, 1.0f/6.0f, 1.0f );
    spriteBatch->draw( &sdi );
#endif


    // Exit button
    if (currentGame) {
        sdi.setTargetPos( 0.9f, getTop() - 0.05f );
        sdi.setSourceRect( (float)5.0f/6.0f, 0.0f, 1.0f/6.0f, 1.0f );
        spriteBatch->draw( &sdi );
    }
#ifdef MY_OS_MEEGO
    if (getGameEngine()->isSwipeEnabled()) {
        sdi.setScale(0.5f, 0.25f);
        sdi.setTargetPos(-0.75f, -0.40f);
        sdi.setSourceRect(0,0,1,1);
        sdi.textureHandle = meegoSwipeTexture;
        spriteBatch->draw(&sdi);
    }
#endif
    spriteBatch->end();

    if (pengine) {
            // Render the two types separetally to maximize the average batchsize.
        spriteBatch->begin(SpriteBatch::eADDITIVE, SpriteBatch::eCUSTOMPROJECTION, matrixProjection );
        pengine->render( spriteBatch, ballFlyParticleType );
        pengine->render( spriteBatch, ballHitParticleType );
        spriteBatch->end();
    }

#ifdef EPONG_DEBUG
    spriteBatch->begin(SpriteBatch::eALPHA, SpriteBatch::eCUSTOMPROJECTION, matrixProjection );
    sdi.setScale(0.2, 0.1f);
    sdi.textureHandle = volumeTexture;
    sdi.setTargetPos( pointerX[0], pointerY[0]);
    sdi.setSourceRect( (float)5.0f/6.0f, 0.0f, 1.0f/6.0f, 1.0f );
    spriteBatch->draw( &sdi );
    spriteBatch->end();
#endif
};