In some tutorials (not many) i have found this instruction to implement the game thread.
But in most cases , even in (relatively) advanced tuts there isn’t such invocation , but
the usual JFrame , JPanel(or Canvas) and a game thread , and all works fine.
I know that Swing isn’t thread safe , but a game doesn’t manipulate ui components.
So , what is the point ?
Thanks in advance !
The biggest functional difference of having the event dispatch thread (EDT) be the game thread, is that you won’t get InputEvents being delivered concurrently with the game logic. (if you’re relying upon Swing for your input handling).
From a more idealistic & aesthetic perspective, utilising the EDT is embracing Swing’s design paradigms a little more completely.
Nowadays I don’t think either approach is more (or less) compliant with the API’s design intent, as both paradigms have been in use for so long that either are expected to work without issue.
So long as you understand the differences, it really isn’t a big issue as switching between the two should be trivial.
Though personally I’d favour keeping the game & EDT threads separate.