Skip to content

Commit

Permalink
Core : Add a launcher GUI for project managment
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomrno committed Apr 30, 2024
1 parent 146ab4c commit 990f2c9
Show file tree
Hide file tree
Showing 16 changed files with 428 additions and 183 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
# Liste des fichiers sources pour la bibliothèque partagée
file(GLOB_RECURSE VORTEX_SHARED_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/main/src/*.cpp")
file(GLOB_RECURSE VORTEXEDITOR_SHARED_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tools/editor/*.cpp")
file(GLOB_RECURSE VORTEXLAUNCHER_SHARED_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tools/launcher/*.cpp")

# Création de la bibliothèque partagée
add_library(vortex_shared SHARED
${VORTEX_SHARED_SOURCES}
${VORTEXEDITOR_SHARED_SOURCES}
${VORTEXLAUNCHER_SHARED_SOURCES}
${VORTEXCORE_SHARED_SOURCES}
${VORTEXPROJECT_SHARED_SOURCES}
${VORTEXUTILS_SHARED_SOURCES}
Expand All @@ -22,6 +24,7 @@ target_include_directories(vortex_shared PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/main/include
${CMAKE_CURRENT_SOURCE_DIR}/main/src
${CMAKE_CURRENT_SOURCE_DIR}/tools/editor
${CMAKE_CURRENT_SOURCE_DIR}/tools/launcher
)

# Liste des fichiers sources pour l'exécutable principal
Expand All @@ -31,6 +34,9 @@ file(GLOB_RECURSE VORTEX_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/main/src/*.cpp")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/editor editor_build)
target_link_libraries(vortex_shared PUBLIC editor)

# Add launcher
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/launcher launcher_build)
target_link_libraries(vortex_shared PUBLIC launcher)

# Création de l'exécutable principal
add_executable(vortex ${VORTEX_SOURCES} main.cpp)
Expand Down Expand Up @@ -66,6 +72,14 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tools/editor/app/
PATTERN "*.inl"
)

# Installation des fichiers d'en-tête de /tools/launcher/app/include
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tools/launcher/app/
DESTINATION ${INSTALL_INCLUDE_DIR}/tools/launcher/app/
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN "*.inl"
)

# Installation des fichiers d'en-tête de /lib
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/
DESTINATION ${INSTALL_INCLUDE_DIR}/lib
Expand Down
Binary file modified build/bin/vortex
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/uikit
Submodule uikit updated from a1ebfe to 1d1ddc
205 changes: 95 additions & 110 deletions main.cpp

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions main/src/modules/load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ namespace VortexMaker
// Iterate through each found SO file
for (const auto &so_file : so_files)
{

std::cout << "File " << file << "So " << so_file << std::endl;
// Load the shared object
void *handle = dlopen(so_file.c_str(), RTLD_LAZY | RTLD_GLOBAL);
if (!handle)
Expand Down
26 changes: 0 additions & 26 deletions tools/editor/.gitmodules

This file was deleted.

6 changes: 3 additions & 3 deletions tools/editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)



add_library(editor
# API
${CMAKE_CURRENT_SOURCE_DIR}/../../main/src/vortex.cpp
Expand All @@ -29,9 +27,10 @@ add_library(editor
${CMAKE_CURRENT_SOURCE_DIR}/app/instances/Utils/ModuleDetails/ModuleDetails.cpp
)


target_include_directories(editor PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../)


if (NOT TARGET launcher)
# editor requirements
find_package(Vulkan REQUIRED)
option(SPDLOG_INSTALL "Enable installation of spdlog" ON)
Expand All @@ -47,5 +46,6 @@ target_link_libraries(editor PUBLIC glm)
target_link_libraries(editor PUBLIC stbimage)
target_link_libraries(editor PUBLIC spdlog)

endif()

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/uikit/platform/GUI/editor/icon.png DESTINATION /usr/include/vortex)
89 changes: 63 additions & 26 deletions tools/editor/app/include/editor.h
Original file line number Diff line number Diff line change
@@ -1,36 +1,19 @@


#include "../instances/instance.h"
#include "../core/ContentBrowser.hpp"
#include "../core/ProjectViewer.hpp"
#include "../core/ModuleManager.hpp"

#include "./instanceFactory.h"

#include "../../../../lib/uikit/src/EntryPoint.h"

using namespace VortexMaker;

#ifndef EDITOR_H
#define EDITOR_H

static std::vector<std::shared_ptr<ModuleDetails>> moduleDetailsInstances;

static void PushStyle()
{
ImGuiStyle &style = ImGui::GetStyle();
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 5.0f);
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, 11.0f);
ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, 11.0f);
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10.0f, 10.0f));
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(15.0f, 6.0f));
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(9.0f, 3.0f));
ImGui::PushStyleVar(ImGuiStyleVar_TabRounding, 7.0f);
}

static void PopStyle()
{
ImGui::PopStyleVar(8);
}

class Instance : public InstanceFactory
{
public:
Expand All @@ -48,12 +31,12 @@ class Instance : public InstanceFactory
};
};

class ApplicationLayer : public UIKit::Layer
class EditorLayer : public UIKit::Layer
{
public:
ApplicationLayer(){};
EditorLayer(){};

void menubar(const std::shared_ptr<ApplicationLayer>& applayer, UIKit::Application* app);
void menubar(const std::shared_ptr<EditorLayer> &applayer, UIKit::Application *app);
void OnUIRender() override
{
PushStyle();
Expand Down Expand Up @@ -111,7 +94,23 @@ class ApplicationLayer : public UIKit::Layer

PopStyle();
}
void PushStyle()
{
ImGuiStyle &style = ImGui::GetStyle();
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 5.0f);
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, 11.0f);
ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, 11.0f);
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10.0f, 10.0f));
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(15.0f, 6.0f));
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(9.0f, 3.0f));
ImGui::PushStyleVar(ImGuiStyleVar_TabRounding, 7.0f);
}

void PopStyle()
{
ImGui::PopStyleVar(8);
}
VxContext *m_ctx;

// Global TaskProcessor instance
Expand All @@ -129,11 +128,11 @@ class ApplicationLayer : public UIKit::Layer
std::vector<std::string> instanciedWindowsNames;
};

static UIKit::Application *UIKit::CreateApplication(int argc, char **argv)
UIKit::Application *CreateEditor(int argc, char **argv)
{
int port = atoi(argv[1]);

std::shared_ptr<ApplicationLayer> applayer = std::make_shared<ApplicationLayer>();
std::shared_ptr<EditorLayer> applayer = std::make_shared<EditorLayer>();
applayer->m_ctx = VortexMaker::GetCurrentContext();

UIKit::ApplicationSpecification spec;
Expand All @@ -145,9 +144,47 @@ static UIKit::Application *UIKit::CreateApplication(int argc, char **argv)
UIKit::Application *app = new UIKit::Application(spec);

app->PushLayer(applayer);
app->SetMenubarCallback([app, applayer]() {applayer->menubar(applayer, app);});
app->SetMenubarCallback([app, applayer]()
{ applayer->menubar(applayer, app); });

return app;
}

namespace VortexMaker
{
static int VortexEditor(int argc, char **argv)
{
return UIKit::ThirdMain(argc, argv, CreateEditor);
}

// Old call
/*static int VortexEditor(int argc, char **argv)
{
return UIKit::Main(argc, argv);
}*/
}

// Old creation function
/*static UIKit::Application *UIKit::CreateApplication(int argc, char **argv)
{
int port = atoi(argv[1]);
std::shared_ptr<EditorLayer> applayer = std::make_shared<EditorLayer>();
applayer->m_ctx = VortexMaker::GetCurrentContext();
UIKit::ApplicationSpecification spec;
std::string name = applayer->m_ctx->name + " - Vortex Editor";
spec.Name = name;
spec.CustomTitlebar = true;
spec.IconPath = "icon.png";
UIKit::Application *app = new UIKit::Application(spec);
app->PushLayer(applayer);
app->SetMenubarCallback([app, applayer]()
{ applayer->menubar(applayer, app); });
return app;
}*/

#endif
26 changes: 13 additions & 13 deletions tools/editor/app/src/editor.cpp
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
#include "../include/editor.h"

void handleExit(UIKit::Application *app)
static void handleExit(UIKit::Application *app)
{
app->Close();
}

void handleProjectSettings()
static void handleProjectSettings()
{
}

void handleManagePlugins()
static void handleManagePlugins()
{
}

void handleManageModules(bool &showModulesManager)
static void handleManageModules(bool &showModulesManager)
{
}

void handleShowBottomToolbar()
static void handleShowBottomToolbar()
{
}

void handleShowSimplifiedHeader(UIKit::Application *app)
static void handleShowSimplifiedHeader(UIKit::Application *app)
{
app->m_Specification.CustomTitlebar = !app->m_Specification.CustomTitlebar;
}

void handleContentBrowser(bool &showContentBrowser)
static void handleContentBrowser(bool &showContentBrowser)
{
}

void handleProjectViewer(bool &showProjectViewer)
static void handleProjectViewer(bool &showProjectViewer)
{
}

void handleNews()
static void handleNews()
{
}

void handleCommunity()
static void handleCommunity()
{
}

void handleTutorials()
static void handleTutorials()
{
}

void handleDocumentation()
static void handleDocumentation()
{
}

// Main menu function
void ApplicationLayer::menubar(const std::shared_ptr<ApplicationLayer> &exampleLayer, UIKit::Application *app)
void EditorLayer::menubar(const std::shared_ptr<EditorLayer> &exampleLayer, UIKit::Application *app)
{
if (ImGui::BeginMenu("File"))
{
Expand Down
1 change: 0 additions & 1 deletion tools/editor/compile_commands.json

This file was deleted.

21 changes: 21 additions & 0 deletions tools/launcher/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Directories
.vs/
bin/
bin-int/

# Files
*.vcxproj
*.vcxproj.user
*.vcxproj.filters
*.sln

# Exclude
!vendor/bin

.cache
build/
vendor/glfw
vendor/glm
vendor/stb-image
vendor/imgui/.github
CMakeFiles
Loading

0 comments on commit 990f2c9

Please sign in to comment.