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 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 11package  imgui .app ;
22
3+ import  imgui .ImColor ;
4+ 
35/** 
46 * Application class from which ImGui applications extend. 
57 * Serves as an abstraction layer to hide all low-level details about window creation and rendering routine. 
5254 * For example, large list of computations could be separated between application ticks. {@link #process()} method is called constantly. 
5355 * Use that wisely and remember that all GUI should be in the main thread. 
5456 */ 
55- public  abstract  class  Application  extends  Window  {
57+ public  abstract  class  Application  {
58+ 
59+     protected  abstract  void  init (Configuration  config );
60+ 
5661    /** 
5762     * Method called before window creation. Could be used to provide basic window information, like title name etc. 
5863     * 
5964     * @param config configuration object with basic window information 
6065     */ 
61-     protected  void  configure (final  Configuration  config ) {
62-     }
66+     protected  abstract  void  configure (final  Configuration  config );
6367
6468    /** 
6569     * Method called once, before application run loop. 
6670     */ 
6771    protected  void  preRun () {
6872    }
6973
74+     protected  abstract  void  run ();
75+ 
7076    /** 
7177     * Method called once, after application run loop. 
7278     */ 
7379    protected  void  postRun () {
7480    }
7581
82+     protected  abstract  void  dispose ();
83+ 
7684    /** 
7785     * Entry point of any ImGui application. Use it to start the application loop. 
7886     * 
@@ -91,4 +99,6 @@ private static void initialize(final Application app) {
9199        app .configure (config );
92100        app .init (config );
93101    }
102+ 
103+     public  abstract  Color  getColorBg ();
94104}
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