i have a routine to click (left mouse click) an specific point and an image moves to this new position.
now what i need is to assign an animated image to the traditional mouse image (static white arrow).
in short, i want to replace the traditional static white arrow of the mouse for a new animated pointer.
is this possible?
Typed straight into replybox, so untested:
Graphics 800,600
HidePointer
SetBuffer Backbuffer()
Global imgMouse = LoadAnimImage("mouseimage.png",16,16,0,4)
Global mouseFrame = 0
While Not KeyDown(1)
Cls
DrawMouse()
Flip
Wend
Function DrawMouse()
DrawImage imgMouse,MouseX(),MouseY(),mouseFrame
mouseFrame = mouseFrame + 1
if mouseFrame > 3 Then MouseFrame = 0
End Function
i am sorry for this ne stupid question, but i tried to use it with an image called "mouseimage.png" wich is 16x48 (3 frames horizontaly) but it says "Image frame out of range" :(
do you know how to make it work? or am i doing something wrong?
thanks for your patience :)
Just change to this:
Global imgMouse = LoadImage("mouseimage.png")
Edited: for non animated, and what PCD says for animated
LoadAnimImage("mouseimage.png",16,16,0,3)
That should work, if it doesn't add a few more pixels to the end of the image strip.
you might have also needed to change the DrawMouse() function to say
If mouseFrame > 2 Then mouseFrame = 0
so that it doesn't go past frame 2 (0,1,2 = 3 frames)
excellent! it worked like a charm!
this is the final code:
Graphics 800,600
HidePointer
SetBuffer BackBuffer()
Global imgMouse = LoadAnimImage("mouseimage.png",16,16,0,3)
Global mouseFrame = 0
While Not KeyDown(1)
Cls
DrawMouse()
Flip
Wend
Function DrawMouse()
DrawImage imgMouse,MouseX(),MouseY(),mouseFrame
mouseFrame = mouseFrame + 1
If mouseFrame > 2 Then MouseFrame = 0
End Function
thanks a lot!
B!