39 auto my_graph = [&shift](
int width,
int height) {
40 std::vector<int> output(width);
41 for (
int i = 0; i < width; ++i) {
43 v += 0.1f * sin((i + shift) * 0.1f);
44 v += 0.2f * sin((i + shift + 10) * 0.15f);
45 v += 0.1f * sin((i + shift) * 0.03f);
53 auto frequency =
vbox({
67 auto utilization =
vbox({
111 const std::vector<std::string> compiler_entries = {
117 "Compilateurs ALGOL 60",
118 "Compilateurs ALGOL 68",
119 "Assembleurs (Intel *86)",
120 "Assembleurs (Motorola 68*)",
121 "Assembleurs (Zilog Z80)",
122 "Assembleurs (autres)",
123 "Compilateurs BASIC",
125 "Compilateurs Batch",
127 "Compilateurs source à source",
130 "Compilateurs COBOL",
131 "Compilateurs Common Lisp",
133 "Compilateurs DIBOL/DBL",
134 "Interprètes ECMAScript",
135 "Compilateurs Eiffel",
136 "Compilateurs Fortran",
138 "Compilateurs Haskell",
140 "Compilateurs Pascal",
144 "Compilateurs Python",
145 "Compilateurs et interprètes Scheme",
146 "Compilateurs Smalltalk",
153 int compiler_selected = 0;
156 std::array<std::string, 8> options_label = {
162 "-Wno-class-conversion",
164 "-Wno-conversion-null",
166 std::array<bool, 8> options_state = {
167 false,
false,
false,
false,
false,
false,
false,
false,
170 std::vector<std::string> input_entries;
171 int input_selected = 0;
175 std::string input_add_content;
176 input_option.on_enter = [&] {
177 input_entries.push_back(input_add_content);
178 input_add_content =
"";
180 Component input_add =
Input(&input_add_content,
"fichiers d'entrée", input_option);
182 std::string executable_content_ =
"";
183 Component executable_ =
Input(&executable_content_,
"exécutable");
186 Checkbox(&options_label[0], &options_state[0]),
187 Checkbox(&options_label[1], &options_state[1]),
188 Checkbox(&options_label[2], &options_state[2]),
189 Checkbox(&options_label[3], &options_state[3]),
190 Checkbox(&options_label[4], &options_state[4]),
191 Checkbox(&options_label[5], &options_state[5]),
192 Checkbox(&options_label[6], &options_state[6]),
193 Checkbox(&options_label[7], &options_state[7]),
196 auto compiler_component = Container::Horizontal({
199 Container::Vertical({
201 Container::Horizontal({
208 auto render_command = [&] {
211 line.push_back(
text(compiler_entries[compiler_selected]) | bold);
213 for (
int i = 0; i < 8; ++i) {
214 if (options_state[i]) {
215 line.push_back(
text(
" "));
216 line.push_back(
text(options_label[i]) | dim);
220 if (!executable_content_.empty()) {
221 line.push_back(
text(
" -o ") | bold);
226 for (
auto& it : input_entries) {
232 auto compiler_renderer =
Renderer(compiler_component, [&] {
233 auto compiler_win =
window(
text(
"Compilateur"),
234 compiler->
Render() | vscroll_indicator | frame);
249 input->
Render() | vscroll_indicator | frame |
270 auto spinner_tab_renderer =
Renderer([&] {
272 for (
int i = 0; i < 22; ++i) {
273 entries.push_back(
spinner(i, shift / 5) | bold |
276 return hflow(std::move(entries));
282 auto color_tab_renderer =
Renderer([] {
283 auto basic_color_display =
285 text(
"Palette de 16 couleurs:"),
330 auto palette_256_color_display =
text(
"Palette de 256 couleurs:");
334 for (
auto& column : info_columns) {
336 for (
auto& it : column) {
337 column_elements.push_back(
340 columns.push_back(
hbox(std::move(column_elements)));
342 palette_256_color_display =
vbox({
343 palette_256_color_display,
351 auto true_color_display =
text(
"TrueColors: 24bits:");
353 int saturation = 255;
355 for (
int value = 0; value < 255; value += 16) {
357 for (
int hue = 0; hue < 255; hue += 6) {
358 line.push_back(
text(
"▀")
362 array.push_back(
hbox(std::move(line)));
364 true_color_display =
vbox({
367 vbox(std::move(array)),
375 palette_256_color_display,
384 auto render_gauge = [&shift](
int delta) {
385 float progress = (shift + delta) % 500 / 500.f;
387 text(std::to_string(
int(progress * 100)) +
"% ") |
393 auto gauge_component =
Renderer([render_gauge] {
418 auto make_box = [](
size_t dimx,
size_t dimy) {
419 std::string title = std::to_string(dimx) +
"x" + std::to_string(dimy);
421 text(
"contenu") | hcenter | dim) |
425 auto paragraph_renderer_left =
Renderer([&] {
427 "Lorem Ipsum est simplement un faux texte de l'industrie de "
428 "l'impression et de la composition.\nLorem Ipsum a été le texte "
429 "factice standard de l'industrie depuis les années 1500, quand un "
430 "imprimeur inconnu a pris une galère de caractères et l'a brouillée "
431 "pour en faire un livre spécimen.";
442 window(
text(
"Éléments de tailles différentes:"),
458 vscroll_indicator | yframe | flex;
461 auto paragraph_renderer_right =
Renderer([] {
462 return paragraph(
"<--- Cette barre verticale est redimensionnable avec la souris") |
467 auto paragraph_renderer_group =
469 ¶graph_renderer_split_position);
470 auto paragraph_renderer_group_renderer =
472 [&] {
return paragraph_renderer_group->Render(); });
479 std::vector<std::string> tab_entries = {
480 "htop",
"couleur",
"spinner",
"jauge",
"compilateur",
"paragraphe",
484 auto tab_content = Container::Tab(
488 spinner_tab_renderer,
491 paragraph_renderer_group_renderer,
498 auto main_container = Container::Vertical({
499 Container::Horizontal({
506 auto main_renderer =
Renderer(main_container, [&] {
510 tab_selection->Render() |
flex,
511 exit_button->Render(),
518 while (!loop.HasQuitted()) {
523 screen.RequestAnimationFrame();
529 std::this_thread::sleep_for(std::chrono::milliseconds(1000 / 60));