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

Author Topic: drawing a pointer to a sprite  (Read 1446 times)

0 Members and 1 Guest are viewing this topic.

KarmaKilledtheCat

  • Newbie
  • *
  • Posts: 23
    • View Profile
    • Email
drawing a pointer to a sprite
« on: August 27, 2013, 02:17:58 am »
I need to store sprites in a vector but with what I'm trying to do I need to use a vector of pointers to sprites. When I try to draw the pointer to the sprite I get a compile error saying that the Window.Draw() function cannot take a pointer to a sprite. Does anyone know a way to draw a pointer to a sprite?

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: drawing a pointer to a sprite
« Reply #1 on: August 27, 2013, 03:02:48 am »
Can't you just dereference the pointer?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: drawing a pointer to a sprite
« Reply #2 on: August 27, 2013, 03:37:42 am »
Are you sure that you need to use a vector of pointers? If so, I hope the pointers do not own the object, otherwise you should really use smart pointers.

And yes if you get a pointer of a sprite from a vector, you'll simply have to dereference it.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/