How to strike through text in Allegro and make it highlighted

Started by
0 comments, last by jnbutler 16 years, 6 months ago
Hello I'm making a simple 2d game in Allegro and I'm working on the menu right now and I need to know how to do 2 things. First is have some function that knows when the mouse is on the text that I have drawn on the menu, and when the mouse is on the specific text there's some type of highlighted strike through the text. Does anyone know how to do this, or find a place that will show me this, or is it even possible in Allegro? Thanks, Numb3rz
Advertisement
All you have to do is create a function and pass it the boundary of the rectangle that surrounds the text. Inside the function you check to see if the mouse is inside that boundary. If it is you return 1, if not return 0.

In the loop you check the boundaries of each menu item you want to highlite when the mouse is on it and if it returns 1 you highlite that rect boundary, if not do nothing. If you use -1 for the bg argument of your text output function to draw the text it should stay there when you highlite the rectangle around it. You may have to experiment with it a little to get it to work correctly.

Hope that helps.

jnbutler

This topic is closed to new replies.

Advertisement