Mouse with Mouse Pointer Coordinates

Share your advanced PureBasic knowledge/code with the community.
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Mouse with Mouse Pointer Coordinates

Post by mk-soft »

I don't see any meaningful executable code here that represents the features you describe.
Where is the rest of the code?
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Bisonte
Addict
Addict
Posts: 1226
Joined: Tue Oct 09, 2007 2:15 am

Re: Mouse with Mouse Pointer Coordinates

Post by Bisonte »

Are you all like this? Don't you read the posts? Are you all so agressive?
This was not an attack, just a serious question ....

to understand this kind of tip or trick, a running example is needed.

My personal opinion is that querying variables is one of the absolute basics of a programming language.
Therefore, I cannot identify this "trick" as such... sorry.

Moreover, your suggested usage is quite violent ! To get mouse coordinates that make sense, you have to
run your code inside a loop... and already we have a problem, because a Font is loaded continuously...
the hard disk is not standing still, the execution can be very slow (if the user do not have a ssd) and the
memory is running out ;)

And by the way, no one will look at something like this if they have to build a program around it first,
just to see what this code does... An executable example simply belongs to it...

Beginners who don't really have a clue about programming run the risk of getting used to bad and/or wrong
things. This is the reason why mk-soft (and actually everybody else) asks for the rest of the code...
PureBasic 6.04 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
User avatar
STARGÅTE
Addict
Addict
Posts: 2067
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Mouse with Mouse Pointer Coordinates

Post by STARGÅTE »

Here is an executable example of Lord Santos codes without the continuously loading of fonts:

Code: Select all

Enumeration Window
	#Window
EndEnumeration

Enumeration Sprite
	#Sprite_Cursor
EndEnumeration

Enumeration Font
	#Font_Cursor
EndEnumeration

InitSprite()
InitMouse()
InitKeyboard()

OpenWindow(#Window, 0, 0, 960, 540, "Mouse with Mouse Pointer Coordinates", #PB_Window_ScreenCentered|#PB_Window_MinimizeGadget)
OpenWindowedScreen(WindowID(#Window), 0, 0, WindowWidth(#Window), WindowHeight(#Window))
LoadFont(#Font_Cursor, "Arial", 10)
CreateSprite(#Sprite_Cursor, 48, 48)

Repeat
	
	Repeat
		
		Select WindowEvent()
			Case #PB_Event_None
				Break
			Case #PB_Event_CloseWindow
				Break 2
		EndSelect
		
	ForEver
	
	ExamineMouse()
	If StartDrawing(SpriteOutput(#Sprite_Cursor))
		DrawingFont(FontID(#Font_Cursor))
		LineXY(0,0,20,10)
		LineXY(0,0,10,20)
		DrawText(0, 24, LSet(Str(MouseX())+"-"+Str(MouseY()), 11))
		StopDrawing()
	EndIf
	ExamineKeyboard()
	If KeyboardPushed(#PB_Key_All)
		Break
	EndIf
	
	ClearScreen($000000)
	DisplayTransparentSprite(#Sprite_Cursor, MouseX(), MouseY())
	FlipBuffers()
	
ForEver

End
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Post Reply