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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - calibru99

Pages: [1]
1
Graphics / Re: Rotate a Image around its center/Axis
« on: January 05, 2021, 12:14:55 am »
Dunno if this helps but when I first had this problem my main issue was that i was drawing the certain piece and setting its position/origin inside a loop. this resulted in the fact that with every loop iteration the origin/position of it would shift, as i was setting the origin everytime.
long story short: set the origin in another part other than where you loop thru and draw the shape, this way the rotation will work 100%

2
Graphics / Array of different Shapes
« on: January 05, 2021, 12:09:01 am »
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!

Pages: [1]