Hab gestern die (extrem sinnlose) App "Touch Me" fürn iPod entdeckt. Und da ich sowieso zu viel Langeweile hab, hab ichs gleich mal nachgemacht (Ist nichts großes...):
Spoiler anzeigen
Global $clicks=0, $time=1, $hTimer=""
$hGUI = GUICreate("Click Me!", 200, 300, 192, 124)
$cLabel = GUICtrlCreateLabel("0", 75, 95, 100, 100)
GUICtrlSetState(-1, 128)
GUICtrlSetFont(-1, 60)
$btn1 = GUICtrlCreateButton("Click Me", 4, 125, 192, 25)
$TimeP = GUICtrlCreateLabel("", 0, 290, 200, 5)
GUICtrlSetBkColor(-1, 0x00FF00)
GUISetState()
GUIRegisterMsg(0x0201, "WM_LBUTTONDOWN")
setHotKeys()
While True
Switch GUIGetMsg()
Case -3
Exit
Case $btn1
If $clicks=0 Then
$hTimer=TimerInit()
$clicks+=1
GUICtrlSetData($cLabel, $clicks)
GUICtrlSetPos($btn1, 4, Random(8, 260))
Else
$time=1000-TimerDiff($hTimer)+1
$hTimer=TimerInit()
$clicks+=1
GUICtrlSetPos($btn1, 4, Random(8, 260))
GUICtrlSetData($cLabel, $clicks)
If $clicks=10 Then GUICtrlSetPos($cLabel, 55, 95)
EndIf
EndSwitch
If NOt WinActive($hGUI) Then
unSetHotKeys()
While Not WinActive($hGUI)
sleep(100)
WEnd
setHotKeys()
EndIf
If $hTimer<>"" Then GUICtrlSetPos($TimeP, 0, 290, (1000-TimerDiff($hTimer))*2/10, 5)
If TimerDiff($hTimer)>1000 And $hTimer<>"" Then
MsgBox(0, "Verloren", "Du hast mit "&$clicks&" Klicks verloren.")
$hTimer=""
$clicks=0
GUICtrlSetPos($TimeP, 0, 290, 200, 5)
GUICtrlSetPos($cLabel, 75, 95)
GUICtrlSetData($cLabel, "0")
EndIf
WEnd
Func setHotKeys()
HotKeySet("{SPACE}", "doNothing")
HotKeySet("{ENTER}", "doNothing")
EndFunc
Func unSetHotKeys()
HotKeySet("{SPACE}")
HotKeySet("{ENTER}")
EndFunc
Func doNothing()
EndFunc
Func WM_LBUTTONDOWN()
$aCursor=GUIGetCursorInfo()
If IsArray($aCursor) Then
If $aCursor[4]<>$btn1 Then
MsgBox(0, "Verloren", "Du hast mit "&$clicks&" Klicks verloren.")
$hTimer=""
$clicks=0
GUICtrlSetPos($TimeP, 0, 290, 200, 5)
GUICtrlSetPos($cLabel, 75, 95)
GUICtrlSetData($cLabel, "0")
EndIf
EndIf
EndFunc