Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 38915484ac | |||
| 87b1e6f502 | |||
| ae822083c2 | |||
| 0c93d619c8 |
@@ -4,7 +4,7 @@ project(kte)
|
|||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(KTE_VERSION "1.2.2")
|
set(KTE_VERSION "1.2.4")
|
||||||
|
|
||||||
# Default to terminal-only build to avoid SDL/OpenGL dependency by default.
|
# Default to terminal-only build to avoid SDL/OpenGL dependency by default.
|
||||||
# Enable with -DBUILD_GUI=ON when SDL2/OpenGL/Freetype are available.
|
# Enable with -DBUILD_GUI=ON when SDL2/OpenGL/Freetype are available.
|
||||||
@@ -222,6 +222,17 @@ if (BUILD_TESTS)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (${BUILD_GUI})
|
if (${BUILD_GUI})
|
||||||
|
# ImGui::CreateContext();
|
||||||
|
# ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
|
# // Set custom ini filename path to ~/.config/kte/imgui.ini
|
||||||
|
# if (const char* home = std::getenv("HOME")) {
|
||||||
|
# static std::string ini_path = std::string(home) + "/.config/kte/imgui.ini";
|
||||||
|
# io.IniFilename = ini_path.c_str();
|
||||||
|
# }
|
||||||
|
|
||||||
|
# io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
|
# io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
||||||
target_sources(kte PRIVATE
|
target_sources(kte PRIVATE
|
||||||
Font.h
|
Font.h
|
||||||
GUIConfig.cc
|
GUIConfig.cc
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "Editor.h"
|
#include "Editor.h"
|
||||||
#include "Command.h"
|
#include "Command.h"
|
||||||
#include "GUIFrontend.h"
|
#include "GUIFrontend.h"
|
||||||
|
#include <filesystem>
|
||||||
#include "Font.h" // embedded default font (DefaultFontRegular)
|
#include "Font.h" // embedded default font (DefaultFontRegular)
|
||||||
#include "GUIConfig.h"
|
#include "GUIConfig.h"
|
||||||
#include "GUITheme.h"
|
#include "GUITheme.h"
|
||||||
@@ -76,13 +77,17 @@ GUIFrontend::Init(Editor &ed)
|
|||||||
height_ = std::max(200, h);
|
height_ = std::max(200, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1");
|
||||||
window_ = SDL_CreateWindow(
|
window_ = SDL_CreateWindow(
|
||||||
"kge - kyle's graphical editor " KTE_VERSION_STR,
|
"kge - kyle's graphical editor " KTE_VERSION_STR,
|
||||||
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||||
width_, height_,
|
width_, height_,
|
||||||
win_flags);
|
win_flags);
|
||||||
if (!window_)
|
if (!window_) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_EnableScreenSaver();
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
// macOS: when "fullscreen" is requested, position the window at the
|
// macOS: when "fullscreen" is requested, position the window at the
|
||||||
@@ -105,7 +110,25 @@ GUIFrontend::Init(Editor &ed)
|
|||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO &io = ImGui::GetIO();
|
ImGuiIO &io = ImGui::GetIO();
|
||||||
(void) io;
|
|
||||||
|
// Set custom ini filename path to ~/.config/kte/imgui.ini
|
||||||
|
if (const char *home = std::getenv("HOME")) {
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
fs::path config_dir = fs::path(home) / ".config" / "kte";
|
||||||
|
|
||||||
|
std::error_code ec;
|
||||||
|
if (!fs::exists(config_dir)) {
|
||||||
|
fs::create_directories(config_dir, ec);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fs::exists(config_dir)) {
|
||||||
|
static std::string ini_path = (config_dir / "imgui.ini").string();
|
||||||
|
io.IniFilename = ini_path.c_str();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
|
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
|
|
||||||
// Apply background mode and selected theme (default: Nord). Can be changed at runtime via commands.
|
// Apply background mode and selected theme (default: Nord). Can be changed at runtime via commands.
|
||||||
|
|||||||
Reference in New Issue
Block a user