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

Author Topic: Mouse press event  (Read 2228 times)

0 Members and 1 Guest are viewing this topic.

Ockonal

  • Jr. Member
  • **
  • Posts: 58
    • ICQ Messenger - 449909010
    • View Profile
    • WinCode
Mouse press event
« 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;

while(mInputWindow->GetEvent(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?
Developing 2d engine&game using: sfml, box2d, librocket, spark2, zoom&zoost, thor

 

anything