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

Author Topic: Shape / Polygon like in 1.6?  (Read 2706 times)

0 Members and 3 Guests are viewing this topic.

thewavelength

  • Newbie
  • *
  • Posts: 4
    • View Profile
Shape / Polygon like in 1.6?
« on: May 22, 2012, 06:25:06 pm »
Hello,
why there is no simple polygon / shape object available in 2.0? (Like it was in 1.6)

Is there an alternative? :-)
Thanks!

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re: Shape / Polygon like in 1.6?
« Reply #1 on: May 22, 2012, 06:47:31 pm »
sf:Shape ?
Yes, it changed since 1.6, but for the best :D

thewavelength

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Shape / Polygon like in 1.6?
« Reply #2 on: May 22, 2012, 06:49:40 pm »
Yes,
but I don't see how I can add some points to the shape?
Let's say, I want to create a hexagon. How I should gonna do that?

Thanks :->

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re: Shape / Polygon like in 1.6?
« Reply #3 on: May 22, 2012, 06:54:43 pm »
You have different ways :
If you need a pre-defined shape (rectangle, circle) you can find tose classes that inherits from sf::Shape
If you need another convex shape, use sf::ConvexShape. This class is full documented if you wanna know how to add points, set colors, etc...

Edit: If you want a concave shape, you can look at Thor implementation.
« Last Edit: May 22, 2012, 06:56:51 pm by Lo-X »

thewavelength

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Shape / Polygon like in 1.6?
« Reply #4 on: May 22, 2012, 07:41:38 pm »
Well, thanks.
Sorry, next time I look into the documentation more detailed. Last time I've used 2.0 is a bit ago, and if I remember correctly, there was no ConvexShape :X

Thanks :->

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re: Shape / Polygon like in 1.6?
« Reply #5 on: May 22, 2012, 08:56:53 pm »
Well, thanks.
Sorry, next time I look into the documentation more detailed. Last time I've used 2.0 is a bit ago, and if I remember correctly, there was no ConvexShape :X

Thanks :->

Yeah, I understand that this change can be a bit confusing ;D

thewavelength

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Shape / Polygon like in 1.6?
« Reply #6 on: May 22, 2012, 11:00:42 pm »
Am I right that Thor 1.1 is incompatible with the 2.0 release?
If I'm incorrect, can you give me an example of how to create a concave shape?
I don't understand why thor::ConcaveShape is an abstract class...

Thanks!

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re: Shape / Polygon like in 1.6?
« Reply #7 on: May 22, 2012, 11:07:35 pm »
Am I right that Thor 1.1 is incompatible with the 2.0 release?
If I'm incorrect, can you give me an example of how to create a concave shape?
I don't understand why thor::ConcaveShape is an abstract class...

Thanks!

There is a version 2 in development, I don't know if it is fully stable since it is in development, but if I'm not mistaken it's compatible with 2.0
I can't say for sure how to implement such a class, but it might be a file somewhere in the 2.0 snapshot that contain the implementation of ConcaveShape (a .cpp or .inl) [Nexus will slap me if I'm wrong :p]

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Shape / Polygon like in 1.6?
« Reply #8 on: May 25, 2012, 07:31:35 pm »
The Thor development version should be compatible with SFML 2.0 RC (or the Git version, if I remember correctly there are no API changes).

thor::ConcaveShape is not abstract. There is the documentation (the class interface is quite similar to sf::ConvexShape) on my website (www.bromeon.ch/libraries/thor) and an example in the SDK, which is downloadable via GitHub.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: