wih.lib ist eine kleine in FASM geschriebene Library um Maus & Keyboard Eingaben abzufragen.
Beispiel:
Code: Alles auswählen
;WIH - WINDOW INPUT HANDLER
;A SMALL LIBRARY TO HANDLE MOUSE AND KEYBOARD INPUT
;AUTHOR: MIJIKAI
;VERSION: 1.1
EnableExplicit
Import "wih.lib"
wihCreate.i(hwnd.i)
EndImport
Interface WIH
Focus.i() ;is the window focused / is the input attached to the window thread!
Key.i(Code.i) ;is the key pushed? / use #VK key-codes
KeySgl.i(Code.i) ;was the butten pushed? / use #VK key-codes
KeyChr.i() ;get the chr key code of the pushed key
MouseCheck.i() ;is the mouse inside the client area of the window
MouseLeft.i() ;is the left mouse button pushed?
MouseRight.i() ;is the right mouse button pushed?
MouseMiddle.i() ;is the middle mouse button pushed?
MouseLeftSgl.i() ;was the left mouse button pushed?
MouseRightSgl.i() ;was the right mouse button pushed?
MouseMiddleSgl.i() ;was the middle mouse button pushed?
MouseLeftDbl.i() ;was the left mouse button pushed twice in a short time? / doubleclick!
MouseRightDbl.i() ;was the right mouse button pushed twice in a short time? / doubleclick!
MouseMiddleDbl.i() ;was the middle mouse button pushed twice in a short time? / doubleclick!
MouseWheel.i(Code.i = #Null) ;was the mousewheel moved? / optional check if a special key is pressed!
MouseX.i() ;get the mouse horizontal (x) postion / offset from the top left corner of the client area!
MouseY.i() ;get the mouse verical (y) postion / offset from the top left corner of the client area!
Flush.i() ;flush the input buffers / needed for all 'Sgl' and 'Dbl' functions to work properly!
Release.i() ;release the input handler and all associated resources
EndInterface
Procedure.i Demo(Title.s = #Null$,Width.i = 600,Height.i = 400)
Protected wnd.i
Protected wnd_flags.i
Protected wnd_event.i
Protected wnd_exit.i
Protected *input.WIH
wnd_flags = #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget
wnd = OpenWindow(#PB_Any,#Null,#Null,Width,Height,Title,wnd_flags)
If wnd
WindowBounds(wnd,Width,Height,#PB_Ignore,#PB_Ignore)
*input = wihCreate(WindowID(wnd))
If *input
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
wnd_exit = #True
EndSelect
;-------------------------------
;check mouse and keyboard input!
If *input\MouseLeftDbl()
Debug "DoubleClick!"
EndIf
Debug *input\MouseY()
;-------------------------------
*input\Flush();<- when done flush the input buffers!
Until wnd_exit
*input\Release();<- release all resources
EndIf
CloseWindow(wnd)
EndIf
ProcedureReturn #Null
EndProcedure
Demo("WIH")
End
https://www.dropbox.com/s/cvzmgtvcchtmi ... 1.zip?dl=0