Reading mouse Coords while still seeing Windows pointer.
Posted: Wed Nov 08, 2023 10:27 pm
I am just starting a program that will have a large grid which the user can click, a square will alternate from black to white and back, and basically pixel art aid.
At this early stage, I cannot seem to get the mouse to stay visible, while doing what I require.
With the following program it will keep the mouse pointer visible, but not read its inputs, and if I comment out line 45 (the Releasemouse(#True) line) then the mouse inputs are read correctly, but I no longer see where the mouse is, and won't be able to see which squares I am hovering over.
Any ideas on how to see the mouse pointer moving and also be able to read the inputs from it?
At this early stage, I cannot seem to get the mouse to stay visible, while doing what I require.
With the following program it will keep the mouse pointer visible, but not read its inputs, and if I comment out line 45 (the Releasemouse(#True) line) then the mouse inputs are read correctly, but I no longer see where the mouse is, and won't be able to see which squares I am hovering over.
Code: Select all
#width=1000
#height=1000
spwidth=24
spheight=21
Global.i spBsiz=24
InitMouse()
InitSprite()
InitKeyboard()
OpenWindow(0,10,10,#width,#height,"Sprite Creator")
OpenWindowedScreen(WindowID(0),0,0,#width,#height)
StartDrawing(ScreenOutput())
Box(0,0,#width,#height,#White)
For y=1 To spheight*spBsiz Step 24
For x=1 To spwidth*spBsiz Step 24
Line(x,0,1,y,RGB(0,0,0))
Line(0,y,x,1,RGB(0,0,0))
Next
Next
If MouseButton(#PB_MouseButton_Left )
Circle(MouseX(),MouseY(),100)
EndIf
StopDrawing()
Repeat
ExamineMouse()
mb=MouseButton(#PB_MouseButton_Left)
mx=MouseX()
my=MouseY()
StartDrawing(ScreenOutput())
If mb
Debug mx
Debug my
Circle(MouseX(),MouseY(),100)
EndIf
StopDrawing()
ReleaseMouse(#True)
ExamineKeyboard()
Repeat
Event = WindowEvent()
Select Event
Case #PB_Event_Gadget
If EventGadget() = 0
End
EndIf
Case #PB_Event_CloseWindow
End
EndSelect
Until Event = 0
; FlipBuffers()
If KeyboardPushed(#PB_Key_Escape):quit=1:EndIf
Until quit=1