Last active
July 13, 2020 12:39
-
-
Save aberba/8b44fa0d57df0551fda24401dca5c205 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.datetime : Clock; | |
import std.stdio; | |
import arsd.simpledisplay; | |
import arsd.nanovega; | |
import nanogui.sdlbackend : SdlBackend; | |
class MyGui : SdlBackend | |
{ | |
this(int w, int h, string title) | |
{ | |
super(w, h, title); | |
} | |
override void onVisibleForTheFirstTime() | |
{ | |
import nanogui.screen : Screen; | |
import nanogui.widget, nanogui.theme, nanogui.checkbox, nanogui.label, | |
nanogui.common, nanogui.window, nanogui.layout, nanogui.button, nanogui.popupbutton, | |
nanogui.entypo, nanogui.popup, nanogui.vscrollpanel, | |
nanogui.combobox, nanogui.textbox; | |
{ | |
auto window = new Window(screen, "Button demo"); | |
window.position(Vector2i(15, 15)); | |
window.size = Vector2i(screen.size.x - 30, screen.size.y - 30); | |
window.layout(new GroupLayout()); | |
auto label = new Label(window, "Label"); | |
label.position = Vector2i(100, 300); | |
label.size = label.preferredSize(ctx); | |
auto txtBox = new TextBox(window); | |
txtBox.editable = true; | |
txtBox.callback((string text) { label.caption = text; return true; }); | |
window.tooltip = "Button demo tooltip"; | |
} | |
// now we should do layout manually yet | |
screen.performLayout(ctx); | |
} | |
} | |
void main() | |
{ | |
auto gui = new MyGui(1000, 800, "Nanogui using arsd.simpledisplay"); | |
gui.run(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment