Skip to content

Commit c1cd9da

Browse files
committed
Off-dusting.
1 parent 8b5396c commit c1cd9da

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

src/app/app.js

+16-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {FileSystem} from "./filesystem.js";
1414

1515
export default class ImguiApp
1616
{
17-
constructor(appname="UntitledImguiApp", version="1.0.0")
17+
constructor(appname="UntitledImguiApp", version="1.0.0", initLog=true)
1818
{
1919
console.debug("App Init " + new Date().toLocaleString());
2020
this.appname = appname;
@@ -50,6 +50,11 @@ export default class ImguiApp
5050
return this.IsMobileDevice();
5151
}
5252

53+
OnLogActivity(msg, level)
54+
{
55+
// overridable
56+
}
57+
5358
IsMobileDevice()
5459
{
5560
if((typeof window.orientation !== "undefined") ||
@@ -128,14 +133,16 @@ export default class ImguiApp
128133
}
129134
}
130135

131-
OnLoop(time) // called e.g. 60 fps
136+
OnLoop(time) // called e.g. 60 fps, subclass may override
132137
{
133138
if(!this.canvas) return;
134139
if(this.imgui.NewFrame(time))
135140
{
136141
this.ShowContextMenu(this.imgui);
137-
this.FileBrowser.Show(this.imgui); // manages its own IsOpen state
138-
this.Log.Show(this.imgui, "Log");
142+
if(this.FileBrowser)
143+
this.FileBrowser.Show(this.imgui); // manages its own IsOpen state
144+
if(this.Log)
145+
this.Log.Show(this.imgui, "Log");
139146
this.OnFrame(this.imgui); // subclass hooks in here
140147
this.imgui.Render(); // calls EndFrame
141148
}
@@ -158,9 +165,12 @@ export default class ImguiApp
158165
{
159166
if(imgui.BeginPopupContextVoid("ContextMenu", 1))
160167
{
161-
if(imgui.MenuItem("Log", null, this.Log.IsShowing.get()))
168+
if(this.Log)
162169
{
163-
this.Log.IsShowing.toggle();
170+
if(imgui.MenuItem("Log", null, this.Log.IsShowing.get()))
171+
{
172+
this.Log.IsShowing.toggle();
173+
}
164174
}
165175

166176
this.AppendContextMenu(imgui);

src/panels/filebrowser.js

+5
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ export class FileBrowser
6060
this.imgui = null;
6161
}
6262

63+
InstallFilesys(filesys)
64+
{
65+
this.filesys = filesys;
66+
}
67+
6368
Begin(imgui)
6469
{
6570
this.imgui = imgui;

0 commit comments

Comments
 (0)