-
Notifications
You must be signed in to change notification settings - Fork 0
/
Console.hpp
65 lines (53 loc) · 1.6 KB
/
Console.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* Pixel Paint
* SetApps.io (c) 2023
*
* console.h
* Initialize the console handle
*/
#ifndef __CONSOLE_H__
#define __CONSOLE_H__
#include "framework.hpp"
#include "input.hpp"
#include <string>
#include <vector>
class Console {
private:
// Singleton.
static Console* instance;
Console() {}
// Other members.
HANDLE StdOut, StdIn, Output;
DWORD dwInputMode, dwOldInputMode;
HWND hwndConsole;
std::wstring oldTitle;
std::wstring newTitle;
CHAR_INFO* buffer;
uint8_t zonew;
uint8_t zoneh;
public:
// Singleton.
static Console* getInstance(void) { return Console::instance; }
// Other methods.
bool init(uint8_t cells_x, uint8_t cells_y);
void close(void);
void clearScreen(void);
void updateScreen(void);
void drawChar(int x, int y, wchar_t c, short cc);
void drawString(int x, int y, std::wstring s, short cc);
void drawRect(int x, int y, int w, int h, short cc);
void drawRectOfChar(int x, int y, int w, int h, wchar_t ch);
void drawFrame(int x, int y, int w, int h, short cc);
void drawColorVector(int x, int y, const std::vector<uint8_t>& cc);
void drawColorPixel(int x, int y, short cc);
void drawChars(int x, int y, int w, int h, std::wstring s);
void drawSubString(int x, int y, std::wstring s, short cc, int start, int count);
void inputWait(InputEvent& event);
// Strange methods here but very useful.
int showDialog(std::wstring title, std::wstring content, int flags);
std::wstring showFilePicker(std::wstring title);
std::wstring showFileSaver(std::wstring title);
// Window accesors.
void setProjectTitle(std::wstring title);
void setUnsavedProjectMark(bool setMark);
};
#endif