joeldesante wrote: |
---|
the whole point of the site is to get answers to your questions. ARRG! |
not *your* questions, specifically. The point is to build a knowledge base where you can find answers to your questions because someone already asked them in a way that is useful to most programmers. There are detailed instructions on how to ask a new question that would help StackOverflow's mission.
Case in point, your code would not be acceptable because it is not the smallest complete program that reproduces the problem you've experienced and it's unclear what actual problem you experienced: "doesn't really work" is not a description another programmer can help with since we don't know what kind of "work" was expected.
But, since this is a discussion forum rather than a Q&A knowledge database, it is indeed a better place for this discussion.
responding specifically to
I was thinking I would have to put it on a separate thread if I want to ever be able to stop it |
If you want to stop the loop, just exit it, with a break statement or have your game.gameState() become false, when the exit event occurs in-game. Threads give you concurrency, not "ability to stop", and what is your main thread doing concurrent with your event loop thread? Nothing, sitting in gLoop.join(), wasting a chunk of memory.