private bool HandleInput() { var hasInput = _frameBuffered == null || Device.Events.Count > 0; if (hasInput) { Nuklear.nk_input_begin(_nuklearContext); while (Device.Events.Count > 0) { var deviceEvent = Device.Events.Dequeue(); switch (deviceEvent.Type) { case NuklearEvent.EventType.MouseButton: Nuklear.nk_input_button( _nuklearContext, (nk_buttons)deviceEvent.Button, deviceEvent.X, deviceEvent.Y, deviceEvent.IsDown ? 1 : 0 ); break; case NuklearEvent.EventType.MouseMove: Nuklear.nk_input_motion(_nuklearContext, deviceEvent.X, deviceEvent.Y); break; case NuklearEvent.EventType.Scroll: Nuklear.nk_input_scroll( _nuklearContext, new nk_vec2 { x = deviceEvent.ScrollX, y = deviceEvent.ScrollY } ); break; case NuklearEvent.EventType.Text: for (var i = 0; i < deviceEvent.Text.Length; i++) { if (!char.IsControl(deviceEvent.Text[i])) { Nuklear.nk_input_unicode(_nuklearContext, deviceEvent.Text[i]); } } break; case NuklearEvent.EventType.KeyboardKey: Nuklear.nk_input_key(_nuklearContext, deviceEvent.Key, deviceEvent.IsDown ? 1 : 0); break; case NuklearEvent.EventType.ForceUpdate: break; default: throw new NotSupportedException("This event type is not supported."); } } Nuklear.nk_input_end(_nuklearContext); } return(hasInput); }