Add hacky way to get console output back on windows
This commit is contained in:
parent
0b52092eda
commit
9ff92aeb40
@ -17,6 +17,10 @@
|
|||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
|
#if defined(OS_WINDOWS)
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
constexpr auto MenuBarItems = { "File", "Edit", "View", "Help" };
|
constexpr auto MenuBarItems = { "File", "Edit", "View", "Help" };
|
||||||
@ -48,6 +52,21 @@ namespace hex {
|
|||||||
hex::SharedData::mainArgc = argc;
|
hex::SharedData::mainArgc = argc;
|
||||||
hex::SharedData::mainArgv = argv;
|
hex::SharedData::mainArgv = argv;
|
||||||
|
|
||||||
|
// Try to attach to a currently open console on Windows if available
|
||||||
|
#if defined(OS_WINDOWS)
|
||||||
|
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
|
||||||
|
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
if (hStdOut != INVALID_HANDLE_VALUE) {
|
||||||
|
freopen("CONOUT$", "w", stdout);
|
||||||
|
freopen("CONERR$", "w", stderr);
|
||||||
|
setvbuf(stdout, nullptr, _IONBF, 0);
|
||||||
|
setvbuf(stderr, nullptr, _IONBF, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
printf("Hello\n");
|
||||||
|
|
||||||
ContentRegistry::Settings::load();
|
ContentRegistry::Settings::load();
|
||||||
View::postEvent(Events::SettingsChanged);
|
View::postEvent(Events::SettingsChanged);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user