Add a read-only native live-ticker demo with finite fixtures (by Codex)
This commit is contained in:
1 parent
0a54b8338e
commit
8e3d9f83e0
17 files changed
+1601
-10
No files matched your search
@@ -148,6 +148,7 @@ void App::ProcessEvent(Rml::Event &event) try {
|
||||
if (n->GetId() == "native-ticket-layer")
|
||||
return;
|
||||
if(front_event(event))return;
|
||||
if (live_event(event)) return;
|
||||
if (career_event(event)) return;
|
||||
if (entry_event(event)) return;
|
||||
if (opening_event(event)) return;
|
||||
@@ -465,6 +466,7 @@ void App::dispatch(const std::string &action, Rml::Element *target) {
|
||||
const auto id =
|
||||
target ? target->GetAttribute<Rml::String>("data-id", "") : std::string();
|
||||
if(front_action(action,target))return;
|
||||
if (live_action(action, target)) return;
|
||||
if (career_action(action,target)) return;
|
||||
if (entry_action(action, target)) return;
|
||||
if (opening_action(action, target)) return;
|
||||
@@ -924,6 +926,13 @@ void App::script() {
|
||||
context_->ProcessMouseMove(point.x + (end.x - point.x) * i / 12,
|
||||
point.y + (end.y - point.y) * i / 12, 0);
|
||||
context_->ProcessMouseButtonUp(0, 0);
|
||||
} else if (type == "wheel") {
|
||||
const auto point = locate(command);
|
||||
const float delta = command.at("delta").get<float>();
|
||||
if (!std::isfinite(delta) || std::abs(delta) > 1000)
|
||||
throw editor::Error("UI-Skript: ungültiger Mausradweg.");
|
||||
context_->ProcessMouseMove(point.x, point.y, 0);
|
||||
context_->ProcessMouseWheel(delta, 0);
|
||||
} else if (type == "text")
|
||||
context_->ProcessTextInput(command.value("value", std::string()));
|
||||
else if (type == "key") {
|
||||
@@ -934,6 +943,7 @@ void App::script() {
|
||||
{"LEFT", Rml::Input::KI_LEFT}, {"RIGHT", Rml::Input::KI_RIGHT},
|
||||
{"UP", Rml::Input::KI_UP}, {"DOWN", Rml::Input::KI_DOWN},
|
||||
{"A", Rml::Input::KI_A}, {"Z", Rml::Input::KI_Z}, {"V", Rml::Input::KI_V},
|
||||
{"P", Rml::Input::KI_P},
|
||||
{"BACKSPACE", Rml::Input::KI_BACK}, {"DELETE", Rml::Input::KI_DELETE}, {"F4", Rml::Input::KI_F4}, {"F10", Rml::Input::KI_F10}, {"CONTEXT", Rml::Input::KI_APPS},
|
||||
{"0", Rml::Input::KI_0}, {"1", Rml::Input::KI_1}, {"2", Rml::Input::KI_2}, {"3", Rml::Input::KI_3},
|
||||
{"4", Rml::Input::KI_4}, {"5", Rml::Input::KI_5}, {"6", Rml::Input::KI_6}, {"7", Rml::Input::KI_7},
|
||||
@@ -955,6 +965,7 @@ void App::script() {
|
||||
pump_events();
|
||||
front_poll();
|
||||
opening_tick();
|
||||
live_tick();
|
||||
frame();
|
||||
SDL_Delay(5);
|
||||
}
|
||||
@@ -969,6 +980,7 @@ void App::script() {
|
||||
editor::path(command.at("path").get<std::string>()),
|
||||
Json{{"scene", scene_},
|
||||
{"menu", menu_},
|
||||
{"live_view", live_snapshot()},
|
||||
{"report_picker", report_picker_},
|
||||
{"planning_dialog", planning_dialog_},
|
||||
{"bank_view", bank_view_}, {"bank_property", bank_property_}, {"bank_stock", bank_stock_},
|
||||
@@ -1000,7 +1012,7 @@ void App::script() {
|
||||
.dump(2));
|
||||
else if(type=="metrics"){
|
||||
context_->Update();Json rows=Json::array();
|
||||
for(const auto &selector:command.at("selectors")){Rml::ElementList nodes;doc_->QuerySelectorAll(nodes,selector.get<std::string>());for(auto *node:nodes){auto at=node->GetAbsoluteOffset(Rml::BoxArea::Border),size=node->GetBox().GetSize(Rml::BoxArea::Border);rows.push_back({{"selector",selector},{"id",node->GetId()},{"x",at.x},{"y",at.y},{"width",size.x},{"height",size.y},{"scroll_top",node->GetScrollTop()},{"scroll_height",node->GetScrollHeight()},{"client_height",node->GetClientHeight()},{"visible",node->IsVisible(true)}});}}
|
||||
for(const auto &selector:command.at("selectors")){Rml::ElementList nodes;doc_->QuerySelectorAll(nodes,selector.get<std::string>());for(auto *node:nodes){auto at=node->GetAbsoluteOffset(Rml::BoxArea::Border),size=node->GetBox().GetSize(Rml::BoxArea::Border);rows.push_back({{"selector",selector},{"id",node->GetId()},{"x",at.x},{"y",at.y},{"width",size.x},{"height",size.y},{"scroll_top",node->GetScrollTop()},{"scroll_height",node->GetScrollHeight()},{"client_height",node->GetClientHeight()},{"font_size",node->GetComputedValues().font_size()},{"rml",node->GetInnerRML()},{"visible",node->IsVisible(true)}});}}
|
||||
editor::write_atomic(editor::path(command.at("path").get<std::string>()),rows.dump(2));
|
||||
}
|
||||
else if (type == "dom")
|
||||
|
||||
Reference in new issue
Block a user