-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathterm.hpp
139 lines (114 loc) · 3.68 KB
/
term.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
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
134
135
136
137
138
139
#pragma once
//=====================================================================//
/*! @file
@brief ターミナル・クラス
@author 平松邦仁 ([email protected])
@copyright Copyright (C) 2019, 2022 Kunihito Hiramatsu @n
Released under the MIT license @n
https://github.com/hirakuni45/RX/blob/master/LICENSE
*/
//=====================================================================//
#include "gui/widget.hpp"
namespace gui {
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
/*!
@brief ターミナル・クラス
*/
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
struct term : public widget {
typedef term value_type;
static constexpr uint32_t SX = 80;
static constexpr uint32_t SY = 24;
private:
struct cha_t {
uint8_t code;
bool draw;
cha_t() noexcept : code(0), draw(false) { }
};
cha_t cha_[SX * SY];
public:
//-----------------------------------------------------------------//
/*!
@brief コンストラクター
@param[in] loc ロケーション
*/
//-----------------------------------------------------------------//
term(const vtx::srect& loc = vtx::srect(0)) noexcept :
widget(loc, nullptr), cha_{ }
{
insert_widget(this);
}
term(const term& th) = delete;
term& operator = (const term& th) = delete;
//-----------------------------------------------------------------//
/*!
@brief デストラクタ
*/
//-----------------------------------------------------------------//
virtual ~term() noexcept { remove_widget(this); }
//-----------------------------------------------------------------//
/*!
@brief 型整数を取得
@return 型整数
*/
//-----------------------------------------------------------------//
const char* get_name() const noexcept override { return "Term"; }
//-----------------------------------------------------------------//
/*!
@brief ID を取得
@return ID
*/
//-----------------------------------------------------------------//
ID get_id() const noexcept override { return ID::TERM; }
//-----------------------------------------------------------------//
/*!
@brief 初期化
*/
//-----------------------------------------------------------------//
void init() noexcept override { }
//-----------------------------------------------------------------//
/*!
@brief タッチ判定を更新
@param[in] pos 判定位置
@param[in] num タッチ数
@param[in] slt スライド・タイプの場合「true」
*/
//-----------------------------------------------------------------//
void update_touch(const vtx::spos& pos, uint16_t num) noexcept override { }
//-----------------------------------------------------------------//
/*!
@brief 選択推移
*/
//-----------------------------------------------------------------//
void exec_select() noexcept override { }
//-----------------------------------------------------------------//
/*!
@brief 許可・不許可
@param[in] ena 不許可の場合「false」
*/
//-----------------------------------------------------------------//
void enable(bool ena = true) override
{
}
//-----------------------------------------------------------------//
/*!
@brief 描画
@param[in] rdr レンダリングクラス
*/
//-----------------------------------------------------------------//
template<class RDR>
void draw(RDR& rdr) noexcept
{
auto r = vtx::srect(get_final_position(), get_location().size);
for(auto& c : cha_) {
// uint8_t inten = 64;
// if(c.level) {
// inten = 192;
// }
if(c.draw || get_state() == STATE::STALL) {
}
rdr.fill_box(r);
}
}
};
}