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 2
2
import imgui .ImFontGlyphRangesBuilder ;
3
3
import imgui .ImGui ;
4
4
import imgui .ImGuiIO ;
5
- import imgui .app .Application ;
5
+ import imgui .app .BGFXWindow ;
6
6
import imgui .app .Configuration ;
7
7
import imgui .flag .ImGuiConfigFlags ;
8
8
import imgui .flag .ImGuiInputTextFlags ;
14
14
import java .nio .file .Files ;
15
15
import java .nio .file .Paths ;
16
16
17
- public class Main extends Application {
17
+ public class Main extends BGFXWindow {
18
18
private final ImString str = new ImString (5 );
19
19
private final float [] flt = new float [1 ];
20
20
private int count = 0 ;
Original file line number Diff line number Diff line change 52
52
* For example, large list of computations could be separated between application ticks. {@link #process()} method is called constantly.
53
53
* Use that wisely and remember that all GUI should be in the main thread.
54
54
*/
55
- public abstract class Application extends Window {
55
+ public abstract class Application {
56
+
57
+ protected abstract void init (Configuration config );
58
+
56
59
/**
57
60
* Method called before window creation. Could be used to provide basic window information, like title name etc.
58
61
*
59
62
* @param config configuration object with basic window information
60
63
*/
61
- protected void configure (final Configuration config ) {
62
- }
64
+ protected abstract void configure (final Configuration config );
63
65
64
66
/**
65
67
* Method called once, before application run loop.
66
68
*/
67
69
protected void preRun () {
68
70
}
69
71
72
+ protected abstract void run ();
73
+
70
74
/**
71
75
* Method called once, after application run loop.
72
76
*/
73
77
protected void postRun () {
74
78
}
75
79
80
+ protected abstract void dispose ();
81
+
76
82
/**
77
83
* Entry point of any ImGui application. Use it to start the application loop.
78
84
*
@@ -91,4 +97,6 @@ private static void initialize(final Application app) {
91
97
app .configure (config );
92
98
app .init (config );
93
99
}
100
+
101
+ public abstract Color getColorBg ();
94
102
}
Original file line number Diff line number Diff line change 20
20
import static org .lwjgl .system .Configuration .GLFW_LIBRARY_NAME ;
21
21
import static org .lwjgl .system .MemoryStack .stackPush ;
22
22
23
- public abstract class BGFXWindow {
23
+ public abstract class BGFXWindow extends Application {
24
24
private final ImGuiImplBGFX imGuiBGFX = new ImGuiImplBGFX ();
25
25
private final ImGuiImplGlfw imGuiGlfw = new ImGuiImplGlfw ();
26
26
Original file line number Diff line number Diff line change 22
22
* It's recommended to use {@link Application}, but this class could be extended directly as well.
23
23
* When extended, life-cycle methods should be called manually.
24
24
*/
25
- public abstract class Window {
25
+ public abstract class Window extends Application {
26
26
27
27
private final ImGuiImplGlfw imGuiGlfw = new ImGuiImplGlfw ();
28
28
private final ImGuiImplGl3 imGuiGl3 = new ImGuiImplGl3 ();
@@ -44,7 +44,7 @@ public abstract class Window {
44
44
*
45
45
* @param config configuration object with basic window information
46
46
*/
47
- protected void init (final Configuration config ) {
47
+ public final void init (final Configuration config ) {
48
48
initWindow (config );
49
49
initImGui (config );
50
50
imGuiGlfw .init (handle , true );
@@ -54,7 +54,7 @@ protected void init(final Configuration config) {
54
54
/**
55
55
* Method to dispose all used application resources and destroy its window.
56
56
*/
57
- protected void dispose () {
57
+ public final void dispose () {
58
58
imGuiGl3 .dispose ();
59
59
imGuiGlfw .dispose ();
60
60
disposeImGui ();
You can’t perform that action at this time.
0 commit comments