Exemple #1
0
	void Perfmeter::render()
	{
		if(!enabled) return;
		
		sys->pvr->setTexture(PVR_LIST_TR_POLY, NULL);
		sys->pvr->sendPolygonHeader(PVR_LIST_TR_POLY);
		sys->pvr->beginPrimitives(PVR_LIST_TR_POLY);
		
		float pct;
		float posx = 32.0f, posy = 424.0f, posz = 4500.0f;
		
		pvr_stats_t stats;
		pvr_get_stats(&stats);
		
		pct = ((float)stats.buf_last_time) * 60.0f / 1000.0f;
		renderBar(pct, posx, posy, posz, 0xff00c0c0, 0xff007070);
		pct = ((float)stats.reg_last_time) * 60.0f / 1000.0f;
		renderBar(pct, posx, posy + 8.0f, posz, 0xff00c000, 0xff007000);
		pct = ((float)stats.rnd_last_time) * 60.0f / 1000.0f;
		renderBar( pct, posx, posy + 16.0f, posz, 0xffc0c000, 0xff707000);
		
		sys->pvr->endPrimitives();
		
		sys->dbgFont->setColorRGBA(1.0f, 1.0f, 1.0f, 1.0f);
		sys->dbgFont->print(sys, posx + barLength + 16.0f, posy, posz, "fps %.2f  buf %d  reg %d  rnd %d\n", (double)stats.frame_rate, (int)stats.buf_last_time, (int)stats.reg_last_time, (int)stats.rnd_last_time);
	}
Exemple #2
0
void Gui::render()
{
	auto engine = Engine::getSingleton();
	auto player = engine->getPlayer();

	// clear the GUI console
    con->setDefaultBackground(TCODColor::black);
    con->clear();

	// mouse look
	renderMouseLook();

	// draw the health bar
	renderBar(1,1,BAR_WIDTH,"HP",player->getOwner()->get<float>("HP").get(), player->getOwner()->get<float>("MaxHP").get(), TCODColor::lightRed,TCODColor::darkerRed);

	// draw the message log
	int y=1;
	float colorCoef=0.4f;
	for (unsigned int i = 0; i < log.size(); i++)
	{
		auto message = log[i];
		con->setDefaultForeground(message->col * colorCoef);
		con->print(MSG_X,y,message->text.c_str());
		y++;
		if ( colorCoef < 1.0f )
			colorCoef+=0.3f;
	}

	// blit the GUI console on the root console
	TCODConsole::blit(con,0,0,engine->getScreenWidth(),PANEL_HEIGHT, TCODConsole::root,0,engine->getScreenHeight()-PANEL_HEIGHT);
}
Exemple #3
0
void Gui::render() {
	// clear the GUI console
	con->setDefaultBackground(TCODColor::black);
	con->clear();

	// draw the health bar
	renderBar(1,1,BAR_WIDTH,"Lives",engine.lives,
		MAX_LIVES,
		TCODColor::lightRed,TCODColor::darkerRed);

	// draw the score
	con->print(1,2, "Score: %d", engine.getScore());

	// draw number of remaining keys
    con->print(1,3, "Keys to collect: %d", engine.keys.size());

	// draw the message log
	int y=1;
	float colorCoef=0.4f;
	for (Message **it=log.begin(); it != log.end(); it++) {
		Message *message=*it;
		con->setDefaultForeground(message->col * colorCoef);
		con->print(MSG_X,y,message->text);
		y++;
		if ( colorCoef < 1.0f ) {
			colorCoef+=0.3f;
		}
	}

	// blit the GUI console on the root console
	TCODConsole::blit(con,0,0,engine.screenWidth,PANEL_HEIGHT,
		TCODConsole::root,0,engine.screenHeight-PANEL_HEIGHT);
}
Exemple #4
0
void tGui::render()
{
    //Clear the gui console
    m_pConsole->setDefaultBackground(TCODColor::black);
    m_pConsole->clear();

    renderBar( 1, 1, BAR_WIDTH, engine.m_pPlayer->m_pName, engine.m_pPlayer->m_pDestructible->m_CurrentHP, engine.m_pPlayer->m_pDestructible->m_MaxHP, TCODColor::lightRed, TCODColor::darkerRed );

    //Draw the message log
    int y = 1;
    float colorCoef = 0.4f;
    for(tMessage** iterator = m_MessageLog.begin(); iterator != m_MessageLog.end(); ++iterator)
    {
        tMessage* pMessage = *iterator;
        m_pConsole->setDefaultForeground(pMessage->color * colorCoef);
        m_pConsole->print(MSG_X, y, pMessage->text);
        y++;
        if( colorCoef < 1.0f )
        {
            colorCoef += 0.3f;
        }
    }

    renderMouseLook();

    //Blit the bar onto the console
    TCODConsole::blit(m_pConsole, 0,0, engine.m_ScreenWidth, PANEL_HEIGHT, TCODConsole::root, 0, engine.m_ScreenHeight - PANEL_HEIGHT);
}
void barMainFeatures::renderBarMainPerson(MainPerson &mainPerson, int &current, int &max, int shift, Sprite &sprite, featuresSprite &sizes,
																					featuresWindow features, TextGame &textGame)
{
	RenderWindow &window = *features.window;
	Vector2f centerWindow = features.center;
	Vector2u sizeWindow = features.size;
	Vector2f pos;
	pos.x = centerWindow.x - sizeWindow.x / 2;//mainPerson.getXPos() mainPerson.getYPos()
	pos.y = centerWindow.y + sizeWindow.y / 2 - float(HEIGHT_BARS_GUI) * scaleGuiForEnemy.y * shift;

	renderBar(current, max, sprite, scaleGuiForMainPerson,
						sizes, textGame, pos, window);

}
void barMainFeatures::renderBarEnemy(Enemy &enemy, int &current, int &max, int shift, Sprite &sprite, featuresSprite &sizes,
																		 TextGame &textGame, RenderWindow &window)
{
	int shiftBar = enemy.mana.maxMana > 0;
	Vector2f pos = enemy.spriteEntity->getPosition();
	pos.x -= scaleGuiForEnemy.x * WIDTH_BARS_GUI / 2;
	pos.y -= enemy.size.height / 2 + scaleGuiForEnemy.y * HEIGHT_BARS_GUI * (shift + shiftBar);


	renderDamageForEnemy(enemy, textGame, window, shiftBar);

	if (max) {
		renderBar(current, max, sprite, scaleGuiForEnemy,
							sizes, textGame, pos, window);
	}

}
Exemple #7
0
void SM::renderScene()
{
	glTranslatef( OFFSET, -15.0, 0.0 );
	renderBar();
	//renderFonts();
	//		enable blend
// 	glEnable(GL_BLEND);
// 	glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    for( int i = 0; i < 2; i++ )
    {
        renderLinks( i );
    }
//	glDisable(GL_BLEND);
	glTranslatef( OFFSET, -15.0, 0.0 );
	//painter->setPen( QColor( 255, 255, 255 ) );
	//painter->drawText( QPointF( -_size/2, -_size/2 ), QObject::tr( "This is a test! " ) );
}
Exemple #8
0
void Gui::render(){
	//clear the off-screen consoles
	con->setDefaultBackground(TCODColor::black);
	con->clear();
	sidebar->setDefaultBackground(TCODColor::black);
	sidebar->clear();
	
	sidebar->setDefaultForeground(TCODColor(100,180,250));
	sidebar->printFrame(0,0,MSG_X,engine.screenHeight - con->getHeight(),
		true, TCOD_BKGND_ALPHA(50),"CHARACTER INFO");
	
	if (engine.player->destructible->shield) {
		//draw the shield bar, if it is there
		renderBar(1,5,BAR_WIDTH,"SHIELD",engine.player->destructible->shield,
			engine.player->destructible->maxShield,
			TCODColor::green,TCODColor::darkerGreen);
	} else {
		//draw the health bar
		renderBar(1,5,BAR_WIDTH,"HP",engine.player->destructible->hp,
			engine.player->destructible->maxHp,
			TCODColor::lightRed,TCODColor::darkerRed);
	}
	
	//draw the palyer's mana bar, if they have one
	if (engine.player->caster) {
		renderBar(1,7,BAR_WIDTH,"MANA",engine.player->caster->mana,
			engine.player->caster->maxMana,
			TCODColor::lightBlue,TCODColor::darkerBlue);
	}


	//draw the XP bar
	char xpTxt[128];
	sprintf(xpTxt,"XP(%d)",engine.player->xpLevel);
	renderBar(1,9,BAR_WIDTH,xpTxt,engine.player->destructible->xp,
		((PlayerAi*)engine.player->ai)->getNextLevelXp(engine.player),TCODColor::lightViolet,TCODColor::darkerViolet);
	
	//draw the last target's hp bar
	if ((engine.player->attacker->lastTarget != NULL)&&(engine.player->attacker->lastTarget!=engine.player)&&(!engine.player->attacker->lastTarget->destructible->isDead())) {

		if (engine.player->attacker->lastTarget->destructible->shield){
			renderBar(1,13,BAR_WIDTH, "target's Shield",engine.player->attacker->lastTarget->destructible->shield,
				engine.player->attacker->lastTarget->destructible->maxShield,TCODColor::green, TCODColor::darkerGreen);
		} else {
			renderBar(1,13,BAR_WIDTH, "target's HP",engine.player->attacker->lastTarget->destructible->hp,
				engine.player->attacker->lastTarget->destructible->maxHp,TCODColor::lightRed, TCODColor::darkerRed);
		}
    }
	
	//draw the message log
	int y=0;
	float colorCoef = 0.4f;
	for (Message **it = log.begin(); it != log.end(); it++){
		Message *message = *it;
		con->setDefaultForeground(message->col * colorCoef);
		con->print(0,y,message->text);
		y++;
		if (colorCoef < 1.0f) {
			colorCoef+=0.3f;
		}
	}
	
	//dungeon level
	sidebar->setDefaultForeground(TCODColor::white);
	sidebar->print(3,11,"Dungeon level %d", engine.level);
	
	//character name
	sidebar->print(3,3,"Name: %s",engine.player->getName(true));

	if (engine.player->caster && engine.player->caster->hasCantus()) {
		sidebar->setDefaultForeground(engine.player->caster->cantusColor());
		sidebar->print(1,17,"Current Cantus: %s",engine.player->caster->getCantus());
		sidebar->print(1,19,"%d",engine.player->caster->cantusValue);
	}
	
	//blit the GUI  consoles on the root console
	TCODConsole::blit(con,0,0,engine.screenWidth,PANEL_HEIGHT,
		TCODConsole::root,0,engine.screenHeight-PANEL_HEIGHT);
	TCODConsole::blit(sidebar,0,0,MSG_X,engine.screenHeight-PANEL_HEIGHT,
		TCODConsole::root,0,0);
}