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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dontpanic

Pages: [1]
1
SFML website / Multiplication Operator in Handling time Tutorial
« on: August 16, 2020, 02:44:56 pm »
Hello all,

I'm new to C++ and SFML, so going through the tutorials. While playing with the concepts introduced in the "Handling time" tutorial, I got a build error when writing similar code as in the tutorial.

The tutorial presents the code:
sf::Time t1 = ...;
sf::Time t2 = t1 * 2;
Based on that I wrote the code:
sf::Time t = sf::milliseconds(1000);
sf::Time t2 = t * 2;

My code gave me an error: more than one operator "*" matches these operands.

Creating an Int64 object makes explicit the operator definition to use:
sf::Time t = sf::milliseconds(1000);
sf::Int64 multiplier = 2;
sf::Time t2 = t * multiplier;

Just wanted to understand if it's me doing something wrong (the most likely scenario) or if the tutorial is meant to be more pseudocode and I am taking it too literally since the build error is expected in that code.

Thank you in advance and sorry in advance if this thread is misplaced in this forum.

Pages: [1]
anything