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

Author Topic: Can I create an array list for shapes?  (Read 4025 times)

0 Members and 1 Guest are viewing this topic.

GNRlova23

  • Newbie
  • *
  • Posts: 3
    • View Profile
Can I create an array list for shapes?
« on: March 07, 2013, 12:00:24 am »
I'm still new to C++ and SFML, and I'm trying my best to experiment as much as possible. So yeah, my question is: Is there a way I can create an array (Or array list, I'm not sure of the difference) of shapes?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10988
    • View Profile
    • development blog
    • Email
Re: Can I create an array list for shapes?
« Reply #1 on: March 07, 2013, 12:06:44 am »
Of course there is! ;D
But this isn't strictly connected to SFML, since you can have an array (or better a std::vector) of any type in C++. Since you apparently don't know how to work with them, I strongly advise you to get a good C++ book and read it! ;)
SFML is a nice and Simple library, with a clean API and thus it can mislead beginners into thinking that it's a good starting point to learn C++, but in fact SFML does require a good amount of rock solid C++ knowledge, otherwise you'll get stuck at every other corner.
Also if you wanted to start with a game, you should know that programming games can be one of the harder tasks in programming, since it pulls in all kinds of areas (graphics, algorithms, datastructures, audio, code design, networking, etc. etc.). You should really start of slow and learn the basics of C++ in good fashion before moving on. ;)

sf::Shape shapes[20];
// or better use a std::vector
std::vector<sf::Shape> shapes(20);
« Last Edit: March 07, 2013, 12:31:21 am by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

GNRlova23

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Can I create an array list for shapes?
« Reply #2 on: March 07, 2013, 12:17:46 am »
I think you're absolutely right. Thanks for directing me to the right website too. I've actually just started programming just out of pure interest, using free online tutorials. But I definately will check out these books. Thanks once again  :D

 

anything