Sign in to follow this  

need help with mouse in allegro

Recommended Posts

I'm very new to Allegro, and trying to learn. I am creating a test game, and I need to create some buttons for the user to click on with the mouse. So I drew the button to the screen (as a sprite), enabled the mouse, and tried to create a make-shift if statement to say "if the mouse is over this certain area (the button area), and the button is this." the problem is that my code looks very tacky, and I cant really get it to detect there the button is. I think I'm going into this a$$-backward. Is there a better way to do what I'm trying to do? Thanks :) code: show_mouse(screen); draw_sprite( screen, button, 410, 215); while ( !key[KEY_ESC] ){ if(mouse_x >= 410 && mouse_x <= 430 && mouse_y >= 215 && mouse_x <= 220){ **DO THIS** } }

Share this post

Link to post
Share on other sites

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