A simple game loop for libgdx
A simple game loop for libgdx
As libgdx applications are global. We may as well have some state to hold the current loop and provide you a reference to the running application.
As libgdx applications are global. We may as well have some state to hold the current loop and provide you a reference to the running application.
(listener frame-fn)(listener frame-fn on-resize-fn)Takes a render function frame-fn and optionally an on-resize function
and returns an ApplicationListener that can be used to start a new game loop.
Exceptions thrown in the render thread will be caught and printed. Make sure to implement your own error handling.
Takes a render function `frame-fn` and optionally an `on-resize` function and returns an ApplicationListener that can be used to start a new game loop. Exceptions thrown in the render thread will be caught and printed. Make sure to implement your own error handling.
(listener-loop! listener)(listener-loop! listener config)Takes a listener and starts a game loop on a new thread. You can pass config as a map.
The keys supported currently by config and their defaults are: :width 1024, :height 768, :fullscreen? false :title "Untitled" :vsync? false :max-fps 60 :resizable? false
Unfortunately libgdx will only allow this fn to run once for the entire application process.
Takes a listener and starts a game loop on a new thread. You can pass config as a map. The keys supported currently by config and their defaults are: :width 1024, :height 768, :fullscreen? false :title "Untitled" :vsync? false :max-fps 60 :resizable? false Unfortunately libgdx will only allow this fn to run once for the entire application process.
(loop! f)(loop! f config)Takes a fn to call every frame and starts a game loop on a new thread. You can pass config as a map.
The fn will be called every frame with NO arguments.
The keys supported currently by config and their defaults are: :width 1024, :height 768, :fullscreen? false :title "Untitled" :vsync? false :max-fps 60 :resizable? false :on-resize-fn nil
Unfortunately libgdx will only allow this fn to run once for the entire application process.
Takes a fn to call every frame and starts a game loop on a new thread. You can pass config as a map. The fn will be called every frame with NO arguments. The keys supported currently by config and their defaults are: :width 1024, :height 768, :fullscreen? false :title "Untitled" :vsync? false :max-fps 60 :resizable? false :on-resize-fn nil Unfortunately libgdx will only allow this fn to run once for the entire application process.
(map->lwjgl-configuration m)(on-render-thread & forms)Runs the forms on the render thread. Returns a promise that will yield the result of the last form.
If there is no loop taking tasks - an exception will be thrown.
Runs the forms on the render thread. Returns a promise that will yield the result of the last form. If there is no loop taking tasks - an exception will be thrown.
(on-render-thread-call f)Runs the fn f on the render thread. Returns a promise that will yield
the result of the function call once it has been completed.
If there is no loop taking tasks - an exception will be thrown
Runs the fn `f` on the render thread. Returns a promise that will yield the result of the function call once it has been completed. If there is no loop taking tasks - an exception will be thrown
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |