Skip to content

Commit 075df45

Browse files
committed
entity inspect view should be disabled in release
1 parent a3e0cee commit 075df45

File tree

5 files changed

+30
-21
lines changed

5 files changed

+30
-21
lines changed

source/re/ng/diag/console.d

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ class InspectorConsole {
5252
add_command(ConsoleCommand("help", &cmd_help, "lists available commands"));
5353
}
5454

55-
public void add_default_inspector_commands() {
55+
debug public void add_default_inspector_commands() {
5656
add_command(ConsoleCommand("entities", toDelegate(
5757
&DefaultEntityInspectorCommands.c_entities), "lists scene entities"));
58-
add_command(ConsoleCommand("dump", toDelegate(&DefaultEntityInspectorCommands.c_dump), "dump a component"));
5958
add_command(ConsoleCommand("inspect", toDelegate(&DefaultEntityInspectorCommands.c_inspect),
6059
"open the inspector on a component"));
60+
add_command(ConsoleCommand("dump", toDelegate(&DefaultEntityInspectorCommands.c_dump), "dump a component"));
6161
}
6262

6363
public void reset_commands() {

source/re/ng/diag/default_inspect_commands.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import std.conv;
1111
import re.core;
1212
import re.ecs;
1313

14-
static class DefaultEntityInspectorCommands {
14+
debug static class DefaultEntityInspectorCommands {
1515
alias log = Core.log;
1616
alias scenes = Core.scenes;
1717
alias dbg = Core.inspector_overlay;

source/re/ng/diag/entity_inspect_view.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static import raylib;
1717
static import raygui;
1818

1919
/// real-time object inspector
20-
class EntityInspectView {
20+
debug class EntityInspectView {
2121
/// panel width
2222
public int width;
2323
/// whether the inspector is open

source/re/ng/diag/inspector_overlay.d

+24-13
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,18 @@ class InspectorOverlay {
2626
private enum _render_col = Color(255, 255, 255, 160);
2727

2828
/// inspector panel
29-
public static EntityInspectView entity_inspect_view;
29+
debug {
30+
public static EntityInspectView entity_inspect_view;
31+
}
3032

3133
/// debug console
3234
public static InspectorConsole console;
3335

3436
/// sets up debugger
3537
this() {
36-
entity_inspect_view = new EntityInspectView();
38+
debug {
39+
entity_inspect_view = new EntityInspectView();
40+
}
3741
console = new InspectorConsole();
3842
if (!Core.headless) {
3943
ui_bounds = Rectangle(0, 0, Core.window.screen_width, Core.window.screen_height);
@@ -48,31 +52,36 @@ class InspectorOverlay {
4852
}
4953

5054
public void update() {
51-
if (!Core.headless) {
52-
// auto-resize inspector
53-
entity_inspect_view.width = cast(int)(ui_bounds.width * 0.7);
54-
}
55-
5655
if (Input.is_key_pressed(console.key)) {
5756
Core.debug_render = !Core.debug_render;
5857
console.open = !console.open;
5958
}
6059

61-
if (entity_inspect_view.open)
62-
entity_inspect_view.update();
6360
if (console.open)
6461
console.update();
62+
63+
debug {
64+
if (!Core.headless) {
65+
// auto-resize inspector
66+
entity_inspect_view.width = cast(int)(ui_bounds.width * 0.7);
67+
}
68+
if (entity_inspect_view.open)
69+
entity_inspect_view.update();
70+
}
6571
}
6672

6773
public void render() {
6874
raylib.BeginTextureMode(_render_target);
6975
raylib.ClearBackground(Colors.BLANK);
7076

71-
if (entity_inspect_view.open)
72-
entity_inspect_view.render();
7377
if (console.open)
7478
console.render();
7579

80+
debug {
81+
if (entity_inspect_view.open)
82+
entity_inspect_view.render();
83+
}
84+
7685
raylib.EndTextureMode();
7786

7887
// draw render target
@@ -84,8 +93,10 @@ class InspectorOverlay {
8493

8594
/// clean up
8695
public void destroy() {
87-
if (entity_inspect_view.open) {
88-
entity_inspect_view.close();
96+
debug {
97+
if (entity_inspect_view.open) {
98+
entity_inspect_view.close();
99+
}
89100
}
90101
RenderExt.destroy_render_target(_render_target);
91102
}

source/re/ng/diag/package.d

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
module re.ng.diag;
44

55
public {
6-
debug {
7-
import re.ng.diag.inspector_overlay;
8-
import re.ng.diag.console;
9-
}
6+
import re.ng.diag.inspector_overlay;
7+
import re.ng.diag.console;
108
import re.ng.diag.render;
119
}

0 commit comments

Comments
 (0)