Hi guys!
Firstly, I'm going to say that this is my first time with any C++ graphic design/non-algorithmic projects and I must say SFML makes it so enjoyable.
However, I have indeed hit a wall that I hope to break with you.
Project description:
The project must be something like
blockly.com, where users can choose from a set of pieces and be able to build a working algorithm if placed in good order. I have all the algorithmic part of the project somewhat done but I'm lacking a bit with the graphic part, mainly the main "work-area" where you can add/delete/move pieces.
My idea:
Make an array of abstract shapes that can be later transformed in the 3 types I'm using: Circle, Rectangle, Convex;
My problem:
How can I make an entity with no specific name that I can access anytime? Making an array of shapes
std::vector<sf::Shape>shapes(101)
and then going thru it like:
shape[i] = new sf::RectangleShape
won't do the deal.
Final result:
Ideally, my project should have a large array/vector of shapes that are freely movable on the work area. I could remodel all the shapes to use the sf::ConvexShape class but I would miss an important part of learning.
P.S: While I'm here, if you can help me understand how can I check if I clicked on a certain entity and add accordingly ( aka drag&drop / make connections if you press on 2 different pieces ) I would appreciate it enormly!
P.S 2: Should I create a new class for each shape (aka a custom shape) so I can hold multiple information in it? Some pieces should have editable text inside them.
If you need any more info on the subject or if I wasn't clear enough please. If I can use as little OOP as possible that would be amazing too!