File tree Expand file tree Collapse file tree 4 files changed +17
-9
lines changed
imgui-app/src/main/java/imgui/app Expand file tree Collapse file tree 4 files changed +17
-9
lines changed Original file line number Diff line number Diff line change 22import imgui .ImFontGlyphRangesBuilder ;
33import imgui .ImGui ;
44import imgui .ImGuiIO ;
5- import imgui .app .Application ;
5+ import imgui .app .BGFXWindow ;
66import imgui .app .Configuration ;
77import imgui .flag .ImGuiConfigFlags ;
88import imgui .flag .ImGuiInputTextFlags ;
1414import java .nio .file .Files ;
1515import java .nio .file .Paths ;
1616
17- public class Main extends Application {
17+ public class Main extends BGFXWindow {
1818 private final ImString str = new ImString (5 );
1919 private final float [] flt = new float [1 ];
2020 private int count = 0 ;
Original file line number Diff line number Diff line change 5252 * For example, large list of computations could be separated between application ticks. {@link #process()} method is called constantly.
5353 * Use that wisely and remember that all GUI should be in the main thread.
5454 */
55- public abstract class Application extends Window {
55+ public abstract class Application {
56+
57+ protected abstract void init (Configuration config );
58+
5659 /**
5760 * Method called before window creation. Could be used to provide basic window information, like title name etc.
5861 *
5962 * @param config configuration object with basic window information
6063 */
61- protected void configure (final Configuration config ) {
62- }
64+ protected abstract void configure (final Configuration config );
6365
6466 /**
6567 * Method called once, before application run loop.
6668 */
6769 protected void preRun () {
6870 }
6971
72+ protected abstract void run ();
73+
7074 /**
7175 * Method called once, after application run loop.
7276 */
7377 protected void postRun () {
7478 }
7579
80+ protected abstract void dispose ();
81+
7682 /**
7783 * Entry point of any ImGui application. Use it to start the application loop.
7884 *
@@ -91,4 +97,6 @@ private static void initialize(final Application app) {
9197 app .configure (config );
9298 app .init (config );
9399 }
100+
101+ public abstract Color getColorBg ();
94102}
Original file line number Diff line number Diff line change 2020import static org .lwjgl .system .Configuration .GLFW_LIBRARY_NAME ;
2121import static org .lwjgl .system .MemoryStack .stackPush ;
2222
23- public abstract class BGFXWindow {
23+ public abstract class BGFXWindow extends Application {
2424 private final ImGuiImplBGFX imGuiBGFX = new ImGuiImplBGFX ();
2525 private final ImGuiImplGlfw imGuiGlfw = new ImGuiImplGlfw ();
2626
Original file line number Diff line number Diff line change 2222 * It's recommended to use {@link Application}, but this class could be extended directly as well.
2323 * When extended, life-cycle methods should be called manually.
2424 */
25- public abstract class Window {
25+ public abstract class Window extends Application {
2626
2727 private final ImGuiImplGlfw imGuiGlfw = new ImGuiImplGlfw ();
2828 private final ImGuiImplGl3 imGuiGl3 = new ImGuiImplGl3 ();
@@ -44,7 +44,7 @@ public abstract class Window {
4444 *
4545 * @param config configuration object with basic window information
4646 */
47- protected void init (final Configuration config ) {
47+ public final void init (final Configuration config ) {
4848 initWindow (config );
4949 initImGui (config );
5050 imGuiGlfw .init (handle , true );
@@ -54,7 +54,7 @@ protected void init(final Configuration config) {
5454 /**
5555 * Method to dispose all used application resources and destroy its window.
5656 */
57- protected void dispose () {
57+ public final void dispose () {
5858 imGuiGl3 .dispose ();
5959 imGuiGlfw .dispose ();
6060 disposeImGui ();
You can’t perform that action at this time.
0 commit comments