tags:

views:

64

answers:

1

I'm new to programming. I want to make a card game with C++ / Allegro. The graphics api is irrelevant though. I want it to have many buttons you can click. I'm wondering the proper way this is done. For instance, how does windows know which control you click on from your cursor. I would use an array of rectangles and check each rectangle to ee if my mouse is is 1 of their bounds, but this doesn't seem very good. What about if I draw a line from 2 points and want to be able to drag any part of the line? I doubt i'm doing this right either. Any insight on this would be very helpful. Thanks

A: 

Basically, you want to make a mouse-driven user interface. This is very difficult to do from scratch, that's why Allegro has a built-in GUI system. If you don't like it, you'd better use a GUI library than doing it yourself.

I'd recommand MasKing, it's an add-on for Allegro, to write graphical interfaces in C++.

Samuel_xL