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

Author Topic: Spirograph  (Read 4713 times)

0 Members and 1 Guest are viewing this topic.

4B

  • Newbie
  • *
  • Posts: 20
    • View Profile
Spirograph
« on: April 14, 2014, 09:47:57 pm »
In the last two days I programmed a little spirograph made in C++, SFML.

For now I can't show you my code, because it's looking awful, but I made a little video of the spirograph in action. Please forgive me for the bad quality, it's my very first video and I just made it in 5 minutes.




If somebody wants to see the code just tell me and I'll put it on github after refactoring.
If you're going to response to any of my comments, please avoid this smily: ";)"

I'd be grateful, thanks.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Spirograph
« Reply #1 on: April 15, 2014, 01:04:18 pm »
Cool idea! I like how the SFML project section has more and more variety :)

You probably rotate every "stick" with a certain angular velocity relative to its parent? Do you draw to a render texture or how are the pixels stored?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Geheim

  • Full Member
  • ***
  • Posts: 201
    • View Profile
    • Email
Re: Spirograph
« Reply #2 on: April 15, 2014, 02:15:31 pm »
Very well done, it looks great!
It's indeed fascinating how SFML is used in so many ways ;)

Are you going to work more on this project? Maybe adding some kind of user interface to manipulate it in realtime?

Anyways thanks for sharing and keep it up!
Failing to succeed does not mean failing to progress!

4B

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Spirograph
« Reply #3 on: April 15, 2014, 04:02:10 pm »
I'm glad you like it.

@Nexus Almost. A random-number-generator defines of how many "sticks"(havn't got a better word, too) the whole arm consists. Then the program defines a specific length and anglePerSec for every stick with a random-generator, too. So the sticks don't depend on each other. The calculations are a bit harder. For every stick you need to calculate the rotation. The next arm will be connected to the first and also rotates with the specific anglePerSec-speed.

Every frame I'm drawing a line between the previous tip of the arm and the current tip of the arm. Then the program draws the line to a RenderTexture which gets displayed.


@Geheim I'm going to add a UI and I'm planning to implement screenshots so the program can fill a gallery with the screens automatically.
« Last Edit: April 15, 2014, 04:07:37 pm by 4B »
If you're going to response to any of my comments, please avoid this smily: ";)"

I'd be grateful, thanks.

 

anything