Mice! where is it :-D?

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

Hansie(Posted 2003) [#1]
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?


GfK(Posted 2003) [#2]
Ptr = LoadImage("pointer.bmp")
While Not KeyDown(1)
  Cls
  DrawImage Ptr,MouseX(),MouseY()
Wend

What do you mean by "click area"?


Hansie(Posted 2003) [#3]
I mean the "pixel" hot-spot (or corner) that activates a button for example


Ross C(Posted 2003) [#4]
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. :)


Hansie(Posted 2003) [#5]
@Ross C

But ... WHY?


Ross C(Posted 2003) [#6]
Well, that's your pixel hot spot. The very small image to the tip of the pointer :)


Hansie(Posted 2003) [#7]
@Ross C

ahh, got it!


Bremer(Posted 2003) [#8]
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



GfK(Posted 2003) [#9]
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.