How to make simple game engine in Java