KisaragiLibrary
 
読み取り中…
検索中…
一致する文字列を見つけられません
Kisaragi_Lib::Debug::Debug_Impl クラス

公開メンバ関数

 Debug_Impl ()
 
 ~Debug_Impl ()
 
void Clear ()
 
void Print (const std::string &_in)
 
void PrintLine (const std::string &_in)
 
void PrintWarning (const std::string &_in)
 
void PrintAssert (const std::string &_in)
 

非公開メンバ関数

void Init ()
 
void End ()
 

非公開変数類

std::once_flag isInit
 
HANDLE hConsole = nullptr
 

構築子と解体子

◆ Debug_Impl()

Kisaragi_Lib::Debug::Debug_Impl::Debug_Impl ( )
inline
54 {
55 std::call_once(isInit, [this] {Init(); });
56 }
std::once_flag isInit
Definition Debug.cpp:15
void Init()
Definition Debug.cpp:18

◆ ~Debug_Impl()

Kisaragi_Lib::Debug::Debug_Impl::~Debug_Impl ( )
inline
59 {
60 End();
61 }
void End()
Definition Debug.cpp:46

関数詳解

◆ Init()

void Kisaragi_Lib::Debug::Debug_Impl::Init ( )
inlineprivate
19 {
20 if (hConsole == nullptr)
21 {
22 //デバッグ用にコンソールを呼び出す
23 AllocConsole();
24
25 // コンソールの標準出力を設定する
26 FILE* stdout_file;
27 freopen_s(&stdout_file, "CONOUT$", "w", stdout);
28
29 // コンソールの標準入力を設定する
30 FILE* stdin_file;
31 freopen_s(&stdin_file, "CONIN$", "r", stdin);
32
33 //Consoleのハンドルを取得
34 hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
35
36 // デバッグコンソールがアクティブウィンドウになるので
37 // ゲーム本体のウィンドウをアクティブにする
38 SetForegroundWindow(GetMainWindowHandle());
39
40 //Consoleの出力文字色をset
41 SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
42 }
43
44 }
HANDLE hConsole
Definition Debug.cpp:16

参照元 Debug_Impl().

◆ End()

void Kisaragi_Lib::Debug::Debug_Impl::End ( )
inlineprivate
47 {
48 FreeConsole();
49 }

参照元 ~Debug_Impl().

◆ Clear()

void Kisaragi_Lib::Debug::Debug_Impl::Clear ( )
inline
64 {
65 system("cls");
66 }

◆ Print()

void Kisaragi_Lib::Debug::Debug_Impl::Print ( const std::string & _in)
inline
69 {
70 std::cout << _in;
71 }

◆ PrintLine()

void Kisaragi_Lib::Debug::Debug_Impl::PrintLine ( const std::string & _in)
inline
74 {
75 std::cout << _in << std::endl;
76 }

◆ PrintWarning()

void Kisaragi_Lib::Debug::Debug_Impl::PrintWarning ( const std::string & _in)
inline
79 {
80
81 //文字色を設定
82 SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN);
83 //出力
84 std::cout << _in << std::endl;
85 //文字色を元に戻す
86 SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
87 }

◆ PrintAssert()

void Kisaragi_Lib::Debug::Debug_Impl::PrintAssert ( const std::string & _in)
inline
90 {
91 //文字色を設定
92 SetConsoleTextAttribute(hConsole, FOREGROUND_RED);
93 //出力
94 std::cout << _in << std::endl;
95 //文字色を元に戻す
96 SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
97 }

メンバ詳解

◆ isInit

std::once_flag Kisaragi_Lib::Debug::Debug_Impl::isInit
private

参照元 Debug_Impl().

◆ hConsole

HANDLE Kisaragi_Lib::Debug::Debug_Impl::hConsole = nullptr
private

このクラス詳解は次のファイルから抽出されました: