File tree Expand file tree Collapse file tree 4 files changed +19
-9
lines changed
imgui-app/src/main/java/imgui/app Expand file tree Collapse file tree 4 files changed +19
-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 1
1
package imgui .app ;
2
2
3
+ import imgui .ImColor ;
4
+
3
5
/**
4
6
* Application class from which ImGui applications extend.
5
7
* Serves as an abstraction layer to hide all low-level details about window creation and rendering routine.
52
54
* For example, large list of computations could be separated between application ticks. {@link #process()} method is called constantly.
53
55
* Use that wisely and remember that all GUI should be in the main thread.
54
56
*/
55
- public abstract class Application extends Window {
57
+ public abstract class Application {
58
+
59
+ protected abstract void init (Configuration config );
60
+
56
61
/**
57
62
* Method called before window creation. Could be used to provide basic window information, like title name etc.
58
63
*
59
64
* @param config configuration object with basic window information
60
65
*/
61
- protected void configure (final Configuration config ) {
62
- }
66
+ protected abstract void configure (final Configuration config );
63
67
64
68
/**
65
69
* Method called once, before application run loop.
66
70
*/
67
71
protected void preRun () {
68
72
}
69
73
74
+ protected abstract void run ();
75
+
70
76
/**
71
77
* Method called once, after application run loop.
72
78
*/
73
79
protected void postRun () {
74
80
}
75
81
82
+ protected abstract void dispose ();
83
+
76
84
/**
77
85
* Entry point of any ImGui application. Use it to start the application loop.
78
86
*
@@ -91,4 +99,6 @@ private static void initialize(final Application app) {
91
99
app .configure (config );
92
100
app .init (config );
93
101
}
102
+
103
+ public abstract Color getColorBg ();
94
104
}
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