Compare commits

...

2 Commits

3 changed files with 58 additions and 54 deletions

View File

@ -1,11 +1,13 @@
#load "iprof.jai"; #if OS != .WASM {
#load "picker.jai"; #load "iprof.jai";
#load "console.jai"; #load "picker.jai";
#load "postprocess.jai"; #load "postprocess.jai";
#load "trile_editor.jai"; #load "trile_editor.jai";
#load "level_editor.jai"; #load "level_editor.jai";
#load "textureDebugger.jai"; }
#if HAS_TACOMA { #load "tacoma.jai"; } #if HAS_TACOMA { #load "tacoma.jai"; }
#load "console.jai";
#load "textureDebugger.jai";
#scope_file #scope_file
@ -23,7 +25,7 @@ current_editor_view : Editor_View = .Trile_Editor;
in_editor_view : bool = false; in_editor_view : bool = false;
init_editor :: () { init_editor :: () {
init_profiler(); #if OS != .WASM {init_profiler();}
init_console(); init_console();
} }
@ -32,38 +34,40 @@ console_open_ignore_input : bool = false;
draw_editor_ui :: (theme: *GR.Overall_Theme) { draw_editor_ui :: (theme: *GR.Overall_Theme) {
if in_editor_view { #if OS != .WASM {
r := GR.get_rect(0,0,0,0); if in_editor_view {
r.x = 0; r.w = 100*vw; r := GR.get_rect(0,0,0,0);
r.y = 0; r.h = ui_h(5, 0); r.x = 0; r.w = 100*vw;
draw_bg_rectangle(r, theme); r.y = 0; r.h = ui_h(5, 0);
r.w = 15*vw; draw_bg_rectangle(r, theme);
GR.label(r, tprint("Trueno v%.%", V_MAJOR, V_MINOR), *t_label_left(theme)); r.w = 15*vw;
GR.label(r, tprint("Trueno v%.%", V_MAJOR, V_MINOR), *t_label_left(theme));
r.x = 100*vw - r.w; r.x = 100*vw - r.w;
if GR.button(r, "Level editor", *t_button_selectable(theme, current_editor_view == .Level_Editor)) if GR.button(r, "Level editor", *t_button_selectable(theme, current_editor_view == .Level_Editor))
then current_editor_view = .Level_Editor; then current_editor_view = .Level_Editor;
r.x -= r.w; r.x -= r.w;
if GR.button(r, "Trile editor", *t_button_selectable(theme, current_editor_view == .Trile_Editor)) if GR.button(r, "Trile editor", *t_button_selectable(theme, current_editor_view == .Trile_Editor))
then current_editor_view = .Trile_Editor; then current_editor_view = .Trile_Editor;
r.x -= r.w; r.x -= r.w;
if GR.button(r, "Post-process", *t_button_selectable(theme, current_editor_view == .Post_Process_Editor)) if GR.button(r, "Post-process", *t_button_selectable(theme, current_editor_view == .Post_Process_Editor))
then current_editor_view = .Post_Process_Editor; then current_editor_view = .Post_Process_Editor;
if current_editor_view == { if current_editor_view == {
case .Trile_Editor; case .Trile_Editor;
draw_trile_editor_ui(theme); draw_trile_editor_ui(theme);
case .Level_Editor; case .Level_Editor;
draw_level_editor_ui(theme); draw_level_editor_ui(theme);
case .Post_Process_Editor; case .Post_Process_Editor;
draw_post_process_editor_ui(theme); draw_post_process_editor_ui(theme);
}
} }
draw_profiler();
} }
draw_console(theme); draw_console(theme);
draw_profiler();
draw_texture_debugger(theme); draw_texture_debugger(theme);
draw_postprocess_popup(theme); draw_postprocess_popup(theme);
GR.draw_popups(); GR.draw_popups();
@ -71,17 +75,18 @@ draw_editor_ui :: (theme: *GR.Overall_Theme) {
} }
draw_editor :: () { draw_editor :: () {
if !in_editor_view then return; #if OS != .WASM {
if !in_editor_view then return;
if current_editor_view == { if current_editor_view == {
case .Trile_Editor; case .Trile_Editor;
draw_trile_editor(); draw_trile_editor();
case .Level_Editor; case .Level_Editor;
draw_level_editor(); draw_level_editor();
case .Post_Process_Editor; case .Post_Process_Editor;
draw_post_process_editor(); draw_post_process_editor();
}
} }
} }
tick_editor_ui :: () { tick_editor_ui :: () {
@ -89,14 +94,16 @@ tick_editor_ui :: () {
in_editor_view = !in_editor_view; in_editor_view = !in_editor_view;
} }
if in_editor_view { #if OS != .WASM {
if current_editor_view == { if in_editor_view {
case .Trile_Editor; if current_editor_view == {
tick_trile_editor(); case .Trile_Editor;
case .Level_Editor; tick_trile_editor();
tick_level_editor(); case .Level_Editor;
case .Post_Process_Editor; tick_level_editor();
tick_post_process_editor(); case .Post_Process_Editor;
tick_post_process_editor();
}
} }
} }

View File

@ -145,7 +145,7 @@ frame :: () {
dpis := state.dpi_scale; dpis := state.dpi_scale;
tick_profiler(); #if OS != .WASM { tick_profiler(); }
if !in_editor_view then game_tick(); if !in_editor_view then game_tick();
fonsClearState(state.fons); fonsClearState(state.fons);
for event: Input.events_this_frame { for event: Input.events_this_frame {
@ -167,7 +167,7 @@ frame :: () {
memory_visualizer_per_frame_update(); memory_visualizer_per_frame_update();
} }
profiler_update(); #if OS != .WASM { profiler_update(); }
reset_temporary_storage(); reset_temporary_storage();
} }

View File

@ -53,9 +53,6 @@ body {
</style> </style>
</head> </head>
<body style="background:black"> <body style="background:black">
<div class="game-title">${name}
<span class="game-menu-item"><a class="game-menu-link" href="index.html">home</a></span>
</div>
<canvas class="game" id="canvas" oncontextmenu="event.preventDefault()"></canvas> <canvas class="game" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
<script type="text/javascript"> <script type="text/javascript">
var Module = { var Module = {