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

Author Topic: sf::Mouse mouse; gives an error  (Read 542 times)

0 Members and 1 Guest are viewing this topic.

antinoid

  • Newbie
  • *
  • Posts: 8
    • View Profile
sf::Mouse mouse; gives an error
« on: May 15, 2023, 07:56:30 pm »
Currently, I'm using SFML 3.0.0 and it seems that I can't do
sf::Mouse mouse;

anymore, does this mean any time I want to call a method such as mouse.getPosition() I will need to call sf::Mouse::getPosition() instead?

Is there any alternative?

Thanks!

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: sf::Mouse mouse; gives an error
« Reply #1 on: May 15, 2023, 08:56:05 pm »
From 2.5.1's documentation:
It only contains static functions (a single mouse is assumed), so it's not meant to be instantiated.

Which means we should never have been doing:
sf::Mouse mouse;

You are right, though. The correct way to do it is simply:
sf::Mouse::getPosition();
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything