Commit Graph

25 Commits

Author SHA1 Message Date
Hajime Hoshi
3a8ca5ad73 ui: Implement TPS/SetTPS
Fixes #605
Fixes #321
2018-07-17 01:58:00 +09:00
Hajime Hoshi
93f8c76310 internal/clock: Remove unused variables 2018-07-17 00:35:51 +09:00
Hajime Hoshi
408cc1e833 internal/clock: Refactoring
Update now returns 0 when tps is 0, and 1 when tps is negative.
2018-07-17 00:29:10 +09:00
Hajime Hoshi
88e6768a30 Use the term 'TPS' ticks per second 2018-07-16 04:36:47 +09:00
Hajime Hoshi
bbb777eecc internal/clock: Use constant time to detect if the game is delayed too much 2018-07-16 03:02:55 +09:00
Hajime Hoshi
18ec1d8265 internal/clock: Update takes FPS 2018-07-16 01:03:23 +09:00
Hajime Hoshi
faaf391619 audio: Give up syncing audio timer and game timer (#617)
Syncing was already incomplete (e.g. decoding takes more than one
frame and delays can happen in this case). Giving up syncing audio
timer and game timer should not affect the game experience so much.
Instead, clock implementation will be much simpler.
2018-05-27 00:30:12 +09:00
Hajime Hoshi
5976e4bbbc audio: More intellegent suspending/resuming (#617)
Before this change, the audio is suspended when the game stops for
1/12[s]. However, as game often stops for more than 1/12[s]
especially on mobiles, this implemntation caused some audio
glitches.

This change fixes this problem by re-implementing suspending/
resumeing audio by detecting the window is active/focused or not.
2018-05-26 23:31:04 +09:00
Hajime Hoshi
92631e64ed Remove internal/sync
nosync package for GopherJS is problematic since nosync's mutex
assumes that Lock call is never duplicated, which is not true in
actual applications.

See also #603.
2018-05-09 23:41:08 +09:00
Hajime Hoshi
d8c0d88960 clock: Add comments 2018-01-07 21:12:25 +09:00
Hajime Hoshi
1e33cbb66f clock: Remove limitation of the number of frames to be updated 2018-01-07 20:20:02 +09:00
Hajime Hoshi
d5d5ebb0b3 clock: Make ProceedAudioTimer take a number of frames 2018-01-07 18:32:19 +09:00
Hajime Hoshi
d12a3d4073 clock: Refactoring 2018-01-07 17:10:56 +09:00
Hajime Hoshi
b05455a2a6 clock: Fix comments 2017-08-24 02:30:43 +09:00
Hajime Hoshi
d1cbfdeec7 clock: Move now() from loop to clock 2017-08-06 02:12:23 +09:00
Hajime Hoshi
f0f115b612 clock: Move FPS calculation from loop to clock 2017-08-06 02:09:33 +09:00
Hajime Hoshi
95a061df7f loop: Remove dependency from audio to loop 2017-08-06 01:43:09 +09:00
Hajime Hoshi
2e7a477f9d clock: Refactoring 2017-08-06 01:28:14 +09:00
Hajime Hoshi
e98475cf9d clock: Reduce a variable 2017-08-06 00:29:06 +09:00
Hajime Hoshi
1ea6bb2b6a clock: Fix comments 2017-08-06 00:27:45 +09:00
Hajime Hoshi
b7d559fdf3 clock: Refactoring: Move frames calculation to clock 2017-08-06 00:18:38 +09:00
Hajime Hoshi
a92f77c207 clock: Rename function names; loop: Rename variables 2017-08-05 22:25:21 +09:00
Hajime Hoshi
94843fbe73 loop: Move clock.FPS to loop.FPS to reduce dependencies 2017-08-05 22:08:58 +09:00
Hajime Hoshi
59110ba5ec clock: Refactoring: Use clock.FPS everywhere 2017-07-14 03:19:50 +09:00
Hajime Hoshi
5d1d0844e1 Add internal/clock 2017-07-14 00:34:05 +09:00