Making A Button

Blitz3D Forums/Blitz3D Programming/Making A Button

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Ok, below should help you. It takes the mousex() and mousey() co-ord, with a width and height of 1, to give the point/cursor an action point. Depending on your image this might not be good enough. Depends on what part of the cursor you want to actually do the selecting.

Anyway, look at the rectsoverlap command. Takes a first x,y cord then first width, and checks for overlaps with a second x,y and height and width. The If checks first for a keypress THEN checks for an overlap.

If Mousehit(1) then ; if left click
   ; BELOW \/ if the mouse co-ords, overlap the images dimensions (NOT pixel perfect)
   If rectsoverlap(mousex(),mousey(),1,1 , image_x,image_y,imagewidth(image),imageheight(image) ) then
      ;Perform action here
   End if
End if