Exemplo n.º 1
0
    void Canvas::render(kick::EngineUniforms *engineUniforms, Material* replacementMaterial) {
        if (!enabled()){
            return;
        }
        sort(mComponents.begin(), mComponents.end(), [](std::shared_ptr<Component2D> c1, std::shared_ptr<Component2D> c2){
            if (c1->order() != c2->order()){
                return c1->order() < c2->order();
            }
            return c1->shader() < c2->shader();
        });

        vector<Sprite*> sprites;
        TextureAtlas*currentTextureAtlas = nullptr;
        for (auto& comp : mComponents){
            auto text = dynamic_pointer_cast<Label>(comp);
            if (text){
                renderSprites(sprites, engineUniforms, replacementMaterial); // render previous sprites
                text->render(engineUniforms);
            } else {
                auto sprite = dynamic_pointer_cast<Sprite>(comp);
                if (currentTextureAtlas != sprite->textureAtlas().get()){
                    renderSprites(sprites, engineUniforms, replacementMaterial);
                    currentTextureAtlas = sprite->textureAtlas().get();
                }
                if (sprite){
                    sprites.push_back(sprite.get());
                }
            }
        }
        renderSprites(sprites, engineUniforms, replacementMaterial);
    }
Exemplo n.º 2
0
void Frame::prepareFrame(Score *score) {
	renderSprites(*score->_surface, false);
	renderSprites(*score->_trailSurface, true);

	if (_transType != 0)
		//TODO Handle changing area case
		playTransition(score);

	if (_sound1 != 0 || _sound2 != 0) {
		playSoundChannel();
	}

	g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, score->_surface->getBounds().width(), score->_surface->getBounds().height());
}
Exemplo n.º 3
0
void Video::drawScanLine()
{
	BYTE control = _memory->read(LCDC);
	if (testBit(control, 0))
		renderTiles();

	if (testBit(control, 1))
		renderSprites();
}
Exemplo n.º 4
0
/* CONSTRUCTOR - DESTRUCTOR */
Scrollbar::Scrollbar(const vec2& pos, const vec2& size, float heightScrollbar) :	m_Hitregion(nullptr),
                                                                                    m_Pos(pos),
                                                                                    m_Size(size),
                                                                                    m_BarPos(0.0f),
                                                                                    m_Dragging(false),
                                                                                    m_PreviousMousePos(0,0),
                                                                                    m_ScrollbarHeight(heightScrollbar)
{
    m_Hitregion = HENew(Hitregion)(
        vec2(pos.x + size.x/2, pos.y + (heightScrollbar/2)),
        vec2(size.x - 2, heightScrollbar));

    m_Colors["background"] = Color(0.6f,0.6f,0.6f);
    m_Colors["scrollbar"] = Color(0.4f,0.4f,0.4f);
    m_Colors["edge"] = Color(0.2f,0.2f,0.2f);

    SpriteCreator* const cr(GUI->getSpriteCreator());
    m_Sprites[0] = cr->createSprite(m_Size, Sprite::UNIFORM_SCALE);
    m_Sprites[1] = cr->createSprite(vec2(m_Size.x, heightScrollbar), Sprite::UNIFORM_SCALE);

    renderSprites();
}
Exemplo n.º 5
0
	void Glass::update(float dt)
	{
		checkBricks();
		moveDown(dt);
		renderSprites();
	}