mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-10-01 17:29:07 +08:00
Add more documentation.
This commit is contained in:

committed by
Arthur Sonzogni

parent
f2dc080a35
commit
114ab4ae2a
@@ -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));
|
||||
}
|
||||
|
Reference in New Issue
Block a user