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

Author Topic: Tuple -> sf::Vector  (Read 4956 times)

0 Members and 1 Guest are viewing this topic.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Tuple -> sf::Vector
« on: February 11, 2010, 03:07:58 pm »
Hey,

currently PySFML uses tuples for representing sf::Vector* objects. I discussed that with someone (pekuja) some weeks before (sorry for that, got less time ;)) and we came up with the idea to implement sf::Vector* classes in PySFML, too. There're mainly two reasons:
  • Tuples are immutable, meaning you just can't change its elements. This is unfavorable because you often want to change only the x or y component of a vector without creating new tuples.
  • Naming conventions would be better. Instead of pos[0] and pos[1] you'd have pos.x and pos.y


Open for comments. :)

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Tuple -> sf::Vector
« Reply #1 on: February 13, 2010, 06:43:42 pm »
Okay, so if nobody has something to complain about, I'll implement it. ;)

remi.k2620

  • Full Member
  • ***
  • Posts: 186
    • View Profile
    • http://remi.tuxfamily.org
Tuple -> sf::Vector
« Reply #2 on: February 14, 2010, 01:04:33 pm »
That's a great idea.
I wanted to do it but never had enough motivation. I think the constructor should be able to take any object that has x and y attributes and tuples of length 2.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Tuple -> sf::Vector
« Reply #3 on: February 14, 2010, 01:49:10 pm »
For virtualising the template class? I agree. :) I'll create a draft and see if it works out.