summaryrefslogtreecommitdiffstats
path: root/src/app.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.cpp')
-rw-r--r--src/app.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/app.cpp b/src/app.cpp
index e58c85d..cf7b6be 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -169,6 +169,23 @@ int App::dispatch_pending_events() {
return -1;
}
+bool App::pop_pending_events() {
+ bool x{true};
+ return this->pending_events.compare_exchange_strong(
+ x, false, std::memory_order_consume);
+}
+
+void App::set_pending_events() {
+ this->pending_events.store(true, std::memory_order_release);
+}
+
+optional<int> App::lookup_id(char const *name) {
+ return this->id_alloc.lookup(std::string(name));
+}
+optional<std::string> App::lookup_name(int id) {
+ return this->id_alloc.lookup(id);
+}
+
// _ _ _ _ _ ____
// (_)_ __ (_) |_ | | __ _ _ _ ___ _ _| |_ / /\ \
// | | '_ \| | __| | |/ _` | | | |/ _ \| | | | __| | | |
@@ -587,6 +604,10 @@ char const *App::api_enddraw(char const *drawing_name) {
return "No EndDraw pending for surface";
}
+void App::api_ping() {
+ this->dispatch_pending_events();
+}
+
// _ _ _____ _
// _ __ _ __ _____ _(_) ___ __| | | ____|_ _____ _ __ | |_ ___
// | '_ \| '__/ _ \ \/ / |/ _ \/ _` | | _| \ \ / / _ \ '_ \| __/ __|