Sfoglia il codice sorgente

initial touch support

seibelj 8 anni fa
parent
commit
63e2cbafb6
1 ha cambiato i file con 13 aggiunte e 0 eliminazioni
  1. 13 0
      demo/allegro5/nuklear_allegro5.h

+ 13 - 0
demo/allegro5/nuklear_allegro5.h

@@ -309,6 +309,19 @@ nk_allegro5_handle_event(ALLEGRO_EVENT *ev)
             }
             nk_input_button(ctx, button, ev->mouse.x, ev->mouse.y, ev->type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN);
         } break;
+        case ALLEGRO_EVENT_TOUCH_BEGIN:
+        case ALLEGRO_EVENT_TOUCH_END: {
+            if (ev->touch.display != allegro5.dsp) {
+                return;
+            }
+            nk_input_button(ctx, NK_BUTTON_LEFT, ev->touch.x, ev->touch.y, ev->type == ALLEGRO_EVENT_TOUCH_BEGIN);
+        } break;
+        case ALLEGRO_EVENT_TOUCH_MOVE: {
+            if (ev->touch.display != allegro5.dsp) {
+                return;
+            }
+            nk_input_motion(ctx, ev->touch.x, ev->touch.y);
+        } break;
         case ALLEGRO_EVENT_KEY_DOWN:
         case ALLEGRO_EVENT_KEY_UP: {
             if (ev->keyboard.display != allegro5.dsp) {