forked from SFTtech/openage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsole.h
More file actions
80 lines (58 loc) · 1.49 KB
/
console.h
File metadata and controls
80 lines (58 loc) · 1.49 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
// Copyright 2013-2018 the openage authors. See copying.md for legal info.
#pragma once
#include <vector>
#include <SDL2/SDL.h>
#include "buf.h"
#include "../handlers.h"
#include "../coord/pixel.h"
#include "../input/input_manager.h"
#include "../util/color.h"
#include "../renderer/font/font.h"
#include "../gamedata/color.gen.h"
namespace openage {
class Engine;
/**
* In-game console subsystem. Featuring a full terminal emulator.
*/
namespace console {
class Console : InputHandler, TickHandler, HudHandler, ResizeHandler {
public:
Console(Engine *engine);
~Console();
/**
* load the consoles color table
*/
void load_colors(std::vector<gamedata::palette_color> &colortable);
/**
* register this console to the engine.
* this leads to the drawing calls, and input handling.
*/
void register_to_engine();
void set_visible(bool make_visible);
/**
* prints the given text on the console.
*/
void write(const char *text);
/**
* a temporary console command interpreter
*/
void interpret(const std::string &command);
bool on_drawhud() override;
bool on_tick() override;
bool on_input(SDL_Event *event) override;
bool on_resize(coord::viewport_delta new_size) override;
protected:
Engine *engine;
public:
coord::camhud bottomleft;
coord::camhud topright;
coord::camhud charsize;
std::vector<util::col> termcolors;
bool visible;
Buf buf;
renderer::Font font;
input::InputContext input_context;
// the command state
std::string command;
};
}} // openage::console