Hello!!!
I am developing a game.
How do I show the mouse pointer in a full screen?
Then, how do I hide it?
I have been looking at the help files, but I can't find it.
Thanks!
Kind regards,
      >Marco A.G.Pinto
        ---------------
			
			
									
									
						Show mouse pointer in a full screen
- marcoagpinto
 - Addict

 - Posts: 1076
 - Joined: Sun Mar 10, 2013 3:01 pm
 - Location: Portugal
 - Contact:
 
- netmaestro
 - PureBasic Bullfrog

 - Posts: 8452
 - Joined: Wed Jul 06, 2005 5:42 am
 - Location: Fort Nelson, BC, Canada
 
Re: Show mouse pointer in a full screen
I would use my own pointer sprite and after ExamineMouse() use:
			
			
									
									Code: Select all
If i_want_to_display_the_mousepointer
  DisplaySprite(mousepointer, MouseX(), MouseY())
Endif
BERESHEIT
						- marcoagpinto
 - Addict

 - Posts: 1076
 - Joined: Sun Mar 10, 2013 3:01 pm
 - Location: Portugal
 - Contact:
 
Re: Show mouse pointer in a full screen
I don't know how to associate a GrabImage to a Sprite.
I have been grabbing little images from a big image and I want to associate some with sprites.
see the example: http://i.imgur.com/OqDZMvi.png
I want to assign image 20912 to the sprite of the mouse.
Thanks for all the help!
Kind regards,
>Marco A.G.Pinto
---------------
			
			
									
									
						I have been grabbing little images from a big image and I want to associate some with sprites.
see the example: http://i.imgur.com/OqDZMvi.png
I want to assign image 20912 to the sprite of the mouse.
Thanks for all the help!
Kind regards,
>Marco A.G.Pinto
---------------
- netmaestro
 - PureBasic Bullfrog

 - Posts: 8452
 - Joined: Wed Jul 06, 2005 5:42 am
 - Location: Fort Nelson, BC, Canada
 
Re: Show mouse pointer in a full screen
The arrow in that image isn't too clean, I wouldn't use it. If you're on windows you can try this, otherwise I'd get another arrow image from somewhere else.
			
			
									
									Code: Select all
; Get a cursor image to use
CreateImage(0, 32, 32, 32, #PB_Image_Transparent)
hdc = StartDrawing(ImageOutput(0))
  DrawingMode(#PB_2DDrawing_AllChannels)
  DrawIconEx_(hdc,0,0,LoadCursor_(0,#IDC_ARROW),32,32,0,0,#DI_NORMAL)
StopDrawing()
; Get our environment going
InitSprite():InitMouse():InitKeyboard()
OpenScreen(1024,768,32,"Test Pointer")
; Affect cursor image to a sprite
s_pointer = CreateSprite(#PB_Any, 32, 32, #PB_Sprite_PixelCollision|#PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(s_pointer))
  DrawingMode(#PB_2DDrawing_AllChannels)
  DrawAlphaImage(ImageID(pointer),0,0)
StopDrawing()
FreeImage(0)
; See if it works as expected (does here)
Repeat
  ClearScreen(#Blue)
  ExamineMouse()
  ExamineKeyboard()
  DisplayTransparentSprite(s_pointer, MouseX(), MouseY(), 255)
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)
End
BERESHEIT