Skip to content
This repository has been archived by the owner on Mar 11, 2019. It is now read-only.

timer breaks on de-/focus after more than one call to set-screen! #90

Open
nblumoe opened this issue Feb 6, 2016 · 4 comments
Open

Comments

@nblumoe
Copy link
Contributor

nblumoe commented Feb 6, 2016

Odd behavior with a timer:

  1. starting the app normally (CIDER Repl, calling (-main))
  2. the timer starts and works flawlessly
  3. defocus game window
  4. timer events not triggered anymore
  5. focus game window
  6. timer event triggered again

So I guess the timer is on hold when the window is not focused (guess one can hook into that via on-pause and on-resume).
I do not necessarily consider this an issue so far. Maybe a bit weird, that the timer stops, but on-render keeps going...

Here is the real issue, continuing after step 6. from above:
7. run (play-clj/on-gl (play-clj/set-screen! viking-village-vandalism-game main-screen ui-screen))
8. the game window is defocused now (as I switched to the REPL)
9. the screens are reset and start over again, the timer working normally
10. focusing the game window again stops the timer
11. defocusing the game window does not change anything, most importantly does not enable the timer again
(12. GOTO 7. and everything repeats from there)

So, this really seems to be broken somehow.
I am running this on Fedora 23, play-clj "1.0.0".

@oakes
Copy link
Owner

oakes commented Feb 7, 2016

Yeah there's a pretty long history of timer-related issues in libGDX. The particular issue you mentioned about its behavior when calling set-screen! is new to me, though. I'll look into it and see if we can do some kind of workaround, but since libGDX is a Java framework I imagine their design doesn't account for calling methods from a REPL =)

@ul
Copy link

ul commented Jun 4, 2016

Probably you can suggest any workaround? Just hit this issue too.

@newhook
Copy link

newhook commented Oct 26, 2017

I hit this problem as well... after I click on the game window the timer stops firing :( I think its probably simplest just not to use the timer and count down from delta times.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants