Add touch support

This commit is contained in:
2026-06-12 20:55:11 -04:00
parent ac5fe3b93d
commit dce713fa4f
2 changed files with 19 additions and 1 deletions
+16
View File
@@ -47,6 +47,15 @@ void reset() {
s_count = 0;
}
#if PBL_TOUCH
static void touch_handler(const TouchEvent *event, void *context) {
if (event->type == TouchEvent_Touchdown) {
increment();
update();
}
}
#endif
void select_click_handler(ClickRecognizerRef recognizer, void *context) {
increment();
update();
@@ -134,9 +143,16 @@ void init() {
s_count = persist_exists(COUNT_PKEY) ? persist_read_int(COUNT_PKEY) : 0;
window_stack_push(s_window, true);
#if PBL_TOUCH
touch_service_subscribe(touch_handler, NULL);
#endif
}
void deinit() {
#if PBL_TOUCH
touch_service_unsubscribe();
#endif
persist_write_int(COUNT_PKEY, s_count);
window_destroy(s_window);
gbitmap_destroy(s_action_icon_plus);