예제 #1
0
파일: RenderQueue.cpp 프로젝트: Zykr/SFGUI
void RenderQueue::Render( sf::RenderTarget& target, sf::Renderer& /*renderer*/ ) const {
	if( !m_display_list ) {
		// Display list couldn't be created, render normally.

		std::size_t children_size = m_children.size();

		for( DrawablesVector::size_type index = 0; index < children_size; ++index ) {
			target.Draw( *( m_children[index].first ) );
		}
	}
	else if( !m_display_list_compiled ) {
		glNewList( m_display_list, GL_COMPILE_AND_EXECUTE );

		std::size_t children_size = m_children.size();

		for( DrawablesVector::size_type index = 0; index < children_size; ++index ) {
			target.Draw( *( m_children[index].first ) );
		}

		glEndList();

		m_display_list_compiled = true;
	}
	else {
		glCallList( m_display_list );
	}
}
예제 #2
0
void Car::Render(sf::RenderTarget & target) const
{
	target.Draw(sprite);

	//Draw the people stepping out of the elevator.
	Person *p = NULL;
	if (state == kHauling && (p = nextPassengerToUnmount())) {
		Sprite s;
		s.SetImage(app->bitmaps["simtower/elevator/people"]);
		s.SetCenter(direction == Elevator::kUp ? -elevator->shaft.GetSize().x : 16, 24);

		//Calculate the texture subrect for the person stepping out of the car.
		int type = p->type;
		sf::IntRect sr;
		sr.Left   = type * 32;
		sr.Right  = sr.Left + 16;
		sr.Top    = 24;
		sr.Bottom = 48;
		if (direction == Elevator::kUp) {
			sr.Left  += 16;
			sr.Right += 16;
		}
		
		//Draw the person.
		s.SetColor(sf::Color::Black);
		s.SetSubRect(sr);
		s.SetPosition(elevator->shaft.GetPosition().x, sprite.GetPosition().y);
		target.Draw(s);
	}
}
예제 #3
0
void Zone::Render(sf::RenderTarget& target) const
{
	// affichage des tiles
	target.Draw(tiles_sprite_);

	// affichage des tiles animées
	for (std::vector<Tileset::AnimatedTile>::const_iterator it = animated_.begin();
		it != animated_.end(); ++it)
	{
		target.Draw(it->sprite);
	}

	// affichage des items
	ItemList::const_iterator it2;
	for (it2 = items_.begin(); it2 != items_.end(); ++it2)
	{
		target.Draw(**it2);
	}

	// affichage des entités
	entities_.sort(Entity::PtrComp);
	EntityList::const_iterator it;
	for (it = entities_.begin(); it != entities_.end(); ++it)
	{
		target.Draw(**it);
	}
}
예제 #4
0
    void Console::Render(sf::RenderTarget& target) const
    {
        Panel::Render(target);
        for(unsigned int i = 0; i < strings.size(); i++)
            target.Draw((strings.at(i)));

        target.Draw(*inStr);
    }
예제 #5
0
void Menu::draw(sf::RenderTarget& window) const
{
    window.Draw(myBackground);
    window.Draw(myTitle);

    for(std::vector<Button>::const_iterator i = myButtons.begin(); i != myButtons.end(); ++i)
        i->draw(window);
}
예제 #6
0
void PlayerHUD::renderChars(sf::RenderTarget& targ) const {
	glPushMatrix();

	//Draw the globe and portrait in the correct place.
	targ.Draw(*mCharGlobe);

	glTranslatef(mCharGlobe->GetPosition().x, mCharGlobe->GetPosition().y, 0);
	glTranslatef(16, -14, 0);
	targ.Draw(*mCharThumb);
	glPopMatrix();
}
예제 #7
0
	void MenuBehaviour::Render(sf::RenderTarget& target, float interpolation)
	{
		sf::Sprite background = m_resources.Get(Sprite_Background);
		target.Draw(background);

		auto title = m_resources.GetText("Ulderico - Alpha");
		title.SetPosition(Game::WINDOW_WIDTH / 2 - title.GetGlobalBounds().Width / 2, 40.0f);
		target.Draw(title);
		
		for (auto item = m_menuItems.begin(); item != m_menuItems.end(); ++item)
			target.Draw(*item);
	}
예제 #8
0
void Menu::Render(sf::RenderTarget& target) const
{
	if(m_confirmingAction)
	{
		target.Draw(*m_yesButton);
		target.Draw(*m_noButton);
	}
	
	for(int i = 0; i < m_buttons.size(); i++)
	{
		target.Draw(*m_buttons[i]);
	}

	target.Draw(*m_resumeButton);
}
예제 #9
0
void Animation::draw(sf::RenderTarget& target)
{
    if (!hidden())
    {
        target.Draw(sprite_);
    }
}
예제 #10
0
    void Receiver::Render(sf::RenderTarget& Target) const
    {
        float particleRatio = Helper::Clamp((float)receivedParticles / maximumParticles, 0.0f, 1.0f);

        sprite.SetColor(Helper::Blend(colorStart, colorEnd, particleRatio));
        Target.Draw(sprite);
    }
예제 #11
0
void Zombie::draw(sf::RenderTarget& target)
{
    b2Vec2 pos = m_body->GetPosition();
    m_sprite.SetPosition(pos.x * m_scene->getMeterPixelRatio(), pos.y * m_scene->getMeterPixelRatio());
    
    target.Draw(m_sprite);
}
예제 #12
0
void FightScene::draw(sf::RenderTarget &target)
{
    target.Clear();
    background2Anim->draw(target);

    target.Draw(behindBar1);
    target.Draw(behindBar2);

    target.Draw(p1bar);
    target.Draw(p2bar);

    target.Draw(p1refreshbar);
    target.Draw(p2refreshbar);


}
예제 #13
0
void GS_Game::DrawField(sf::RenderTarget& renderTarget)
{
	for(int i = 0; i < 20; ++i)
	{
		for(int j = 0; j < 16; ++j)
		{
			if(_field[i].stack[j] > 0) 
			{
				float x = 200.0f + j * BLOCKSIZE;
				float y = 50.0f + i * BLOCKSIZE;
				_blockSprite.SetPosition(x, y);
				int entry = _field[i].colors[j];
				sf::Uint8 alpha = 255;
				if(_field[i].remFlag == true)
				{
					alpha = static_cast<int>(255.0f * sin(_blendTimer));
				}
				sf::Color color(colorTable[entry][0], colorTable[entry][1], 
					colorTable[entry][2], alpha);
				_blockSprite.SetColor(color);
				renderTarget.Draw(_blockSprite);
			}
		}
	}
}
예제 #14
0
// Draws all Entities to RenderTarget
void World::Draw(sf::RenderTarget& target, float blocksize, sf::Vector2f offset){
    // Iterate through all Entities and Draw their Sprites
    for ( EntityMap::iterator i = mEntities.begin(); i!=mEntities.end(); ++i ){
        sf::Sprite& s = i->second->GetSprite(blocksize, offset);
        target.Draw(s);
    }
}
void BitmapString::Render(sf::RenderTarget& target) const
{
	for (SpriteVec::const_iterator it = bitmaps_.begin(); it != bitmaps_.end(); ++it)
	{
		target.Draw(*it);
	}
}
예제 #16
0
파일: Emitter.cpp 프로젝트: kedean/Magnatar
void Emitter::Render(sf::RenderTarget& target) const{
	
	vector<Particle>::const_iterator it;
	for(it = _particles.begin(); it < _particles.end(); it++){
		target.Draw(*it);
	}
}
예제 #17
0
void Terrain::Render(sf::RenderTarget& target, sf::Renderer& renderer) const
{
	if(needReload){
		tex.LoadFromImage(image);
		needReload = false;
	}
    target.Draw(sprite);
}
예제 #18
0
파일: wall.cpp 프로젝트: speps/attractouch
 void WallForeground::Render(sf::RenderTarget& Target) const
 {
     // fill
     spriteFill.SetScale(sf::Vector2f(width, height));
     spriteFill.SetPosition(0.0f, 0.0f);
     spriteFill.SetColor(sf::Color(255, 255, 255, int(alpha * 255)));
     Target.Draw(spriteFill);
 }
예제 #19
0
void EffectSystem::drawBg(sf::RenderTarget& target) const
{
	BgSpriteVect::const_iterator it = _bgSprites.begin();
	for (; it != _bgSprites.end(); ++it)
	{
    target.Draw(*it);
	}
}
예제 #20
0
파일: Plasma.cpp 프로젝트: Dobiasd/Dron
bool Plasma::Display(sf::RenderTarget& renderTarget) const
{
	sf::Sprite sprite_(image_);
	float width(renderTarget.GetView().GetRect().GetWidth());
	float height(renderTarget.GetView().GetRect().GetHeight());
	sprite_.Resize(width, height);
	renderTarget.Draw(sprite_);
	return true;
}
예제 #21
0
    void Ship::Render(sf::RenderTarget& Target) const
    {
        if(deathTimer == -1 || deathTimer >= deathDelay) Movable::Render(Target);

        if(pSysDeath != NULL)
        {
            Target.Draw(*pSysDeath);
        }
    }
예제 #22
0
파일: player.cpp 프로젝트: erik/twist
void Player::Draw(sf::RenderTarget& r) {
  sf::Sprite sprite(m_image);

  sprite.SetOrigin(m_image.GetWidth() / 2, m_image.GetHeight() / 2);  
  sprite.SetPosition(m_entity.GetPosition());
  sprite.SetRotation(m_entity.GetRotation());

  r.Draw(sprite);
}
예제 #23
0
파일: Ball.cpp 프로젝트: Silvatre/Aputapu
void Ball::Draw(sf::RenderTarget& Target)
{
	sf::Animation::Draw(Target);
	if (myActivated)
	{
		myActiveString.SetPosition( this->GetPosition().x + 25, this->GetPosition().y + 13 );
		Target.Draw(myActiveString);
	}
}
예제 #24
0
	void Block::Draw(sf::RenderTarget& renderTarget) {
		MATH::Vector2 position = GetPosition();

		if(_highlight) {
			_blockSprite.SetColor(_color + sf::Color(255, 255, 255, 255 * sinf(_highlightPhase)));
			position -= MATH::Vector2(0.0f, 5.0f * sinf(_highlightPhase));
		}

		_blockSprite.SetPosition(position.sfVec());
		renderTarget.Draw(_blockSprite);
	}
예제 #25
0
파일: Gun.cpp 프로젝트: Rubenknex/Afterlife
void Gun::draw(sf::RenderTarget& target)
{
    float rotRads = math::radians(m_owner->getRotation());
    sf::Vector2f dirNormal(cos(rotRads), sin(rotRads));
    
    m_sprite.SetPosition(m_owner->getPosition() + dirNormal * 14.0f);
    m_sprite.SetRotation(m_owner->getRotation() - 90.0f);
    
    m_light->setPosition(m_owner->getPosition() + dirNormal * 14.0f);
    
    target.Draw(m_sprite);
}
예제 #26
0
void MainMenu::Render(sf::RenderTarget& target) const {
	sf::Color screenColor = sf::Color(0,0,0,128);
	sf::FloatRect screenRect = game::ScreenManager::GetLayout().GetRect();
	sf::Shape screenBg = sf::Shape::Rectangle(screenRect.Left, screenRect.Top, screenRect.Right, screenRect.Bottom, screenColor);
	target.Draw(screenBg);


	sf::FloatRect rect = _buttonList.GetRect();
	float x = _buttonList.GetPosition().x;
	float y = _buttonList.GetPosition().y;

	float x1 = x - 20;
	float y1 = y - 20;
	float x2 = x + rect.Right + 20;
	float y2 = y + rect.Bottom + 20;

	sf::Shape background = sf::Shape::Rectangle(x1, y1, x2, y2, sf::Color(64,0,0,192), 1.0f, sf::Color(255,255,255,128));
	target.Draw(background);
	target.Draw(_buttonList);
	//target.Draw(_logoSprite);
}
예제 #27
0
파일: wall.cpp 프로젝트: speps/attractouch
    void WallBackground::Render(sf::RenderTarget& Target) const
    {
        spriteCorner.SetColor(sf::Color(255, 255, 255, int(alpha * 255)));
        spriteBorderH.SetColor(sf::Color(255, 255, 255, int(alpha * 255)));
        spriteBorderV.SetColor(sf::Color(255, 255, 255, int(alpha * 255)));

        // top left corner
        spriteCorner.SetRotation(180.0f);
        spriteCorner.SetPosition(0.0f, 0.0f);
        Target.Draw(spriteCorner);

        // top right corner
        spriteCorner.SetRotation(90.0f);
        spriteCorner.SetPosition(width, 0.0f);
        Target.Draw(spriteCorner);

        // bottom right corner
        spriteCorner.SetRotation(0.0f);
        spriteCorner.SetPosition(width, height);
        Target.Draw(spriteCorner);

        // bottom left corner
        spriteCorner.SetRotation(-90.0f);
        spriteCorner.SetPosition(0.0f, height);
        Target.Draw(spriteCorner);

        // top border
        spriteBorderH.SetRotation(180.0f);
        spriteBorderH.SetScale(sf::Vector2f(width, 1.0f));
        spriteBorderH.SetPosition(width, 0.0f);
        Target.Draw(spriteBorderH);

        // right border
        spriteBorderV.SetRotation(0.0f);
        spriteBorderV.SetScale(sf::Vector2f(1.0f, height));
        spriteBorderV.SetPosition(width, 0.0f);
        Target.Draw(spriteBorderV);

        // bottom border
        spriteBorderH.SetRotation(0.0f);
        spriteBorderH.SetScale(sf::Vector2f(width, 1.0f));
        spriteBorderH.SetPosition(0.0f, height);
        Target.Draw(spriteBorderH);

        // left border
        spriteBorderV.SetRotation(180.0f);
        spriteBorderV.SetScale(sf::Vector2f(1.0f, height));
        spriteBorderV.SetPosition(0.0f, height);
        Target.Draw(spriteBorderV);
    }
예제 #28
0
	void Ball::Draw(sf::RenderTarget& renderTarget) {
		sf::Color color(255, 255, 255);
		if(_dying) {
			float scale = std::max(_health, 0.0f);
			color.a = static_cast<int>(255 * scale);
			_ballSprite.SetColor(color);
		}

		_emitter.Draw(renderTarget);
		_blur.Draw(renderTarget);
		_ballSprite.SetPosition(GetPosition().sfVec());
		renderTarget.Draw(_ballSprite);
	}
예제 #29
0
void Elevator::Render(sf::RenderTarget & target) const
{
	Item::Render(target);
	
	//Draw the elevator floors.
	Sprite s = shaft;
	Sprite d;
	d.SetImage(app->bitmaps["simtower/elevator/digits"]);
	d.SetCenter(0, 17);
	
	int minY = 0;
	int maxY = size.y-1;
	
	for (int y = minY; y <= maxY; y++) {
		s.SetY(-y*36);
		d.SetY(-y*36 - 3);
		target.Draw(s);
		
		int flr = position.y + y;
		if (!connectsFloor(flr)) continue;
		
		char c[8];
		int len = snprintf(c, 8, "%i", flr);
		int x = 11 - (len - 1) * 6 + (size.x - 4) * 4;
		for (int i = 0; i < len; i++) {
			int p = 10;
			if (c[i] >= '0' && c[i] <= '9') p = c[i] - '0';
			d.SetSubRect(sf::IntRect(p*11, 0, (p+1)*11, 17));
			d.SetX(x);
			target.Draw(d);
			x += 12;
		}
	}
	
	//Draw the cars and queues.
	for (Cars::iterator c = cars.begin(); c != cars.end(); c++) target.Draw(**c);
	for (Queues::iterator q = queues.begin(); q != queues.end(); q++) target.Draw(**q);
}
예제 #30
0
파일: World.cpp 프로젝트: opatut/gamejam
void World::Draw(sf::RenderTarget& target) {
	// draw grid
	sf::Shape line;
	for(int i = 0; i <= FIELD_SIZE; i+=BLOCKSIZE) {
		line = sf::Shape::Line(i,0,i,FIELD_SIZE,1,sf::Color(50,50,50));
		line.SetPosition(GetOffset());
		target.Draw(line);

		line = sf::Shape::Line(0,i,FIELD_SIZE,i,1,sf::Color(50,50,50));
		line.SetPosition(GetOffset());
		target.Draw(line);
	}
	for(int i = 0; i <= FIELD_SIZE; i+=BLOCKSIZE) {
		sf::Shape line = sf::Shape::Line(0,i,FIELD_SIZE,i,1,sf::Color(50,50,50));
		line.SetPosition(GetOffset());
		target.Draw(line);
	}

	for(unsigned int i = 0; i < mActors.size(); ++i) {
		mActors[i].Draw(target);
	}

	target.Draw(mMouseHighlight);
}