|
How to click on a string |
Benji8
Member #16,037
August 2015
|
Hi! I'm trying to write a game using Allegro 4. I would like to make the game start when I click on the string "New Game" but I can't find the functions to do so in the manual. I have already written the code which installs the mouse and writes the string in the center of the screen. |
GullRaDriel
Member #3,861
September 2003
|
There isn't code because it's up to you to build something or use an existing gui library. So, let's say your "New game" text drawing/bitmap is of size textw and texth, and that the starting point of that same "New game" is at X,Y. When the mouse click is caught, just check if the mouse pointer coordinates are inside the box. Assuming you got them assigned in mouse_x and mouse_y, here is some pseudo code:
"Code is like shit - it only smells if it is not yours" |
Benji8
Member #16,037
August 2015
|
Ok! It works now! thank you very much!! |
GullRaDriel
Member #3,861
September 2003
|
You're welcome :-) "Code is like shit - it only smells if it is not yours" |
|