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

Author Topic: Input.GetMouseX and MouseY not returning anything? (SOLVED)  (Read 2022 times)

0 Members and 1 Guest are viewing this topic.

Portalboat

  • Newbie
  • *
  • Posts: 9
    • View Profile
Input.GetMouseX and MouseY not returning anything? (SOLVED)
« on: February 04, 2011, 05:13:15 am »
Code: [Select]
sf::Input Input;
sf::Input &rInput = Input;
TowerManager TowerManager;
sf::Event Event;
int mouseX;
int mouseY;
// Start game loop
    while (App.IsOpened())
    {
mouseX = Input.GetMouseX();
mouseY = Input.GetMouseY();


That's just a fragment of a code, obviously, but the point's still there. When I output mouseX and mouseY (through cout), it says that they're zero. And the function I need to use them for confirms this; it also outputs zero.

Is this just a bug in the code, or am I doing something really stupid?

Walker

  • Full Member
  • ***
  • Posts: 181
    • View Profile
Input.GetMouseX and MouseY not returning anything? (SOLVED)
« Reply #1 on: February 04, 2011, 06:14:36 am »
Try getting your Input instance in the while loop and from the window.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Input.GetMouseX and MouseY not returning anything? (SOLVED)
« Reply #2 on: February 04, 2011, 07:35:27 am »
You need to call GetEvent so that inputs are processed.
Laurent Gomila - SFML developer