Sign in to follow this  

How to strike through text in Allegro and make it highlighted

This topic is 3724 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 3724 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this