Where is the mouse? Any tips?

Just starting out? Need help? Post your questions and find answers here.
aisman
New User
New User
Posts: 7
Joined: Thu Nov 13, 2003 7:48 am

Where is the mouse? Any tips?

Post by aisman »

Hello,
Where is the mouse? Any tips?

Thanks.

Code: Select all

InitMouse() 
InitSprite()
InitKeyboard() 

xscreen = 150 
yscreen = 150 

WindowID = OpenWindow(0, 30, 30, xscreen, yscreen, #PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_MinimizeGadget,"") 
OpenWindowedScreen(WindowID, 0, 0, xscreen, yscreen, 0, 0, 0) 

Repeat  
  ExamineKeyboard()
  If KeyboardPushed(#PB_Key_Escape)
    End
  EndIf
  ExamineMouse()
  StartDrawing(ScreenOutput())   
    Circle(MouseX(),MouseY(),3,RGB(100,100,100)) 
  StopDrawing()                  
  FlipBuffers()
  Delay(10)
ForEver 
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

you mean the mousepointer?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
aisman
New User
New User
Posts: 7
Joined: Thu Nov 13, 2003 7:48 am

Post by aisman »

I see you understand me ;-)
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

haven't done anything in that direction yet, but i have a feeling it's not supposed to be there, i could be wrong though
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
benny
Enthusiast
Enthusiast
Posts: 465
Joined: Fri Apr 25, 2003 7:44 pm
Location: end of www
Contact:

Post by benny »

Hmm .. maybe this helps (avoid ExamineMouse() ) :?:

Code: Select all

InitMouse() 
InitSprite() 
InitKeyboard() 

xscreen = 150 
yscreen = 150 

WindowID = OpenWindow(0, 30, 30, xscreen, yscreen, #PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_MinimizeGadget,"") 
OpenWindowedScreen(WindowID, 0, 0, xscreen, yscreen, 0, 0, 0) 


Repeat  

  Select WindowEvent() 
    Case #WM_CLOSE
         End
   EndSelect
      
  ExamineKeyboard() 
  If KeyboardPushed(#PB_Key_Escape) 
    End 
  EndIf 

    GetCursorPos_(CursorPosition.POINT) 
    MouseX = CursorPosition\x - WindowX()
    MouseY = CursorPosition\y - WindowY() - 20 

  StartDrawing(ScreenOutput())    
    Circle(MouseX,MouseY,3,RGB(100,100,100)) 
  StopDrawing()                  
  FlipBuffers() 
  Delay(10) 
ForEver 
regards,
benny!
-
pe0ple ar3 str4nge!!!
aaron
Enthusiast
Enthusiast
Posts: 267
Joined: Mon Apr 19, 2004 3:04 am
Location: Canada
Contact:

Post by aaron »

You can use this:

ShowCursor_(1) ; display the mouse pointer

You'll see that it looks busy all the time though (as an hourglass)... I'll still puzzling thru this windows stuff too, but it looks like you need to check window events even if you aren't going to us them.... I call a WindowEvent() command right around the delay command also.

Updated code:

Code: Select all

InitMouse()
InitSprite()
InitKeyboard()

xscreen = 150
yscreen = 150

WindowID = OpenWindow(0, 30, 30, xscreen, yscreen, #PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_MinimizeGadget,"")
OpenWindowedScreen(WindowID, 0, 0, xscreen, yscreen, 0, 0, 0)

ShowCursor_(1) ; display the mouse pointer

Repeat 
  ExamineKeyboard()
  If KeyboardPushed(#PB_Key_Escape)
    End
  EndIf
  ExamineMouse()
  StartDrawing(ScreenOutput())   
  Circle(MouseX(),MouseY(),3,RGB(100,100,100))
  StopDrawing()                 
  FlipBuffers()
  Delay(10) : WindowEvent()
ForEver 
I don't know if this is the right way to do it, but it's been working for me thus far.... :P
Post Reply