-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Marek Maškarinec <marek@mrms.cz>
- Loading branch information
1 parent
de2f23b
commit 49c2b83
Showing
3 changed files
with
199 additions
and
178 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
import ( | ||
"window.um" | ||
"rect.um" | ||
"ui.um" | ||
) | ||
|
||
var gui: ui::Gui | ||
var maxScroll, scroll: real32 | ||
|
||
const buttonCount = 30 | ||
const buttonHeight = 30 | ||
|
||
fn init*() { | ||
window::setup("Scoll Area Sample", 640, 480) | ||
|
||
gui = ui::mk(rect::fromVf2({}, window::wp), ui::getDefaultStyle()) | ||
|
||
window::onFrame.register({ | ||
layout := ui::LayoutFn{ | ||
gui.scrollArea(&scroll, buttonHeight * buttonCount, { | ||
scrollBarSize: 20 | ||
}) | ||
gui.box({ | ||
dimension: buttonHeight | ||
}) | ||
|
||
for i:=0; i < buttonHeight; i++ { | ||
if gui.qbutton(sprintf("Button %d", i)) { | ||
printf("Button %d\n", i) | ||
} | ||
} | ||
|
||
gui.popContainer() | ||
gui.popContainer() | ||
} | ||
|
||
gui.eval(layout) | ||
gui.draw(layout) | ||
}) | ||
} |
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
Oops, something went wrong.