-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScipturesEngine.h
More file actions
133 lines (106 loc) · 2.64 KB
/
Copy pathScipturesEngine.h
File metadata and controls
133 lines (106 loc) · 2.64 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#pragma once
#include <string>
#include <iostream>
#include <Windows.h>
#include "keycodes.h"
#ifndef __SCRIPTURES_ENGINE_H__
#define __SCRIPTURES_ENGINE_H__
#ifndef SCRIPTURES_VERSION
#define SCRIPTURES_VERSION 1.1.0
#endif
#ifdef SCIPTURES_EXPORT
#define SCRIPTURES_API __declspec(dllexport)
#else
#define SCRIPTURES_API __declspec(dllimport)
#endif
using namespace std;
namespace scriptures {
enum SCRIPTURES_API ConsoleColor {
BLACK = 0x0,
BLUE = 0x1,
GREEN = 0x2,
BLUE_GREY = 0x3,
RED = 0x4,
PURPLE = 0x5,
YELLOW = 0x6,
WHITE = 0x7,
GREY = 0x8,
LITE_BLUE = 0x9,
LITE_GREEN = 0xA,
CYAN = 0xB,
LITE_RED = 0xC,
LITE_PURPLE = 0xD,
LITE_YELLOW = 0xE,
SHINING_WHITE = 0xF
};
class SCRIPTURES_API Window;
class SCRIPTURES_API InputHandler
{
public:
InputHandler();
void Initialize(Window* w);
void ReadInputs();
bool GetKeyDown(KeyCode kc);
bool GetKey(KeyCode kc);
private:
void CheckInit();
Window* pWindow;
unsigned char fInput[32]; //Inputs down on this frame
unsigned char pInput[32]; //Inputs held from other frames
};
class SCRIPTURES_API Window
{
public:
Window();
Window SetSize(int w, int h);
Window SetTitle(string title);
void SetCursorPosition(int x, int y);
COORD GetCursorPosition();
HANDLE GetConsoleHandle(bool input);
BOOL _SetConsoleSize(int cols, int rows);
//Write
void Write(string txt, int x, int y, ConsoleColor foreground, ConsoleColor background);
void Write(string txt, int x, int y, ConsoleColor foreground);
void Write(string txt, int x, int y);
void Write(string txt);
void Write(string txt, ConsoleColor foreground, ConsoleColor background);
void Write(string txt, ConsoleColor foreground);
void Clear();
void ClearLine();
void ClearLine(int y);
//Game Loops
void Update();
scriptures::InputHandler _inputHandler;
private:
int width = 0;
int height = 0;
int pWidth = 0;
int pHeight = 0;
HWND console;
HANDLE hInput;
HANDLE hOutput;
};
class SCRIPTURES_API Tablet // a subscreen basically
{
public:
Tablet(Window* window, int x, int y, int w, int h);
void SetCursorPosition(int x, int y);
//Write
void Write(string txt, int x, int y, ConsoleColor foreground, ConsoleColor background);
void Write(string txt, int x, int y, ConsoleColor foreground);
void Write(string txt, int x, int y);
void Write(string txt);
void Write(string txt, ConsoleColor foreground, ConsoleColor background);
void Write(string txt, ConsoleColor foreground);
void Clear();
void ClearLine();
void ClearLine(int y);
private:
Window* pWindow;
int xpos = 0;
int ypos = 0;
int width = 0;
int height = 0;
};
}
#endif