Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
console.h
1 #pragma once
2 
3 #include <DirectXMath.h>
4 #include "core/debug/debug_window.h"
5 #include "util/string.h"
6 #include "util/utility.h"
7 #include "util/tuple.h"
8 #include "util/ring_buffer.h"
9 #include "util/functional.h"
10 #include <time.h>
11 
12 namespace blowbox
13 {
19  class Console : public DebugWindow
20  {
21  public:
23  struct Message
24  {
27  DirectX::XMFLOAT4 color;
28  };
29 
30  Console();
31  ~Console();
32 
34  void RenderMenu() override;
35 
37  void RenderWindow() override;
38 
43  void LogStatus(const String& message);
44 
49  void LogWarning(const String& message);
50 
55  void LogError(const String& message);
56 
62  void Log(const String& message, const DirectX::XMFLOAT4& color);
63 
65  void Clear();
66 
67  protected:
72  void AddMessage(Message& message);
73 
74  private:
76  bool auto_scroll_;
79  };
80 }
bool show_console_window_
Whether the console window is shown.
Definition: console.h:77
bool auto_scroll_
Whether the console window should auto scroll to the newest message.
Definition: console.h:76
void Clear()
Clears all messages from the console.
Definition: console.cc:111
String time_stamp
The timestamp of this message.
Definition: console.h:25
void RenderMenu() override
Renders the menu for the Console.
Definition: console.cc:25
Base class for DebugWindows.
Definition: debug_window.h:8
void RenderWindow() override
Renders the actual window for the Console.
Definition: console.cc:144
void LogWarning(const String &message)
Logs a warning message in the console.
Definition: console.cc:71
Operates a console to which you can send messages.
Definition: console.h:19
Describes a message.
Definition: console.h:23
bool new_message_added_
Whether a new message has been added.
Definition: console.h:75
String message
The contents of the message.
Definition: console.h:26
eastl::ring_buffer< T > RingBuffer
Typedef for wrapping the EASTL ring_buffer.
Definition: ring_buffer.h:14
eastl::string String
Typedef for wrapping the EASTL string.
Definition: string.h:13
void Log(const String &message, const DirectX::XMFLOAT4 &color)
Logs a message in the console.
Definition: console.cc:101
void LogStatus(const String &message)
Logs a status message in the console.
Definition: console.cc:56
void LogError(const String &message)
Logs an error message in the console.
Definition: console.cc:86
The main Blowbox namespace.
Definition: image.cc:8
void AddMessage(Message &message)
Adds a Message to the console.
Definition: console.cc:117
DirectX::XMFLOAT4 color
The color that the message should be displayed as.
Definition: console.h:27
RingBuffer< Message > message_buffer_
All messages in the console.
Definition: console.h:78