Can now open .map in trenchbroom automatically

This commit is contained in:
Antoine Pilote
2023-09-15 17:53:07 -04:00
parent a5cf290f4c
commit 61776b4fb8
11 changed files with 26 additions and 10 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -12,10 +12,10 @@ void FontManager::LoadFonts()
ImFontConfig icons_config; icons_config.MergeMode = true; icons_config.PixelSnapH = true;
mFonts[Normal] = io.Fonts->AddFontFromFileTTF("resources/Fonts/fa-solid-900.ttf", 11.0f, &icons_config, icons_ranges);
mFonts[Bold] = io.Fonts->AddFontFromFileTTF("resources/Fonts/OpenSans-Bold.ttf", 16.0);
mFonts[LargeBold] = io.Fonts->AddFontFromFileTTF("resources/Fonts/OpenSans-Regular.ttf", 32);
mFonts[Title] = io.Fonts->AddFontFromFileTTF("resources/Fonts/OpenSans-Bold.ttf", 50.0);
mFonts[SubTitle] = io.Fonts->AddFontFromFileTTF("resources/Fonts/OpenSans-Regular.ttf", 24.0);
mFonts[Bold] = io.Fonts->AddFontFromFileTTF("resources/Fonts/FiraMono-Bold.ttf", 16.0);
mFonts[LargeBold] = io.Fonts->AddFontFromFileTTF("resources/Fonts/FiraMono-Regular.ttf", 32);
mFonts[Title] = io.Fonts->AddFontFromFileTTF("resources/Fonts/FiraMono-Bold.ttf", 50.0);
mFonts[SubTitle] = io.Fonts->AddFontFromFileTTF("resources/Fonts/FiraMono-Regular.ttf", 24.0);
ImGui::GetIO().Fonts->AddFontDefault();
icons_config.MergeMode = true;
mFonts[BigIcon] = io.Fonts->AddFontFromFileTTF("resources/Fonts/fa-solid-900.ttf", 42.0f, &icons_config, icons_ranges);

View File

@@ -430,8 +430,14 @@ void EditorSelectionPanel::DrawProjectPanel(Ref<Nuake::Project> project)
if (ImGui::Button("Locate"))
{
const std::string& locationPath = Nuake::FileDialog::OpenFile("TrenchBroom (.exe)\0TrenchBroom.exe\0");
if (!locationPath.empty())
{
project->TrenchbroomPath = locationPath;
}
}
ImGui::SameLine();
ImGui::InputText("Trenchbroom Path", &project->TrenchbroomPath);
}

View File

@@ -213,6 +213,10 @@ namespace Nuake
{
Editor->Selection = EditorSelection(file);
}
if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0))
{
OS::OpenTrenchbroomMap(file->GetAbsolutePath());
}
}
ImGui::PopStyleVar();
if (ImGui::BeginDragDropSource())

View File

@@ -8,7 +8,6 @@ namespace Nuake {
{
if (ImGui::Begin("Project settings"))
{
char buffer[256];
memset(buffer, 0, sizeof(buffer));
std::strncpy(buffer, Engine::GetProject()->Name.c_str(), sizeof(buffer));

View File

@@ -1,5 +1,6 @@
#include "OS.h"
#include "src/Window.h"
#include "Engine.h"
#define GLFW_EXPOSE_NATIVE_WIN32
#include "GLFW/glfw3.h"
@@ -69,6 +70,11 @@ void OS::ShowInFileExplorer(const std::string& filePath)
ShellExecuteA(nullptr, "open", "explorer.exe", ("/select," + std::string(filePath)).c_str(), nullptr, SW_SHOWDEFAULT);
}
void OS::OpenTrenchbroomMap(const std::string& filePath)
{
ShellExecuteA(nullptr, nullptr, Engine::GetProject()->TrenchbroomPath.c_str(), filePath.c_str(), nullptr, SW_SHOW);
}
void OS::OpenURL(const std::string& url)
{
ShellExecute(nullptr, nullptr, std::wstring(url.begin(), url.end()).c_str(), 0, 0, SW_SHOW);

View File

@@ -12,9 +12,10 @@ namespace Nuake
static std::string GetFromClipboard();
static int GetTime();
static void OpenIn(const std::string& filePath);
static int OS::RenameFile(const Ref<File>& file, const std::string& newName);
static int OS::RenameDirectory(const Ref<Directory>& dir, const std::string& newName);
static int RenameFile(const Ref<File>& file, const std::string& newName);
static int RenameDirectory(const Ref<Directory>& dir, const std::string& newName);
static void ShowInFileExplorer(const std::string& filePath);
static void OpenTrenchbroomMap(const std::string& filePath);
static void OpenURL(const std::string& url);
};
}

View File

@@ -279,6 +279,7 @@ namespace Nuake
gBufferShader->SetUniformMat4f("u_View", mView);
// Models
glCullFace(GL_FRONT);
auto view = scene.m_Registry.view<TransformComponent, ModelComponent, VisibilityComponent>();
for (auto e : view)
{
@@ -292,8 +293,7 @@ namespace Nuake
}
}
}
glCullFace(GL_FRONT);
Renderer::Flush(gBufferShader, false);
// Quake BSPs

View File

@@ -260,7 +260,7 @@ namespace Nuake
{
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
io.Fonts->AddFontFromFileTTF("resources/Fonts/OpenSans-Regular.ttf", 16.0);
io.Fonts->AddFontFromFileTTF("resources/Fonts/Poppins-Regular.ttf", 16.0);
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
ImGui::StyleColorsDark();