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

Author Topic: parameter for nbSegments in Circle()  (Read 2160 times)

0 Members and 1 Guest are viewing this topic.

vincentrevelations

  • Newbie
  • *
  • Posts: 7
    • View Profile
parameter for nbSegments in Circle()
« on: November 02, 2010, 08:24:13 pm »
This is a simple one.

When using Circle() to define a shape, it always has 40 segments.
That's good for most circles, but way too much for small circles (slow performance) and way too few for big circles (looks ugly).

Why don't you add an overload for Circle with an extra parameter for the number of segments?

This should not cause any conflicts with existing projects.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6275
  • Thor Developer
    • View Profile
    • Bromeon
parameter for nbSegments in Circle()
« Reply #1 on: November 03, 2010, 09:11:58 pm »
I have already wondered about the magic number 40, too. ;)

Another option would be to adapt the number of points to the radius. If one scales up a small circle, he probably accepts a worse appearance.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

NoIdea

  • Full Member
  • ***
  • Posts: 149
    • View Profile
parameter for nbSegments in Circle()
« Reply #2 on: November 03, 2010, 09:41:58 pm »
I think having a default parameter equal to 40 is good. However, I think the user should be able to decide how many he wants : what if you make a game and you set the number of sides depending on the FPS of the game : you put it to high/low quality. This lets you create a game that will work (but look ugly) on poor computers and the same game that will also work (and look great) on a good computer.

vincentrevelations

  • Newbie
  • *
  • Posts: 7
    • View Profile
parameter for nbSegments in Circle()
« Reply #3 on: November 03, 2010, 10:37:25 pm »
(dynamically or otherwise) changing the number of segments according to the radius or the performance is all stuff we can easely implement when there's that extra parameter overload ;)

if implemented correctly in the sfml libs, it's only about 5 more lines of code, and one extra function overload. you can easely do this yourself if you downloaded the sources for smfl and compiled it.

NoIdea

  • Full Member
  • ***
  • Posts: 149
    • View Profile
parameter for nbSegments in Circle()
« Reply #4 on: November 03, 2010, 10:39:17 pm »
That's exactly what I mean...