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

Author Topic: Give an Object a graphic  (Read 778 times)

0 Members and 1 Guest are viewing this topic.

Ranzini

  • Newbie
  • *
  • Posts: 2
    • View Profile
Give an Object a graphic
« on: September 28, 2022, 08:50:55 am »
So im new to SFML and im curious if there is a way to give an object, like a rectangle a graphic and make it move by moving the rectangle

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: Give an Object a graphic
« Reply #1 on: September 28, 2022, 09:43:05 am »
If by graphic you mean a texture, then yes, you can set a texture on a RectangleShape or you can also use a Sprite if you just want the shape properties.

See the tutorial section for more information: https://www.sfml-dev.org/tutorials/2.5/graphics-sprite.php
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/