Verfasst: 26.09.2006 18:50
Schon gesehen. 

Das deutsche PureBasic-Forum
https://www.purebasic.fr/german/
Code: Alles auswählen
; Autor: DarkDragon
Dim StaticKeyboardReleasedOldState.b(256)
Procedure KeyboardReleasedEx(Key.l)
Protected Result.l
Shared StaticKeyboardReleasedOldState()
; Key+1 in der Struktur, weil #PB_Key_All = -1 ist
Result = 0
If KeyboardPushed(Key)
StaticKeyboardReleasedOldState(Key+1) = 1
Else
If StaticKeyboardReleasedOldState(Key+1) = 1
Result = 1
StaticKeyboardReleasedOldState(Key+1) = 0
EndIf
EndIf
ProcedureReturn Result
EndProcedure
InitSprite()
InitKeyboard()
OpenWindow(0, 0, 0, 640, 480, "Test", #PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(0), 0, 0, 640, 480, 1, 0, 0)
Repeat
ExamineKeyboard()
Delay(1)
Until KeyboardReleasedEx(#PB_Key_Up) Or WindowEvent() = #PB_Event_CloseWindow
MessageRequester("OK", "OK")
End
Code: Alles auswählen
StaticKeyboardReleasedOldState(Key+1) = 1
Code: Alles auswählen
StaticKeyboardReleasedOldState(Key+1) = 0
Stimmt...tobe hat geschrieben:@DarkDragon
ich glaub das letztemüsste so:Code: Alles auswählen
StaticKeyboardReleasedOldState(Key+1) = 1
sein, weil sonst ist die taste ja dauerhaft gedrückt.Code: Alles auswählen
StaticKeyboardReleasedOldState(Key+1) = 0