|
Post by NoVaGene on Jul 17, 2004 5:49:31 GMT -5
This is a little demo to illustrate mouse click detection on defined sprite region.
dim StartTexture, sprite, StartCenterX, StartCenterY dim pointerX, pointerY, offsetX, offsetY
ResizeSpriteArea (WindowWidth(),WindowHeight())
StartTexture = LoadTexture ("data\tim.bmp") '256 x 256 sprite = NewSprite (StartTexture) SprScale(1) SprSetColor (1, 1, 1) 'RGB SprSetSize(256, 256)
'init sprite center on the upperleft SprSetXCentre (0) SprSetYCentre (0)
offsetX=128 offsetY=128 StartCenterX = SpriteAreaWidth()/2.0 StartCenterY = SpriteAreaHeight()/2.0 SprSetPos (StartCenterX - offsetX , StartCenterY - offsetY) 'set sprite to centre of window
while true
'update mouse coordinates pointerX = Mouse_X () * SpriteAreaWidth () pointerY = Mouse_Y () * SpriteAreaHeight ()
if Mouse_Button (MOUSE_LBUTTON) then
'detecting mouse click region if pointerX >= StartCenterX - offsetX and pointerX <= StartCenterX + offsetX and pointerY >= StartCenterY - offsetY and pointerY <= StartCenterY + offsetY then locate 1,1: print "Image Clicked" endif endif
wend end
Have fun! ;D
Cheerz! Lucas Tan
|
|
|
Post by GuppyB on Jul 19, 2004 10:45:08 GMT -5
This program works great in a windowed screen but you can't see the pointer when running in fullscreen.
brings up a question.... is it possible to create "standard" mouse pointer visbility when running in fullscreen mode? Is there some sort of on/off toggle?
...G
|
|
|
Post by Candle on Jul 19, 2004 13:26:59 GMT -5
yes samething happen to me in fullscreen .
|
|
|
Post by Supermonkey on Jul 20, 2004 7:39:37 GMT -5
In fullscreen I imagine if you create a mouse pointer image, make it a sprite and position it at the mouse co-ords then you have your mouse pointer ;D
|
|
|
Post by NoVaGene on Jul 20, 2004 9:00:01 GMT -5
|
|