Skip to content

Commit

Permalink
move gui into ecs
Browse files Browse the repository at this point in the history
  • Loading branch information
apache-hb committed Apr 2, 2024
1 parent 374daba commit c4a9c6e
Show file tree
Hide file tree
Showing 10 changed files with 554 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Checks:
- 'performance*,portability*,bugprone*,clang-analyzer*,cert*,concurrency*,readability*'
- '-bugprone-easily-swappable-parameters'
- '-performance-no-int-to-ptr'
- '-readability-braces-around-statements'
- '-readability-identifier-length'
CheckOptions:
- { key: readability-identifier-naming.VariableCase, value: lower_case }
- { key: readability-identifier-naming.ParameterCase, value: lower_case }
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "data/scripts/ninjatracing"]
path = data/scripts/ninjatracing
url = https://github.com/nico/ninjatracing.git
[submodule "subprojects/flecs"]
path = subprojects/flecs
url = https://github.com/apache-hb/flecs
36 changes: 36 additions & 0 deletions src/frontend/gui/editor/include/editor/panels/editor.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once

#include "imgui.h"
#include "imgui_internal.h"

#include "flecs.h"

struct MainMenu { flecs::entity entity; };
struct Window { };
struct Menu { };
struct MenuItem { };
struct MenuSection { };

struct Separator { };

struct Title {
std::string title;
const char *c_str() const { return title.c_str(); }
};

struct ShortCut {
ImGuiKeyChord chord;
const char *c_str() const { return ImGui::GetKeyChordName(chord); }
};

struct Children {
flecs::query<> query;
};

struct Priority {
int value;

friend constexpr int cmp(const Priority &lhs, const Priority &rhs) {
return lhs.value - rhs.value;
}
};
9 changes: 9 additions & 0 deletions src/frontend/gui/editor/include/editor/panels/json.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once

#include "editor/panels/panel.hpp"

namespace ed
{
IEditorPanel *create_json_panel();
}
34 changes: 26 additions & 8 deletions src/frontend/gui/editor/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,41 @@ src = [
'src/panels/arena.cpp',
'src/panels/demo.cpp',
'src/panels/theme.cpp',
'src/panels/json.cpp',

'src/utils/io.cpp',

'src/main.cpp'
]

flecs = subproject('flecs').get_variable('flecs_dep')

deps = [
# render backend
draw,

# imgui deps and widgets
imgui, imfilebrowser, implot, memedit,

# cthulhu common deps
core, os, scan, io, arena, interop, backtrace,
notify, config,

# cthulhu runtime deps
setup, memory, broker, support, ssa, tree,

# extra utilities
json,

# ecs
flecs
]

executable('gui', src,
cpp_args : gui_args,
cpp_pch : 'src/stdafx.hpp',
build_by_default : not meson.is_subproject(),
install : not meson.is_subproject(),
include_directories : [ 'include', 'src' ],
dependencies : [
draw, imgui, imfilebrowser, implot, memedit,
core, os, scan,
memory, notify, config, setup,
io, broker, support, ssa, tree, backtrace,
arena, interop
]
)
dependencies : deps
)
Loading

0 comments on commit c4a9c6e

Please sign in to comment.