How can I define lines so when I click on the screen, my program knows whether I clicked on A B or C?

  • Sort the shapes front to back. For each shape you check whether the point is inside or not:

    Check for intersections between each edge of the shape, and an edge running from the point you’re testing to infinity in any direction. For example 10000 units along the x axis. If the total number of intersections is odd, then the point is inside the shape.