Add touch support
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user