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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - idan_marciano

Pages: [1]
1
Graphics / Re: check if mouse clicked on sprite.
« on: May 18, 2017, 07:26:58 pm »
Thank alot .. used the second option..

2
Graphics / Re: check if mouse clicked on sprite.
« on: May 18, 2017, 08:45:39 am »
The get global bounds gives me the blocked rectangle aligend with axis.
The stick is not aligend to axis so when i press at coordinets near the stick the blocked rectangle
Contain the (x,y) of mouse location  and its not the currect answer so how i can get the tranformed rectangle and check if the transformed rect is containing the (x,y).


Thanks.

3
Graphics / check if mouse clicked on sprite.
« 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);

Pages: [1]