sys: Enable logging colors on Windows, hide console
Console log can still be seen now when running ImHex through the console but the window won't pop up by default anymore
This commit is contained in:
parent
66f94a452d
commit
2362e7a11f
@ -114,11 +114,7 @@ macro(configurePackageCreation)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
if (CMAKE_BUILD_TYPE EQUAL "DEBUG")
|
set(application_type)
|
||||||
set(application_type WIN32)
|
|
||||||
else ()
|
|
||||||
set(application_type)
|
|
||||||
endif ()
|
|
||||||
set(imhex_icon "${CMAKE_SOURCE_DIR}/res/resource.rc")
|
set(imhex_icon "${CMAKE_SOURCE_DIR}/res/resource.rc")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-multiple-definition")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-multiple-definition")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wl,-subsystem,windows")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wl,-subsystem,windows")
|
||||||
|
@ -23,12 +23,7 @@ namespace hex {
|
|||||||
|
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
friend void *ImHexSettingsHandler_ReadOpenFn(ImGuiContext *ctx, ImGuiSettingsHandler *, const char *);
|
static void initNative();
|
||||||
friend void ImHexSettingsHandler_ReadLine(ImGuiContext*, ImGuiSettingsHandler *handler, void *, const char* line);
|
|
||||||
friend void ImHexSettingsHandler_ApplyAll(ImGuiContext *ctx, ImGuiSettingsHandler *handler);
|
|
||||||
friend void ImHexSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler *handler, ImGuiTextBuffer *buf);
|
|
||||||
|
|
||||||
void setFont(const std::filesystem::path &font_path);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupNativeWindow();
|
void setupNativeWindow();
|
||||||
@ -47,6 +42,12 @@ namespace hex {
|
|||||||
void deinitGLFW();
|
void deinitGLFW();
|
||||||
void deinitImGui();
|
void deinitImGui();
|
||||||
|
|
||||||
|
friend void *ImHexSettingsHandler_ReadOpenFn(ImGuiContext *ctx, ImGuiSettingsHandler *, const char *);
|
||||||
|
friend void ImHexSettingsHandler_ReadLine(ImGuiContext*, ImGuiSettingsHandler *handler, void *, const char* line);
|
||||||
|
friend void ImHexSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler *handler, ImGuiTextBuffer *buf);
|
||||||
|
|
||||||
|
void setFont(const std::filesystem::path &font_path);
|
||||||
|
|
||||||
GLFWwindow* m_window = nullptr;
|
GLFWwindow* m_window = nullptr;
|
||||||
|
|
||||||
float m_globalScale = 1.0F, m_fontScale = 1.0F;
|
float m_globalScale = 1.0F, m_fontScale = 1.0F;
|
||||||
|
@ -5,12 +5,13 @@
|
|||||||
#include "init/splash_window.hpp"
|
#include "init/splash_window.hpp"
|
||||||
#include "init/tasks.hpp"
|
#include "init/tasks.hpp"
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
using namespace hex;
|
using namespace hex;
|
||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
{
|
{
|
||||||
|
Window::initNative();
|
||||||
|
|
||||||
init::WindowSplash splashWindow(argc, argv);
|
init::WindowSplash splashWindow(argc, argv);
|
||||||
|
|
||||||
for (const auto &[name, task] : init::getInitTasks())
|
for (const auto &[name, task] : init::getInitTasks())
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
|
|
||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
|
void Window::initNative() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Window::setupNativeWindow() {
|
void Window::setupNativeWindow() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
|
|
||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
|
void Window::initNative() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Window::setupNativeWindow() {
|
void Window::setupNativeWindow() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -122,16 +122,31 @@
|
|||||||
return CallWindowProc((WNDPROC)oldWndProc, hwnd, uMsg, wParam, lParam);
|
return CallWindowProc((WNDPROC)oldWndProc, hwnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Window::initNative() {
|
||||||
|
auto hConsoleWindow = ::GetConsoleWindow();
|
||||||
|
::ShowWindow(hConsoleWindow, FALSE);
|
||||||
|
|
||||||
|
auto hConsole = ::GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
if (hConsole != INVALID_HANDLE_VALUE) {
|
||||||
|
DWORD mode = 0;
|
||||||
|
if (::GetConsoleMode(hConsole, &mode)) {
|
||||||
|
mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
||||||
|
::SetConsoleMode(hConsole, mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Window::setupNativeWindow() {
|
void Window::setupNativeWindow() {
|
||||||
auto hwnd = glfwGetWin32Window(this->m_window);
|
auto hwnd = glfwGetWin32Window(this->m_window);
|
||||||
|
|
||||||
oldWndProc = SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)wndProcImHex);
|
oldWndProc = ::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)wndProcImHex);
|
||||||
|
|
||||||
MARGINS borderless = {1,1,1,1};
|
MARGINS borderless = {1,1,1,1};
|
||||||
DwmExtendFrameIntoClientArea(hwnd, &borderless);
|
::DwmExtendFrameIntoClientArea(hwnd, &borderless);
|
||||||
|
|
||||||
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS | SWP_NOSIZE | SWP_NOMOVE);
|
::SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS | SWP_NOSIZE | SWP_NOMOVE);
|
||||||
SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_POPUP | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CAPTION | WS_SYSMENU);
|
::SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_POPUP | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CAPTION | WS_SYSMENU);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::updateNativeWindow() {
|
void Window::updateNativeWindow() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user