CyberEngineMkIII
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CYBWin32Console.cpp
Go to the documentation of this file.
1 #include "CYB.hpp"
3 
4 using namespace CYB::Platform::Win32;
5 
7  Core().FModuleManager.Call<Modules::Kernel32::AllocConsole>();
8  Core().FModuleManager.Call<Modules::Kernel32::SetConsoleOutputCP>(static_cast<UINT>(CP_UTF8));
10 }
11 
12 void CYB::Platform::System::Console::WriteOut(const CYB::API::String::CStyle& AMessage, const bool AError) noexcept {
13  //fire and forget approach
14  auto& MM(Core().FModuleManager);
15  DWORD OutWritten;
16  MM.Call<Modules::Kernel32::WriteConsoleA>(MM.Call<Modules::Kernel32::GetStdHandle>(AError ? STD_ERROR_HANDLE : STD_OUTPUT_HANDLE), AMessage.CString(), static_cast<DWORD>(AMessage.RawLength()), &OutWritten, nullptr);
17 }
void Show(void) noexcept
Show a window with console output. Will automatically be called if an error is logged.
Platform::Modules::Manager FModuleManager
Loads and contains required modules.
Definition: CYBCore.hpp:20
static void WriteOut(const API::String::CStyle &AMessage, const bool AError) noexcept
Write to either stdout or stderr depending on AError.
A basic char contained string.
Definition: CStyleString.hpp:7
Precompiled header for inter-engine operations.
Engine::Core & Core(void) noexcept
Retrieve the Core singleton.
Definition: CYBCore.cpp:69
auto Call(AArgs &&...AArguments)
Call a loaded function.