3
« on: May 17, 2017, 10:45:29 pm »
helllo,
i am trying to make "pick a stick" game. and i have some problem recognize the specefic stick i press with the mouse.
i have created few sprite each of them is a stick(each of them have a diffrent angle).
i am trying to click on one of them and recognize them with out the blocking rectangle aligned to axis's.
in general i am trying to write somethin like this:
Vector2f mouse_location((float)event.mouseButton.x, (float)event.mouseButton.y);
m_graph.eventHandler(mouse_location);
....
-----event handler function-------
vector<Stick>::iterator stick = m_sticks.begin();
for (; stick != m_sticks.end(); ++stick)
{
if ((*stick).isContain(mouse_location))
do something....
}
-----is contain function-------
return m_sprite.getGlobalBounds().contain(mouse_location);