SFML community forums

Help => Window => Topic started by: Portalboat on February 04, 2011, 05:13:15 am

Title: Input.GetMouseX and MouseY not returning anything? (SOLVED)
Post by: Portalboat 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?
Title: Input.GetMouseX and MouseY not returning anything? (SOLVED)
Post by: Walker on February 04, 2011, 06:14:36 am
Try getting your Input instance in the while loop and from the window.
Title: Input.GetMouseX and MouseY not returning anything? (SOLVED)
Post by: Laurent on February 04, 2011, 07:35:27 am
You need to call GetEvent so that inputs are processed.