SFML community forums
Help => System => Topic started by: amdlintuxos on June 25, 2011, 10:27:58 pm
-
Greeting all.
Actually that is not a big issue (code works fine), but compiler(g++) gives me a warnings and i have feeling that i am doing something not exactly correct.
if (g_EVENT.Type == sf::Event::MouseButtonPressed)
{
if (g_EVENT.Key.Code == sf::Mouse::Left)
g_MOUSE_LEFT_BUTTON = true;
if (g_EVENT.Key.Code == sf::Mouse::Right)
g_MOUSE_RIGHT_BUTTON = true;
}
And here what compilers says.
keyEventsInSpace.cpp:190:47: warning: comparison between ‘enum sf::Key::Code’ and ‘enum sf::Mouse::Button’
keyEventsInSpace.cpp:193:47: warning: comparison between ‘enum sf::Key::Code’ and ‘enum sf::Mouse::Button’
I know that is just a warnings and i may switched off those, but i am new in C++ and want to learn how to do things right.
Many thanks for attention in advance.
-
Event.Key is for KEYBOARD events, not Mouse events. Use Event.MouseButton instead.
-
OniLink10
Thanks, that solved my problem.
if (g_EVENT.MouseButton.Button == sf::Mouse::Left)