Skip to content

Commit 862fba1

Browse files
committed
Change input API to match the expected signature
1 parent 3854c0a commit 862fba1

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

client/input/keys.as

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void KeyDown( Kbutton @b ) {
141141
@c = CGame::Cmd::Argv( 2 );
142142
b.downtime = c.toInt();
143143
if( b.downtime == 0 ) {
144-
b.downtime = curTime - 100;
144+
b.downtime = inputTime - 100;
145145
}
146146

147147
b.state |= 1 + 2; // down + impulse down
@@ -241,8 +241,8 @@ float KeyState( Kbutton @key ) {
241241

242242
if( key.state != 0 ) {
243243
// still down
244-
msec += curTime - key.downtime;
245-
key.downtime = curTime;
244+
msec += inputTime - key.downtime;
245+
key.downtime = inputTime;
246246
}
247247

248248
if( frameTime == 0 ) {

client/input/main.as

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ namespace CGame {
2222

2323
namespace Input {
2424

25-
int64 curTime;
26-
int frameTime;
25+
int64 inputTime, oldInputTime;
26+
int64 frameTime;
2727
float pixelRatio;
2828

2929
void Init()
@@ -37,19 +37,18 @@ void Shutdown()
3737
{
3838
}
3939

40-
void Frame( int64 curTime_, int frameTime_ )
40+
void Frame( int64 inputTime_ )
4141
{
42-
curTime = curTime_;
43-
frameTime = frameTime_;
42+
oldInputTime = inputTime;
43+
inputTime = inputTime_;
44+
frameTime = inputTime - oldInputTime;
4445

4546
CGame::Input::Gamepad::Frame();
4647
CGame::Input::Touch::Frame();
4748
}
4849

4950
void ClearState()
5051
{
51-
frameTime = 0;
52-
5352
CGame::Input::Gamepad::ClearState();
5453
}
5554

0 commit comments

Comments
 (0)