Skip to content

Commit

Permalink
Merge pull request #40 from drug007/bugs
Browse files Browse the repository at this point in the history
Fixed bugs
drug007 authored Oct 2, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents e0c1bd6 + cdf5533 commit 11b4c8e
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
@@ -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)
{
5 changes: 5 additions & 0 deletions source/nanogui/sdlbackend.d
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 2 additions & 2 deletions source/nanogui/slider.d
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 11b4c8e

Please sign in to comment.