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

Author Topic: event on a clic on a Shape  (Read 1442 times)

0 Members and 1 Guest are viewing this topic.

GabrielS

  • Newbie
  • *
  • Posts: 25
    • View Profile
event on a clic on a Shape
« on: May 31, 2013, 03:03:30 pm »
Hello guys !

I am new to SFML ( how come I didn't know about it before :P ), and looking at the documentation + some topics on the forum, I didn't find function that permits to get an event if the user clicks on a ConvexShape.
If you have any idea/solution, I would like to have advices.
( I've seen the function getGlobalBounds, But I'd rather have the shape itself and not a rectangle containing the shape ).

Thanks in advance,

Gabriel.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: event on a clic on a Shape
« Reply #1 on: May 31, 2013, 03:09:23 pm »
There's no built-in function for that, you have to write it yourself. There are two algorithms that can be used for the point-in-convex test, I'm sure Wikipedia or Google know them ;)
Laurent Gomila - SFML developer

JayArby

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: event on a clic on a Shape
« Reply #2 on: May 31, 2013, 11:10:53 pm »
FYI, after a convex shape (or anything else) is drawn on the screen, SFML (or the window or anything else) is not aware that there is a shape there. This is something you would have to write the framework for. SFML just deals with the multimedia aspects of your application; it does not provide the whole structure that would be required for what you are suggesting.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: event on a clic on a Shape
« Reply #3 on: June 01, 2013, 09:07:15 am »
Quote
FYI, after a convex shape (or anything else) is drawn on the screen, SFML (or the window or anything else) is not aware that there is a shape there. This is something you would have to write the framework for. SFML just deals with the multimedia aspects of your application; it does not provide the whole structure that would be required for what you are suggesting.
Well, the ConvexShape class knows about its points, so the structure is already there. All he needs is the algorithm.
Laurent Gomila - SFML developer

 

anything