-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
71 lines (58 loc) · 1.66 KB
/
main.cpp
File metadata and controls
71 lines (58 loc) · 1.66 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
#include <cstdio>
#include <ftxui/component/component.hpp>
#include <ftxui/component/component_options.hpp>
#include <ftxui/component/screen_interactive.hpp>
#include <ftxui/dom/elements.hpp>
#include <ftxui/dom/flexbox_config.hpp>
#include <ftxui/dom/node.hpp>
#include <string>
using namespace ftxui;
Element ColorTile(int red, int green, int blue) {
return text("") | size(WIDTH, GREATER_THAN, 14) |
size(HEIGHT, GREATER_THAN, 7) | bgcolor(Color::RGB(red, green, blue));
}
void songChange(){}
int main(){
Elements aInfo = {text("Artist"), text("Name"), text("05:00")};
Element aImage = ColorTile(255, 123, 100);
std::vector<std::string> pElements = {"Dummy one", "Dummy two"};
int pSelected = 0;
MenuOption pOpt;
pOpt.on_change = songChange;
auto aPlaylist = Menu(&pElements, &pSelected, pOpt);
ScreenInteractive screen = ScreenInteractive::Fullscreen();
auto renderer = Renderer([&](){
Element info = hbox({
hbox({
hbox({
aImage,
separator() | color(Color::White)
}) | center,
vbox({
aInfo
}) | center,
}) | flex | borderStyled(ROUNDED, Color::White),
separator() | color(Color::Orange3),
vbox({
aPlaylist->Render()
}),
filler()
});
auto body = vbox({
hbox({
filler(), text("Yoki Music Player") | bold, filler()
}), separator() | color(Color::Orange3),
info, separator() | color(Color::Orange3)
}) | borderStyled(ROUNDED, Color::Orange3);
return body;
});
//Render(screen, body);
screen.Loop(renderer);
// getchar();
// while(1){
// //Render(screen, body);
// //screen.Print();
// // just loop
// }
return 0;
}