diff --git a/source/nanogui/sdlapp.d b/source/nanogui/sdlapp.d index b9ffd7b..7f46156 100644 --- a/source/nanogui/sdlapp.d +++ b/source/nanogui/sdlapp.d @@ -127,7 +127,7 @@ class SdlApp } auto onResize() { return _onResize; } - alias OnKeyboardChar = void delegate(dchar ch); + alias OnKeyboardChar = bool delegate(dchar ch); private OnKeyboardChar _onKeyboardChar; void onKeyboardChar(OnKeyboardChar handler) { diff --git a/source/nanogui/sdlbackend.d b/source/nanogui/sdlbackend.d index bee5c63..4e09fdd 100644 --- a/source/nanogui/sdlbackend.d +++ b/source/nanogui/sdlbackend.d @@ -144,6 +144,11 @@ class SdlBackend : Screen return super.mouseButtonCallbackEvent(btn, action, modifiers, Clock.currTime.stdTime); }; + _sdlApp.onKeyboardChar = delegate(dchar codepoint) + { + return keyboardCharacterEvent(codepoint); + }; + _sdlApp.onClose = () { if (_onClose) diff --git a/source/nanogui/slider.d b/source/nanogui/slider.d index d474d10..c9a132a 100644 --- a/source/nanogui/slider.d +++ b/source/nanogui/slider.d @@ -13,7 +13,7 @@ import std.algorithm : min, max; import arsd.nanovega; import nanogui.widget : Widget; import nanogui.common : Vector2i, MouseButton, Color, boxGradient, - fillColor, Vector2f, radialGradient, linearGradient; + fillColor, Vector2f, radialGradient, linearGradient, NanoContext; /// Fractional slider widget with mouse control class Slider(T) : Widget { @@ -170,7 +170,7 @@ public: return true; } - override void draw(NanoContext ctx) + override void draw(ref NanoContext ctx) { Vector2f center = cast(Vector2f) mPos + 0.5f * cast(Vector2f) mSize; float kr = cast(int) (mSize.y * 0.4f);