Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Using an untextured or filled shape  (Read 1237 times)

0 Members and 1 Guest are viewing this topic.

natchos

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
    • Email
Using an untextured or filled shape
« on: October 15, 2012, 11:33:01 am »
Is there any way to, instead of using sf::texture object to create and use a sf::shape, to simply fill the shape with a specified colour and then drawing it to the screen.

Alternatively can you fill a texture object with a single colour instead of loading an image?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Using an untextured or filled shape
« Reply #1 on: October 15, 2012, 11:47:48 am »
Yes that's actually the main purpose of a sf::Shape... ;)
If you use textures you might want to check out sf::Sprite.

To fill a sf::Shape (sf::RectangleShape, sf::CircleShape) just call setFillColor().
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/