Skip to content

Commit

Permalink
Fixed bugs
Browse files Browse the repository at this point in the history
keyboard input enabled again, slider compilation error fixed
  • Loading branch information
drug007 committed Oct 2, 2022
1 parent e0c1bd6 commit cdf5533
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion source/nanogui/sdlapp.d
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
5 changes: 5 additions & 0 deletions source/nanogui/sdlbackend.d
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions source/nanogui/slider.d
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit cdf5533

Please sign in to comment.