X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fengine%2Fe_input.pas;h=072dccb44cd6d592f369191e12a8b5988c6b14e9;hb=31d174a428ef1235e1708b0738804b47e006cf5c;hp=deded67e211fbcfeeaf961aad76d4160ce3a928e;hpb=7292fe409145dfcbb2776e34bb64d56e32985b9d;p=d2df-sdl.git diff --git a/src/engine/e_input.pas b/src/engine/e_input.pas index deded67..072dccb 100644 --- a/src/engine/e_input.pas +++ b/src/engine/e_input.pas @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . *) -{$INCLUDE e_amodes.inc} +{$INCLUDE ../shared/a_modes.inc} unit e_input; interface @@ -105,6 +105,9 @@ function e_JoyAxisToKey(id: Word; ax: Byte; dir: Byte): Word; function e_JoyHatToKey(id: Word; hat: Byte; dir: Byte): Word; procedure e_SetKeyState(key: Word; state: Integer); +procedure e_UnpressAllKeys (); +procedure e_KeyUpDown (key: Word; down: Boolean); + var {e_MouseInfo: TMouseInfo;} e_EnableInput: Boolean = False; @@ -188,20 +191,39 @@ begin SetLength(Joysticks, 0); end; + +procedure e_UnpressAllKeys (); +var + i: Integer; +begin + for i := 0 to High(KeyBuffer) do KeyBuffer[i] := False; +end; + + +procedure e_KeyUpDown (key: Word; down: Boolean); +begin + if (key > 0) and (key < Length(KeyBuffer)) then KeyBuffer[key] := down; +end; + + function PollKeyboard(): Boolean; +{ var Keys: PByte; NKeys: Integer; i: NativeUInt; +} begin Result := False; + { Keys := SDL_GetKeyboardState(@NKeys); - if (Keys = nil) or (NKeys < 1) then - Exit; + if (Keys = nil) or (NKeys < 1) then Exit; for i := 0 to NKeys do - KeyBuffer[i] := ((PByte(NativeUInt(Keys) + i)^) <> 0); - for i := NKeys to High(KeyBuffer) do - KeyBuffer[i] := False; + begin + if ((PByte(NativeUInt(Keys) + i)^) <> 0) then KeyBuffer[i] := false; + end; + for i := NKeys to High(KeyBuffer) do KeyBuffer[i] := False; + } end; function PollJoysticks(): Boolean;