void HandleEvent(IntPtr eventHandle) { var e = ScreenEvent.FromEventHandle(eventHandle); if (e.Type == EventType.SCREEN_EVENT_CLOSE || e.Type == EventType.SCREEN_EVENT_CREATE) { if (HandleWindowEvent(e)) { return; } } switch (e.Type) { case EventType.SCREEN_EVENT_CLOSE: if (OnCloseWindow != null) { OnCloseWindow(e); } break; case EventType.SCREEN_EVENT_CREATE: if (OnCreateWindow != null) { OnCreateWindow(e); } break; case EventType.SCREEN_EVENT_MTOUCH_TOUCH: if (OnFingerTouch != null) { OnFingerTouch(e.X, e.Y); } break; case EventType.SCREEN_EVENT_MTOUCH_MOVE: if (OnFingerMove != null) { OnFingerMove(e.X, e.Y); } break; case EventType.SCREEN_EVENT_MTOUCH_RELEASE: if (OnFingerRelease != null) { OnFingerRelease(e.X, e.Y); } break; default: Console.WriteLine("UNHANDLED SCREEN EVENT, TYPE: {0}", e.Type); if (e.Type == EventType.SCREEN_EVENT_PROPERTY) { Console.WriteLine(" - Name: {0}", (Property)e.GetIntProperty(Property.SCREEN_PROPERTY_NAME)); } break; } }
bool HandleWindowEvent(ScreenEvent ev) { var handle = ev.GetIntPtrProperty(Property.SCREEN_PROPERTY_WINDOW); if (!windows.ContainsKey(handle)) { return(false); } windows [handle].HandleEvent(ev); return(true); }
internal bool HandleEvent(ScreenEvent ev) { Debug.Print("Window {0}: Shall handle {1} event.", Handle, ev.Type); switch (ev.Type) { case EventType.SCREEN_EVENT_CLOSE: if (OnClose != null) { OnClose(); return(true); } break; case EventType.SCREEN_EVENT_CREATE: if (OnCreate != null) { OnCreate(); return(true); } break; } return(false); }
internal bool HandleEvent(ScreenEvent ev) { Debug.Print ("Window {0}: Shall handle {1} event.", Handle, ev.Type); switch (ev.Type) { case EventType.SCREEN_EVENT_CLOSE: if (OnClose != null) { OnClose (); return true; } break; case EventType.SCREEN_EVENT_CREATE: if (OnCreate != null) { OnCreate (); return true; } break; } return false; }
void HandleEvent(IntPtr eventHandle) { var e = ScreenEvent.FromEventHandle(eventHandle); if (e.Type == EventType.SCREEN_EVENT_CLOSE || e.Type == EventType.SCREEN_EVENT_CREATE) { if (HandleWindowEvent(e)) { return; } } switch (e.Type) { case EventType.SCREEN_EVENT_CLOSE: if (OnCloseWindow != null) { OnCloseWindow(e); } break; case EventType.SCREEN_EVENT_CREATE: if (OnCreateWindow != null) { OnCreateWindow(e); } break; case EventType.SCREEN_EVENT_MTOUCH_TOUCH: if (OnFingerTouch != null) { OnFingerTouch(e.X, e.Y); } break; case EventType.SCREEN_EVENT_MTOUCH_MOVE: if (OnFingerMove != null) { OnFingerMove(e.X, e.Y); } break; case EventType.SCREEN_EVENT_MTOUCH_RELEASE: if (OnFingerRelease != null) { OnFingerRelease(e.X, e.Y); } break; case EventType.SCREEN_EVENT_KEYBOARD: if (OnKeyDown == null && OnKeyRepeat == null && OnKeyUp == null) { break; } KeyFlags flags = (KeyFlags)e.GetIntProperty(Property.SCREEN_PROPERTY_KEY_FLAGS); KeyCode code = (KeyCode)e.GetIntProperty(Property.SCREEN_PROPERTY_KEY_SYM); KeyModifiers mods = (KeyModifiers)e.GetIntProperty(Property.SCREEN_PROPERTY_KEY_MODIFIERS); if (flags.HasFlag(KeyFlags.KEY_DOWN) && OnKeyDown != null) { OnKeyDown(code, mods); } else if (flags.HasFlag(KeyFlags.KEY_REPEAT) && OnKeyRepeat != null) { OnKeyRepeat(code, mods); } else if (OnKeyUp != null) { OnKeyUp(code, mods); } break; default: Console.WriteLine("UNHANDLED SCREEN EVENT, TYPE: {0}", e.Type); if (e.Type == EventType.SCREEN_EVENT_PROPERTY) { Console.WriteLine(" - Name: {0}", (Property)e.GetIntProperty(Property.SCREEN_PROPERTY_NAME)); } else if (e.Type == EventType.SCREEN_EVENT_DEVICE || e.Type == EventType.SCREEN_EVENT_GAMEPAD || e.Type == EventType.SCREEN_EVENT_JOYSTICK || e.Type == EventType.SCREEN_EVENT_POINTER) { Console.WriteLine(" - Buttons: {0}", e.GetIntProperty(Property.SCREEN_PROPERTY_BUTTONS)); } break; } }
bool HandleWindowEvent(ScreenEvent ev) { var handle = ev.GetIntPtrProperty (Property.SCREEN_PROPERTY_WINDOW); if (!windows.ContainsKey (handle)) { return false; } windows [handle].HandleEvent (ev); return true; }