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

Author Topic: [Closed] Multiplication and division assignement operators on Vector  (Read 5746 times)

0 Members and 1 Guest are viewing this topic.

DragonRock

  • Newbie
  • *
  • Posts: 14
    • View Profile
Hi !

This feature would not bring much but I feel like it would make sense to have the operators *= and /= between two vectors. Currently, we can do this:

Code: [Select]
sf::Vector2f v1(1.0, 2.0);
sf::Vector2f v2(1.0, 2.0);
v1 = v1 * v2;

but we can't do this

Code: [Select]
sf::Vector2f v1(1.0, 2.0);
sf::Vector2f v2(1.0, 2.0);
v1 *= v2;

Is there any reason for this ?

Thank you in advance.
« Last Edit: November 06, 2017, 03:22:56 pm by tforgione »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Multiplication and division assignement operators on Vector
« Reply #1 on: November 06, 2017, 02:59:27 pm »
Please use the search function, this has been discussed so many times already.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

DragonRock

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Multiplication and division assignement operators on Vector
« Reply #2 on: November 06, 2017, 03:19:49 pm »
I tried to search the forum for "Multiplication", "Multiply" and "Multiply Assignement", and it didn't find anything. But apparently, if I click on search again, it finds result (which I didn't know before creating this feature request, sorry about that).

Anyway, after re-reading the docs, and reading the related posts, I understand why you don't want to make this function.

Sorry for the inconvenience.
« Last Edit: November 06, 2017, 03:23:52 pm by tforgione »

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Re: [Closed] Multiplication and division assignement operators on Vector
« Reply #3 on: November 06, 2017, 03:40:20 pm »
The forum search is context-sensitive. That means when you search from the "Feature requests" board, the other boards are not searched.

DragonRock

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: [Closed] Multiplication and division assignement operators on Vector
« Reply #4 on: November 06, 2017, 03:57:13 pm »
Oh I see. Thanks for the information.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: [Closed] Multiplication and division assignement operators on Vector
« Reply #5 on: November 07, 2017, 12:28:14 am »
Just to clarify your original post a little:
Code: [Select]
sf::Vector2f v1(1.0, 2.0);
sf::Vector2f v2(1.0, 2.0);
v1 = v1 * v2;
is not possible.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

DragonRock

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: [Closed] Multiplication and division assignement operators on Vector
« Reply #6 on: November 07, 2017, 10:30:01 am »
Yes, this is why I edited the post to strike the "Currently we can do".

I thought we could multiply vectors using operator* between two vectors, but not using the *= operator, so I thought that it was weird.

I initially thought that because the rust-sfml binding allows multipliying two vectors together (and also has some other operators such as vector + number, etc...)