#include <stddef.h>
#include <algorithm>
#include <memory>
#include <string>
#include <utility>
#include <vector>
std::string codes;
for (
auto& it : event.
input()) {
codes += " " + std::to_string((unsigned int)it);
}
return codes;
}
auto screen = ScreenInteractive::TerminalOutput();
std::vector<Event> keys;
auto left_column = Renderer([&] {
text("Codes"),
separator(),
};
for (size_t i = std::max(0, (int)keys.size() - 20); i < keys.size(); ++i) {
children.push_back(text(
Code(keys[i])));
}
return vbox(children);
});
auto right_column = Renderer([&] {
text("Event"),
separator(),
};
for (size_t i = std::max(0, (int)keys.size() - 20); i < keys.size(); ++i) {
children.push_back(text(keys[i].DebugString()));
}
return vbox(children);
});
int split_size = 40;
auto component = ResizableSplitLeft(left_column, right_column, &split_size);
keys.push_back(event);
return false;
});
}
const std::string & input() const
代表一個事件。它可以是按鍵事件、終端機大小調整,或更多...
std::vector< Element > Elements
std::string Code(Event event)