SFML community forums

Help => General => Topic started by: Ockonal on August 17, 2010, 10:37:41 am

Title: Mouse press event
Post by: Ockonal on August 17, 2010, 10:37:41 am
Hello, I'm writing Application which uses SFML as input system. I use it with Ogre3d  engine. The part of creating sfml-window:
Code: [Select]
size_t mWindowHandle;
ogreWindow->getCustomAttribute("WINDOW", &mWindowHandle);
boost::shared_ptr<sf::Window> = mInputWindow = boost::shared_ptr<sf::Window>( new sf::Window(mWindowHandle) );

And in global update cycle:
Code: [Select]
sf::Event localEvent;

     using namespace Engine::Events;
     sf::Event::EventType type = localEvent.Type;

     if (type == sf::Event::MouseButtonPressed) { cout << "Mouse bbutton pressed!"; }
     else if (type == sf::Event::MouseButtonReleased) { cout << "Mouse button released!"; }

The text never writes to the console. All another events work (I tested key events). Also I could work with input handle mInputWindow->GetInput(). Using it I can show the cursor position, show/hide it, etc. All this stuff works.

I tried to do something like (in global cycle too):        
Code: [Select]
if (mInputWindow->GetInput().IsMouseButtonDown(sf::Mouse::Left))
   cout << "Left mouse button is pressed!";

Thid doesn't work too.
What could it be?