Skip to content

Commit

Permalink
Add files via upload (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
user726687 authored Apr 28, 2023
1 parent e4f6a7b commit 3281617
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
10 changes: 2 additions & 8 deletions src/bin/RawInputViewer.au3
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,7 @@ Func WndProc($h,$m,$w,$l)
local $q = QueryPerformanceCounter($kernel32dll)
Switch $m
Case 0xFF ; WM_INPUT
If $isRecording Then
If Demo(False) Then
ImmediateRawinput(MakeMessage($h,$m,$w,$l,$q))
Else
DeferredRawinput(MakeMessage($h,$m,$w,$l,$q))
EndIf
EndIf
If $isRecording Then DeferredRawinput(MakeMessage($h,$m,$w,$l,$q))
Return 0
Case 0xFE ; WM_INPUT_DEVICE_CHANGE
ForwardTimestampedMsg(Process_Device_Change, MakeMessage($h,$m,$w,$l,$q))
Expand Down Expand Up @@ -324,7 +318,7 @@ Func QueueEvent($func, $args)
EndIf
EndFunc

Func ImmediateRawinput($misc)
Func ImmediateRawinput($misc) ; don't use this
Process_Rawinput_Data(_RawInputFetchData($misc.lParam, $user32dll),$misc)
EndFunc

Expand Down
23 changes: 11 additions & 12 deletions src/bin/demo.au3
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ Func CameraLockSetState($lock=Null,$target=Null)
Local $mode = $_.camlock
If Not (Null=$lock) Then
DllStructSetData($_, "camlock", $lock)
$mode = $lock
EndIf
If $mode Then
_LockCursor(Int(($_.left+$_.right)/2),Int(($_.top+$_.bottom)/2),$user32dll)
If $_.camlock Then
_CenterCursor($_.left,$_.top,$_.right,$_.bottom,$user32dll)
Else
_TrapCursor($_.left,$_.top,$_.right,$_.bottom,$user32dll)
EndIf
Expand Down Expand Up @@ -190,6 +189,8 @@ Func DemoDrawRoutine($front,$back,$info,$state)
Local Static $hor = DllStructCreate('long x1;long y1;long x2;long y2;')
Local Static $ver = DllStructCreate('long x1;long y1;long x2;long y2;')
Local $modunit = $state.gridsize
Local $hDCPen = GetStockObject(19,$gdi32dll)
SetDCPenColor($back,0x00808080,$gdi32dll)

BitBlt($back,0,0,$info.width,$info.height,$front,0,0,0x42,$gdi32dll)

Expand All @@ -199,8 +200,8 @@ Func DemoDrawRoutine($front,$back,$info,$state)
for $i=-$modceil to $modceil step $modunit
Local $y = $info.height/2+$i - mod($state.y,$modunit)
$hor.y1=$y
$hor.y2=$y
Polyline($back,$hor,2,$gdi32dll)
$hor.y2=$y+1
FillRect($back,$hor,$hDCPen,$user32dll)
next

Local $modceil = $modunit*ceiling($info.width/$modunit/2) ; how many whole grid units needed to cover the window
Expand All @@ -209,8 +210,8 @@ Func DemoDrawRoutine($front,$back,$info,$state)
for $i=-$modceil to $modceil step $modunit
Local $x = $info.width/2+$i - mod($state.x,$modunit)
$ver.x1=$x
$ver.x2=$x
Polyline($back,$ver,2,$gdi32dll)
$ver.x2=$x+1
FillRect($back,$ver,$hDCPen,$user32dll)
next

BitBlt($front,0,0,$info.width,$info.height,$back,0,0,0xCC0020,$gdi32dll)
Expand Down Expand Up @@ -243,18 +244,16 @@ Func Demo($toggle = null)
$hDCFront = GetDC($hDemoWin)
$hDCBack = CreateCompatibleDC($hDCScreen)
$hBitmap = CreateCompatibleBitmap($hDCScreen,$bufferInfo.width,$bufferInfo.height)
ReleaseDC(Null,$hDCScreen)
SelectObject($hDCBack,$hBitmap)
SelectObject($hDCBack,GetStockObject(19))
SetDCPenColor($hDCBack,0x00808080)

$demoState.dpi = GetDpiForWindow($hDemoWin, $user32dll)
$demoState.left = $arr[2]
$demoState.top = $arr[3]
$demoState.right = $arr[0]+$arr[2]
$demoState.bottom = $arr[1]+$arr[3]
_LockCursor(Int($arr[2]+$arr[0]/2),Int($arr[3]+$arr[1]/2),$user32dll)
GUISetCursor(16,1,$hDemoWin)
SetCursor($hLimeCursor, $user32dll)
_CenterCursor($demoState.left,$demoState.top,$demoState.right,$demoState.bottom)
SetCursor($hLimeCursor)
$renderUnlocked = true ; do this last
endif
elseif $renderUnlocked and $toggle=null then ; called from main loop. Note that we only run on main loop calls, otherwise the processing gets clogged
Expand Down
8 changes: 8 additions & 0 deletions src/bin/gdihelpers.au3
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Func ReleaseDC($hWnd,$hDC,$_dll='user32.dll')
Return DllCall($_dll,'int','ReleaseDC','handle',$hWnd,'handle',$hDC)[0]
EndFunc

Func FillRect($hDC,$rect,$hBrush,$_dll='user32.dll')
Return DllCall($_dll,'int','FillRect','handle',$hDC,'struct*',$rect,'handle',$hBrush)[0]
EndFunc

Func BitBlt($dst,$x,$y,$cx,$cy,$src,$x1,$y1,$rop,$_dll='gdi32.dll')
Return DllCall($_dll,'bool','BitBlt','handle',$dst,'int',$x,'int',$y,'int',$cx,'int',$cy,'handle',$src,'int',$x1,'int',$y1,'dword',$rop)[0]
EndFunc
Expand Down Expand Up @@ -51,3 +55,7 @@ EndFunc
Func DeleteObject($hObj,$_dll='gdi32.dll')
Return DllCall($_dll,'bool','DeleteObject','handle',$hObj)[0]
EndFunc

Func GdiFlush($_dll='gdi32.dll')
Return DllCall($_dll,'bool','GdiFlush')
EndFunc
4 changes: 4 additions & 0 deletions src/bin/winapihelpers.au3
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ Func _LockCursor($x,$y,$_dll='user32.dll')
Return _TrapCursor($x,$y,$x+1,$y+1,$_dll)
EndFunc

Func _CenterCursor($left,$top,$right,$bottom,$_dll='user32.dll')
Return _LockCursor(Int(($left+$right)/2),Int(($top+$bottom)/2),$_dll)
EndFunc

Func _LoadBigCursor($filepath,$_dll='user32.dll')
Return _
DllCall($_dll, "handle", "LoadImage", _
Expand Down

0 comments on commit 3281617

Please sign in to comment.