Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bugs #40

Merged
merged 1 commit into from
Oct 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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