-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
72 lines (56 loc) · 1.98 KB
/
main.cpp
File metadata and controls
72 lines (56 loc) · 1.98 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
// For test propose.
#include "scg.h"
#include <iostream>
using namespace scg;
int main() {
master m;
window w = window(10, 15);
w.Title = "Window";
check_group ch;
checkbox c = checkbox("Example", 1, 12, false, &ch);
checkbox d = checkbox("Another", 1, 12, true, &ch);
button l = button("Test", 1, 4);
input ip = input(5, 5);
c.OnStatusChange += [&](event_args e) {
if (c.IsChecked) {
m.BarPrompt("Example is checked", pixel_colors::Generate(text_blue + text_background, text_white + text_intensity + text_foreground));
//l.Text = "HeyG";
w.ResizeControl("Label1", 1, 6);
l.IsActived = true;
}
else {
m.BarClean();
l.IsActived = false;
}
};
ip.OnChange += [&](event_args e) {
m.BarPrompt(string("Input: ") + ip.Text.GetValue(), pixel_colors::Generate(text_black + text_background, text_white + text_intensity + text_foreground, text_bold));
l.Text = ip.Text.GetValue();
};
w += control_set(&c, "Check1", coords(1, 1));
w += control_set(&d, "Check2", coords(2, 1));
w += control_set(&l, "Label1", coords(3, 1));
w += control_set(&ip, "Input1", coords(4, 1));
//button BlueBetter = button("BlueBetter", 1, 10);
//w += control_set(&BlueBetter, "BlueBetter", coords(1, 0));
m += control_set(&w, "Main", coords(3, 3));
window antw = window(8,8);
antw.Title = "Timer";
label lb = label("0", 1, 5);
long long counter = 0;
timer t = timer(1000);
t.ToCall += [&](event_args e) {
counter++;
lb.Text = to_string(counter);
//m.BarPrompt(string("Timer: ") + to_string(counter), pixel_colors::Generate(text_black + text_background, text_white + text_intensity + text_foreground));
};
antw += control_set(&lb, "Label2", coords(1, 1));
l.OnClick += [&](event_args e) {
m.BarPrompt("Button is clicked", pixel_colors::Generate(text_green + text_background, text_white + text_intensity + text_foreground));
t.IgniteMe(&m);
};
//m += control_set(&t, "Timer1", coords(1, 1));
m += control_set(&antw, "Window2", coords(11, 12));
m.MainLoop();
return 0;
}