Mice! where is it :-D?

BlitzPlus Forums/BlitzPlus Programming/Mice! where is it :-D?

When using a fullscreen display, not Windowed, you need to manually display and keep track of the mouse position and click-area.

Whats the best method? and smoothest and fastest?

Ptr = LoadImage("pointer.bmp")
While Not KeyDown(1)
  Cls
  DrawImage Ptr,MouseX(),MouseY()
Wend

What do you mean by "click area"?

I mean the "pixel" hot-spot (or corner) that activates a button for example

In addtion to gkf's code, get a really small image, like 1x1, and position it at the end of the pointer. When doing collisions with the pointer, use the small image, instead of the pointer image. :)

@Ross C

But ... WHY?

Well, that's your pixel hot spot. The very small image to the tip of the pointer :)

@Ross C

ahh, got it!

You can also make a function that checks whether or not the pointer is within a given rect when the mouse button is clicked. Something like this:

mx = mousex()
my = mousey()
if mousehit(1) then
   if mx > 100 and mx < 200 and my > 50 and my < 70 then doSomething1()
   if mx > 100 and mx < 200 and my > 80 and my < 100 then doSomething2()
end if


You can also make a function that checks whether or not the pointer is within a given rect when the mouse button is clicked.
I wrote a set of functions to do that, utilising banks. Here's a better version by somebody else, based on my original code.