File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ void KeyDown( Kbutton @b ) {
141141@ c = CGame :: Cmd :: Argv( 2 );
142142b.downtime = c.toInt();
143143if ( b.downtime == 0 ) {
144- b.downtime = curTime - 100 ;
144+ b.downtime = inputTime - 100 ;
145145}
146146
147147b.state | = 1 + 2 ; // down + impulse down
@@ -241,8 +241,8 @@ float KeyState( Kbutton @key ) {
241241
242242if ( 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
248248if ( frameTime == 0 ) {
Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ namespace CGame {
2222
2323namespace Input {
2424
25- int64 curTime ;
26- int frameTime ;
25+ int64 inputTime, oldInputTime ;
26+ int64 frameTime ;
2727float pixelRatio ;
2828
2929void 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
4546CGame :: Input :: Gamepad :: Frame();
4647CGame :: Input :: Touch :: Frame();
4748}
4849
4950void ClearState()
5051{
51- frameTime = 0 ;
52-
5352CGame :: Input :: Gamepad :: ClearState();
5453}
5554
You can’t perform that action at this time.
0 commit comments