Add more documentation.

This commit is contained in:
ArthurSonzogni
2020-08-16 02:24:50 +02:00
committed by Arthur Sonzogni
parent f2dc080a35
commit 114ab4ae2a
33 changed files with 310 additions and 144 deletions

View File

@@ -241,17 +241,23 @@ static const std::vector<std::vector<std::vector<std::wstring>>> elements = {
L" LOLLOL ",
}}};
Element spinner(int c, size_t index) {
if (c == 0) {
index %= 40;
if (index > 20)
index = 40 - index;
return gauge(index * 0.05);
/// @brief Useful to represent the effect of time and/or events. This display an
/// ASCII art "video".
/// @param charset_index The type of "video".
/// @param image_index The "frame" of the video. You need to increase this for
///every "step".
/// @ingroup dom
Element spinner(int charset_index, size_t image_index) {
if (charset_index == 0) {
image_index %= 40;
if (image_index > 20)
image_index = 40 - image_index;
return gauge(image_index * 0.05);
}
c %= elements.size();
index %= elements[c].size();
charset_index %= elements.size();
image_index %= elements[charset_index].size();
std::vector<Element> lines;
for (const auto& it : elements[c][index])
for (const auto& it : elements[charset_index][image_index])
lines.push_back(text(it));
return vbox(std::move(lines));
}