Contribute to the LWJGL open collective
December 06, 2020, 21:38:57 »
I finally completed this
But everything in my code is very very messy. The game loop is this while loop: while(!glfwWindowShouldClose(window))
The most game engines allow you to create small scripts with only 1 certain thing to do, where you have some methods like Update in unity which is executed every frame. I tried to create a separate java file to move a cube from outside the main class, calling the GameLoop() method, each frame, but it wasn't working. How to handle the gameloop from outside?
Re: Game Loop
Reply #1 on:
January 03, 2021, 18:19:15 »
I fear you need to re-evaluate you approach a bit. Unity is an
, that basically means that you are just injecting some code of yours into existing structures. This is why concepts like the
LWJGL on the other hand is simply a java-binding for the raw OpenGL-API, the "graphic card's language" so to speak. LWJGL is a
only, that means you basically have to write everything you know from Unity yourself, from asset handling to game logic.
A game loop is just one concept of how to build a game, albeit a broadly used one
In short, LWJGL is
an engine. If you want to focus more on scripting and less on technical tasks that make a game tick, I would recomment you take a look at
instead, which is much more
. Internally, it uses LWJGL.
SMF © 2014