Skip to content

Commit

Permalink
Codebase: Continuing to improve
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomrno committed Apr 28, 2024
1 parent 9818f76 commit e30546c
Show file tree
Hide file tree
Showing 3 changed files with 191 additions and 179 deletions.
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ FROM ubuntu:24.04

# Mettre à jour les paquets
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install software-properties-common -y
RUN add-apt-repository ppa:graphics-drivers
RUN apt-get install nvidia-driver-440 -y
RUN apt-get clean \
RUN rm -rf /var/lib/apt/lists/*
RUN apt-get update \
&& apt-get install software-properties-common -y \
&& add-apt-repository ppa:graphics-drivers \
&& apt-get install nvidia-driver-440 -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Installer les paquets nécessaires
RUN apt-get install -y xorg nano xterm libx11-dev git libglfw3-dev make gcc libxi-dev libxcursor-dev libspdlog-dev vulkan-tools wget libglfw3 libvulkan-dev cmake libxinerama-dev unzip nvidia-driver-470 nlohmann-json3-dev
Expand Down
188 changes: 90 additions & 98 deletions tools/editor/app/core/ModuleManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,36 @@ void ModuleManager::OnImGuiRender()
ImGui::End();
}

void ModuleManager::menubar()
{

// Helper functions for menu items

void handleRefresh() {
// Behavior
}

void handleAddToProject() {
// Behavior
}

void handleFilterBuildRebuild() {
// Behavior
}

void handleGlobalBuild() {
// Behavior
}

void handleCreateModule() {
// Behavior
}

void handleSearch() {
// Behavior
}

// Main menu function

void ModuleManager::menubar() {
static ImTextureID refreshIcon = this->m_RefreshIcon->GetImGuiTextureID(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
static ImTextureID addIcon = this->m_AddIcon->GetImGuiTextureID(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
static bool open_ADDMODULE = false;
Expand All @@ -343,76 +371,58 @@ void ModuleManager::menubar()
static int selected = 0;
static std::vector<std::string> syslabels;

for (auto em : ctx->IO.sys_em)
{
for (auto em : ctx->IO.sys_em) {
bool add = true;

for (auto label : syslabels)
{
if (label == em->m_group)
{
for (auto label : syslabels) {
if (label == em->m_group) {
add = false;
}
}

if (add)
{
if (add) {
syslabels.push_back(em->m_group);
}
}
if (open_ADDMODULE)
{
if (ImGui::BeginPopupModal("Add module(s)", NULL, ImGuiWindowFlags_MenuBar))
{
if (ImGui::BeginMenuBar())
{
if (ImGui::Button("Close"))
{
open_ADDMODULE = false;
}
if (ImGui::ImageButtonWithText(refreshIcon, "Refresh", ImVec2(this->m_RefreshIcon->GetWidth(), this->m_RefreshIcon->GetHeight())))
{
// Behavior
}

ImGui::Separator();
if (ImGui::ImageButtonWithText(addIcon, "Browse public modules", ImVec2(this->m_AddIcon->GetWidth(), this->m_AddIcon->GetHeight())))
{
// Behavior
}
ImGui::Separator();
if (ImGui::BeginMenu("Filters"))
{
if (ImGui::MenuItem("Build/Rebuild single parts"))
{
// Behavior
}
if (ImGui::MenuItem("Global build"))
{
// Behavior
if (open_ADDMODULE) {
if (ImGui::BeginPopupModal("Add module(s)", NULL, ImGuiWindowFlags_MenuBar)) {
if (ImGui::BeginMenuBar()) {
if (ImGui::Button("Close")) {
open_ADDMODULE = false;
}
if (ImGui::ImageButtonWithText(refreshIcon, "Refresh", ImVec2(this->m_RefreshIcon->GetWidth(), this->m_RefreshIcon->GetHeight()))) {
handleRefresh();
}
ImGui::Separator();
if (ImGui::ImageButtonWithText(addIcon, "Browse public modules", ImVec2(this->m_AddIcon->GetWidth(), this->m_AddIcon->GetHeight()))) {
// Behavior
}
ImGui::Separator();
if (ImGui::BeginMenu("Filters")) {
if (ImGui::MenuItem("Build/Rebuild single parts")) {
handleFilterBuildRebuild();
}
if (ImGui::MenuItem("Global build")) {
handleGlobalBuild();
}
ImGui::EndMenu();
}
ImGui::EndMenuBar();
}
ImGui::EndMenu();
}
ImGui::EndMenuBar();
}


ImGui::BeginChild("left pane", ImVec2(230, -1), true);
for (int i = 0; i < syslabels.size(); i++)
{
if (i == 0)
{
for (int i = 0; i < syslabels.size(); i++) {
if (i == 0) {
std::string label = "All modules (" + std::to_string(this->ctx->IO.sys_em.size()) + ")";
ImGui::TextColored(ImVec4(0.4, 0.4, 0.4, 1), label.c_str());
}

std::string label;

int number = 0;
for (auto sysem : this->ctx->IO.sys_em)
{
if (sysem->m_group == syslabels[i])
{
for (auto sysem : this->ctx->IO.sys_em) {
if (sysem->m_group == syslabels[i]) {
number++;
}
}
Expand All @@ -436,10 +446,8 @@ void ModuleManager::menubar()
ImGuiID id = ImGui::GetID(label.c_str());
ImGui::BeginChildFrame(id, ImVec2(0, 0), true);

for (int i = 0; i < ctx->IO.sys_em.size(); i++)
{
if (ctx->IO.sys_em[i]->m_group == syslabels[selected])
{
for (int i = 0; i < ctx->IO.sys_em.size(); i++) {
if (ctx->IO.sys_em[i]->m_group == syslabels[selected]) {
std::string childLabel = "module##" + ctx->IO.sys_em[i]->m_name;

ImGui::BeginChild(childLabel.c_str(), ImVec2(0, 250), true);
Expand Down Expand Up @@ -487,14 +495,11 @@ void ModuleManager::menubar()
{
ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, 0.5f), "Contributors : ");
int i = 0;
for (auto contributor : ctx->IO.sys_em[i]->m_contributors)
{
for (auto contributor : ctx->IO.sys_em[i]->m_contributors) {
i++;
if (i <= 3)
{
if (i <= 3) {
}
else
{
else {
ImGui::SameLine();
int counter = ctx->IO.sys_em[i]->m_contributors.size() - 3;
std::string label = " and " + std::to_string(counter) + " other...";
Expand All @@ -504,10 +509,9 @@ void ModuleManager::menubar()
}
}

if (ImGui::ImageButtonWithText(addIcon, "Add to the current project", ImVec2(this->m_RefreshIcon->GetWidth(), this->m_RefreshIcon->GetHeight())))
{
// Behavior
}
if (ImGui::ImageButtonWithText(addIcon, "Add to the current project", ImVec2(this->m_RefreshIcon->GetWidth(), this->m_RefreshIcon->GetHeight()))) {
handleAddToProject();
}
ImGui::EndChild();
}
ImGui::EndChildFrame();
Expand All @@ -519,54 +523,42 @@ void ModuleManager::menubar()
if (open_ADDMODULE)
ImGui::OpenPopup("Add module(s)");

if (ImGui::BeginMenuBar())
{
if (ImGui::ImageButtonWithText(addIcon, "Add", ImVec2(this->m_AddIcon->GetWidth(), this->m_AddIcon->GetHeight())))
{
if (ImGui::BeginMenuBar()) {
if (ImGui::ImageButtonWithText(addIcon, "Add", ImVec2(this->m_AddIcon->GetWidth(), this->m_AddIcon->GetHeight()))) {
open_ADDMODULE = true;
}

if (ImGui::ImageButtonWithText(refreshIcon, "Refresh", ImVec2(this->m_RefreshIcon->GetWidth(), this->m_RefreshIcon->GetHeight())))
{
// Behavior
if (ImGui::ImageButtonWithText(refreshIcon, "Refresh", ImVec2(this->m_RefreshIcon->GetWidth(), this->m_RefreshIcon->GetHeight()))) {
handleRefresh();
}
ImGui::Separator();
if (ImGui::BeginMenu("Filters"))
{
if (ImGui::MenuItem("Build/Rebuild single parts"))
{
// Behavior
if (ImGui::BeginMenu("Filters")) {
if (ImGui::MenuItem("Build/Rebuild single parts")) {
handleFilterBuildRebuild();
}
if (ImGui::MenuItem("Global build"))
{
// Behavior
if (ImGui::MenuItem("Global build")) {
handleGlobalBuild();
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Create a module"))
{
if (ImGui::MenuItem("Build/Rebuild single parts"))
{
// Behavior
if (ImGui::BeginMenu("Create a module")) {
if (ImGui::MenuItem("Build/Rebuild single parts")) {
handleCreateModule();
}
if (ImGui::MenuItem("Global build"))
{
// Behavior
if (ImGui::MenuItem("Global build")) {
handleGlobalBuild();
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Search"))
{
if (ImGui::MenuItem("Build/Rebuild single parts"))
{
// Behavior
if (ImGui::BeginMenu("Search")) {
if (ImGui::MenuItem("Build/Rebuild single parts")) {
handleSearch();
}
if (ImGui::MenuItem("Global build"))
{
// Behavior
if (ImGui::MenuItem("Global build")) {
handleGlobalBuild();
}
ImGui::EndMenu();
}
ImGui::EndMenuBar();
}
}
}
Loading

0 comments on commit e30546c

Please sign in to comment.