예제 #1
0
파일: GameApp.cpp 프로젝트: DrakonPL/jge
//-------------------------------------------------------------------------------------
// All rendering operations should be done in Render() only.
// 
//-------------------------------------------------------------------------------------
void GameApp::Render()
{

	// get JRenderer instance
	JRenderer* renderer = JRenderer::GetInstance();		

	// clear screen to black
	renderer->ClearScreen(ARGB(255,128,128,128));

	//
	// Your rendering code here...
	//

	if (mBox2D)	
		mBox2D->Render();
	

}
예제 #2
0
void GameApp::Render()
{
    if (systemError.size())
    {
        fprintf(stderr, "%s", systemError.c_str());
        WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
        if (mFont)
            mFont->DrawString(systemError.c_str(), 1, 1);
        return;
    }

    JRenderer * renderer = JRenderer::GetInstance();
    renderer->ClearScreen(ARGB(0,0,0,0));

    if (mCurrentState)
        mCurrentState->Render();

#ifdef DEBUG_CACHE
    WResourceManager::Instance()->DebugRender();
#endif

#if defined(DEBUG) && !defined(IOS)
    JGE* mEngine = JGE::GetInstance();
    float fps = mEngine->GetFPS();
    totalFPS += fps;
    nbUpdates+=1;
    WFont * mFont= WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
    char buf[512];
    sprintf(buf, "avg:%.02f - %.02f fps",totalFPS/nbUpdates, fps);
    if (mFont)
    {
        mFont->SetColor(ARGB(255,255,255,255));
        mFont->DrawString(buf, 10, SCREEN_HEIGHT-25);
    }
#endif

}
예제 #3
0
파일: GameApp.cpp 프로젝트: DrakonPL/jge
//-------------------------------------------------------------------------------------
// All rendering operations should be done in Render() only.
// 
//-------------------------------------------------------------------------------------
void GameApp::Render()
{

	// get JRenderer instance
	JRenderer* renderer = JRenderer::GetInstance();		

	// clear screen to black
	renderer->ClearScreen(ARGB(0,0,0,0));

	// render circle
	renderer->RenderQuad(mCircle, x, y);

	// set additive blending
	renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE);

	mParticleSys->Render();
	mMovingParticleSys->Render();

	// set normal blending
	renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);

	// draw the current image used for the particle system shown in the middle
	renderer->FillRect(SCREEN_WIDTH_F-37, 3, 34, 34, ARGB(255,0,0,128));
	mParticles[mCurrParticle]->SetColor(ARGB(255,255,255,255));
	renderer->RenderQuad(mParticles[mCurrParticle], SCREEN_WIDTH_F-20, 20);

	// turn off bilinear filtering to render sharp text
	renderer->EnableTextureFilter(false);

	mFont->printf(5, 5, HGETEXT_LEFT, "[Left/Right] Change Particle Image");
	char s[80];
	mFont->printf(5, 20, HGETEXT_LEFT, "[Up/Down] Change Effect -> particle%d.psi", (mCurrParticleSys+1));
	mFont->printf(5, 35, HGETEXT_LEFT, "[Analog] Move Circle");

	renderer->EnableTextureFilter(true);
}
예제 #4
0
파일: GameApp.cpp 프로젝트: DrakonPL/jge
//-------------------------------------------------------------------------------------
// All rendering operations should be done in Render() only.
// 
//-------------------------------------------------------------------------------------
void GameApp::Render()
{

	// get JRenderer instance
	JRenderer* renderer = JRenderer::GetInstance();		

	// clear screen to black
	renderer->ClearScreen(ARGB(0,0,0,0));

	float xList[] =
	{
		10, 100, 120, 80, 50, 10
	};

	float yList[] = 
	{
		100, 100, 60, 30, 10, 10
	};

	renderer->DrawPolygon(xList, yList, 6, ARGB(255,0,0,255));				// Draw polygon with 6 vertices.

	renderer->DrawLine(120, 100, 320, 250, 5, ARGB(255,255,0,0));				

	renderer->FillCircle(400, 180, 50, ARGB(255,123,60,200));

 	renderer->DrawPolygon(180, 200, 40, 4, mAngle, ARGB(255,0,0,255));		// Draw a symmetric polygon with 4 sides.
 
 	renderer->FillPolygon(80, 200, 80, 6, mAngle, ARGB(255,0,0,255));		// Draw a symmetric polygon with 6 sides.

	renderer->DrawRect(250, 100, 40, 60, ARGB(255,255,255,255));

	renderer->DrawRoundRect(340, 30, 30, 20, 5, ARGB(255,255,255,255));

	renderer->FillRoundRect(200, 20, 40, 40, 8, ARGB(255,255,255,64));

}
예제 #5
0
void GameStateAwards::Render()
{
    JRenderer * r = JRenderer::GetInstance();
    r->ClearScreen(ARGB(0,0,0,0));

    JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad("awardback.jpg", TEXTURE_SUB_5551);
    if (background.get())
        r->RenderQuad(background.get(), 0, 0);

    switch (mState)
    {
    case STATE_LISTVIEW:
        if (listview)
            listview->Render();
        break;
    case STATE_DETAILS:
        if (detailview)
            detailview->Render();
        break;
    }

    if (showMenu && menu)
        menu->Render();
}
예제 #6
0
파일: GameApp.cpp 프로젝트: 173210/w-menu
//-------------------------------------------------------------------------------------
// All rendering operations should be done in Render() only.
//
//-------------------------------------------------------------------------------------
void GameApp::Render()
{

    // get JRenderer instance
    JRenderer* renderer = JRenderer::GetInstance();

    // clear screen to black
    renderer->ClearScreen(ARGB(0,0,0,0));
    if (backQuad)renderer->RenderQuad(backQuad,0,0);

    if (transition <= 255 && backQuad2) {
        backQuad2->SetColor(ARGB(transition,255,255,255));
        renderer->RenderQuad(backQuad2,0,0);
    }

    if (gameSelected > -1) {
        renderer->FillRoundRect(10,110,450,72,5,ARGB(200,0,50,0));
        mFont->DrawString("Launching the homebrew...", 15,115);
        mFont->DrawString("If you see this screen and nothing happens for", 15,127);
        mFont->DrawString("1 minute, please restart your psp and try again.", 15, 138);
        mFont->DrawString("If this problem happens repeatedly for this homebrew,", 15,150);
        mFont->DrawString("it is probably not compatible with HBL", 15,162);
    } else if (menu) {
        if (!menu->mCount) {
            renderer->FillRoundRect(10,110,450,60,5,ARGB(200,50,0,0));
            mFont->DrawString("ERROR!", 15,115);
            mFont->DrawString("couldn't find any homebrew in", 15,127);
            mFont->DrawString(base, 15, 138);
            mFont->DrawString("Please check your config file and/or restart HBL", 15,150);
        } else {
            menu->Render();
            mFont->SetScale(1.0);
            mFont->SetColor(ARGB(255,200,200,200));
            mFont->DrawString(base.c_str(), 10, 10);
            mFont->SetColor(ARGB(255,255,255,255));
        }
    }
    mFont->SetScale(1.0);
    mFont->SetColor(ARGB(255,255,255,255));
    if (scroller) scroller->Render();
    renderer->FillRoundRect(270,10,190,28,5,ARGB(200,50,0,0));
    mFont->DrawString("wMenu 0.4 - http://wololo.net", 280,15);
    mFont->DrawString("X or O to run game, /\\ to exit", 280,30);


    if (gameToExtract.size()) {
        if (subMenu)
            subMenu->Render();

        switch(currentGameState) {
        case GAME_STATE_EXTRACTING:
            renderer->FillRoundRect(5,120,470,30,5,ARGB(200,0,0,0));
            mFont->SetColor(ARGB(255,255,255,255));
            mFont->DrawString(currentExtractFile, 10,130);
            char buffer[512];
            sprintf(buffer, "%d remaining Files", zipFiles.size());
            mFont->DrawString(buffer, 10, 145);
            break;
        default:
            break;
        }

    }


}
예제 #7
0
void GameStateShop::Render()
{
    //Erase
    WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
    JRenderer * r = JRenderer::GetInstance();
    r->ClearScreen(ARGB(0,0,0,0));
    if (mStage == STAGE_FADE_IN)
        return;

    JQuadPtr mBg = WResourceManager::Instance()->RetrieveTempQuad("shop.jpg", TEXTURE_SUB_5551);
    if (mBg.get())
        r->RenderQuad(mBg.get(), 0, 0);

    JQuadPtr quad = WResourceManager::Instance()->RetrieveTempQuad("shop_light.jpg", TEXTURE_SUB_5551);
    if (quad.get())
    {
        r->EnableTextureFilter(false);
        r->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE);
        quad->SetColor(ARGB(lightAlpha,255,255,255));
        r->RenderQuad(quad.get(), 0, 0);
        r->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
        r->EnableTextureFilter(true);
    }

    if (shopMenu)
        shopMenu->Render();
    
    if (filterMenu && !filterMenu->isFinished())
        filterMenu->Render();
    else
    {
        if (boosterDisplay)
            boosterDisplay->Render();
        else if (bigDisplay)
        {
            if (bigDisplay->mOffset.getPos() >= 0)
                bigDisplay->setSource(srcCards);
            else
                bigDisplay->setSource(NULL);
            bigDisplay->Render();
            float elp = srcCards->getElapsed();
            //Render the card list overlay.
            if (bListCards || elp > LIST_FADEIN)
            {
                int alpha = 200;
                if (!bListCards && elp < LIST_FADEIN + .25)
                {
                    alpha = static_cast<int> (800 * (elp - LIST_FADEIN));
                }
                r->FillRoundRect(300, 10, 160, SHOP_SLOTS * 20 + 15, 5, ARGB(alpha,0,0,0));
                alpha += 55;
                for (int i = 0; i < SHOP_SLOTS; i++)
                {
                    if (i == shopMenu->getSelected())
                        mFont->SetColor(ARGB(alpha,255,255,0));
                    else
                        mFont->SetColor(ARGB(alpha,255,255,255));
                    char buffer[512];
                    string s = descPurchase(i, true);
                    sprintf(buffer, "%s", s.c_str());
                    float x = 310;
                    float y = static_cast<float> (25 + 20 * i);
                    mFont->DrawString(buffer, x, y);
                }
            }
        }
    }

    //Render the info bar
    r->FillRect(0, SCREEN_HEIGHT - 17, SCREEN_WIDTH, 17, ARGB(128,0,0,0));
    std::ostringstream stream;
    stream << kCreditsString << playerdata->credits;
    mFont->SetColor(ARGB(255,255,255,255));
    mFont->DrawString(stream.str(), 5, SCREEN_HEIGHT - 14);

#ifndef TOUCH_ENABLED
    float len = 4 + mFont->GetStringWidth(kOtherCardsString.c_str());
	r->RenderQuad(pspIcons[6].get(), SCREEN_WIDTH - len - 0.5 - 10, SCREEN_HEIGHT - 8, 0, kPspIconScaleFactor, kPspIconScaleFactor);
    mFont->DrawString(kOtherCardsString, SCREEN_WIDTH - len, SCREEN_HEIGHT - 14);
#else
    enableButtons();
#endif
    
    mFont->SetColor(ARGB(255,255,255,0));
    mFont->DrawString(descPurchase(bigSync.getPos()).c_str(), SCREEN_WIDTH / 2, SCREEN_HEIGHT - 14, JGETEXT_CENTER);
    mFont->SetColor(ARGB(255,255,255,255));

    if (mStage == STAGE_SHOP_TASKS && taskList)
    {
        taskList->Render();
    }
    if (menu)
        menu->Render();
    
    if (!filterMenu || (filterMenu && filterMenu->isFinished()))
        renderButtons();
}