diff --git a/src/engine/e_input.pas b/src/engine/e_input.pas
index 021c3ddadf72452b8c4b11358877cf0da23662e5..5cf17a788264ffc00dde1b8f1e524135680878a0 100644 (file)
--- a/src/engine/e_input.pas
+++ b/src/engine/e_input.pas
function e_JoyHatToKey(id: Word; hat: Byte; dir: Byte): Word;
procedure e_SetKeyState(key: Word; state: Integer);
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;
var
{e_MouseInfo: TMouseInfo;}
e_EnableInput: Boolean = False;
begin
Inc(c);
e_WriteLog('Input: Opened SDL joystick ' + IntToStr(i) + ' (' + SDL_JoystickName(joy) +
begin
Inc(c);
e_WriteLog('Input: Opened SDL joystick ' + IntToStr(i) + ' (' + SDL_JoystickName(joy) +
- ') as joystick ' + IntToStr(c) + ':', MSG_NOTIFY);
+ ') as joystick ' + IntToStr(c) + ':', TMsgType.Notify);
SetLength(Joysticks, c);
with Joysticks[c-1] do
begin
SetLength(Joysticks, c);
with Joysticks[c-1] do
begin
// TODO: find proper solution for this xbox trigger shit
for j := 0 to Axes do AxisZero[j] := SDL_JoystickGetAxis(joy, j);
e_WriteLog(' ' + IntToStr(Axes) + ' axes, ' + IntToStr(Buttons) + ' buttons, ' +
// TODO: find proper solution for this xbox trigger shit
for j := 0 to Axes do AxisZero[j] := SDL_JoystickGetAxis(joy, j);
e_WriteLog(' ' + IntToStr(Axes) + ' axes, ' + IntToStr(Buttons) + ' buttons, ' +
- IntToStr(Hats) + ' hats.', MSG_NOTIFY);
+ IntToStr(Hats) + ' hats.', TMsgType.Notify);
end;
end;
end;
end;
end;
end;
SetLength(Joysticks, 0);
end;
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;
function PollKeyboard(): Boolean;
+{
var
Keys: PByte;
NKeys: Integer;
i: NativeUInt;
var
Keys: PByte;
NKeys: Integer;
i: NativeUInt;
+}
begin
Result := False;
begin
Result := False;
+ {
Keys := SDL_GetKeyboardState(@NKeys);
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
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;
end;
function PollJoysticks(): Boolean;