Exemple #1
0
void EImgExpendableBox::Draw() {
	Coord dst(_x,_y),
		pos(0,0),
		chunk(_wLUCorner + _wCenter, _hLUCorner + _hCenter),
		toDraw(_w - _wRDCorner, _h - _hRDCorner); 

	while (toDraw.y >= 0) {
		if (toDraw.y == 0) {
			pos.y += _hCenter;
			chunk.y = _hRDCorner;
		} else if (toDraw.y < chunk.y) {
			chunk.y = toDraw.y;
		}

		while(toDraw.x >= 0) {
			// Toute la partie gauche de la boite a été déssiné
			if (toDraw.x == 0) {
				pos.x += _wCenter;
				chunk.x = _wRDCorner;
			} else if (toDraw.x < chunk.x) {// Finalistion du bourage horizontal
				chunk.x = toDraw.x;
			}

			_lpImgBox->blitAlphaRectFx(pos.x,pos.y,pos.x+chunk.x,pos.y+chunk.y,dst.x,dst.y,0,1,_fBlend); // LU Corner
			
			// Next horizontal chunk
			dst.x+=chunk.x;
			toDraw.x-=chunk.x;

			// Draw de la partie gauche fait, ajustement du chunk
			if (pos.x == 0) { 
				pos.x   += _wLUCorner;
				chunk.x -= _wLUCorner;
			}
		}

		// Next vertical chunk
		dst.y += chunk.y;
		toDraw.y -= chunk.y;
		
		if (pos.y == 0) { // Draw de la partie up de la boite fait, ajustement du chunk
			pos.y   += _hLUCorner;
			chunk.y -= _hLUCorner;
		}

		// Restart draw from left
		pos.x = 0;
		chunk.x = _wLUCorner + _wCenter;
		toDraw.x = _w - _wRDCorner;
		dst.x = _x;
	}

	EBox::Draw();
}
  void draw (sf::RenderTarget& target, sf::RenderStates states) const
  {
    sf::Sprite toDraw(*texture);

    sf::Vector2u drawSize = texture->getSize();
    toDraw.setOrigin(drawSize.x / 2, drawSize.y);

    sf::Vector2u targetSize = target.getSize();
    toDraw.setPosition(targetSize.x / 2, targetSize.y);

    target.draw(toDraw, states);
  }
void IMCursorManager::drawCursor()
{
    RenderWindow* renderer = IMGuiManager::getSingleton().getRenderWindow();
    if (NULL == renderer) return; // Can't draw on nothing!

    if (SYSTEM == current_type || (DEFAULT == current_type && NULL == m_cursor_images[DEFAULT]))
    {
        // Use system cursor
        renderer->setMouseCursorVisible(true);
    }
    else if ( ! (NONE == current_type || NULL == m_cursor_images[current_type]) )
    {
        // Use custom cursor image
        renderer->setMouseCursorVisible(false);
        // Draw!
        sf::Sprite* toDraw( m_cursor_images[current_type] );
        sf::Vector2i mouse_position = sf::Mouse::getPosition( *(renderer) );
        sf::Vector2f scale = toDraw->getScale();
        toDraw->setOrigin( -mouse_position.x / scale.x, -mouse_position.y / scale.y);
        renderer->draw( *toDraw ); 
    }
}