mirror of
https://github.com/Kapendev/parin.git
synced 2025-04-26 04:59:54 +03:00
Made mouse ui better.
This commit is contained in:
parent
e83cbd6fd1
commit
1f896ae217
4 changed files with 61 additions and 46 deletions
|
@ -2,14 +2,16 @@
|
|||
|
||||
import parin;
|
||||
|
||||
auto buttonText = "Hello world!";
|
||||
|
||||
void ready() {
|
||||
lockResolution(320, 180);
|
||||
}
|
||||
|
||||
bool update(float dt) {
|
||||
auto text = "Hello world!";
|
||||
if (uiButtonAt(Vec2(8), Vec2(80, 30), engineFont, text)) {
|
||||
println(text);
|
||||
setUiStartPoint(Vec2(8));
|
||||
if (uiButton(Vec2(80, 30), buttonText)) {
|
||||
println(buttonText);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2,20 +2,21 @@
|
|||
|
||||
import parin;
|
||||
|
||||
auto buttonSize = Vec2(32);
|
||||
|
||||
void ready() {
|
||||
lockResolution(320, 180);
|
||||
}
|
||||
|
||||
bool update(float dt) {
|
||||
auto size = Vec2(32);
|
||||
setUiMargin(2);
|
||||
setUiStartPoint(Vec2(8));
|
||||
useUiLayout(Layout.h);
|
||||
if (uiButton(size, engineFont, "1")) println(1);
|
||||
if (uiButton(size, engineFont, "2")) println(2);
|
||||
if (uiButton(buttonSize, "1")) println(1);
|
||||
if (uiButton(buttonSize, "2")) println(2);
|
||||
useUiLayout(Layout.h);
|
||||
if (uiButton(size, engineFont, "3")) println(3);
|
||||
if (uiButton(size, engineFont, "4")) println(4);
|
||||
if (uiButton(buttonSize, "3")) println(3);
|
||||
if (uiButton(buttonSize, "4")) println(4);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import parin;
|
||||
|
||||
auto viewport = Viewport(black);
|
||||
auto viewportPosition = Vec2(100, 30);
|
||||
auto viewportPosition = Vec2(32);
|
||||
auto viewportScale = Vec2(2);
|
||||
|
||||
void ready() {
|
||||
|
@ -12,13 +12,15 @@ void ready() {
|
|||
}
|
||||
|
||||
bool update(float dt) {
|
||||
auto size = Vec2(30);
|
||||
viewport.attach();
|
||||
setUiViewportState(viewportPosition, viewportScale);
|
||||
if (uiButtonAt(Vec2(8), size, engineFont, "UwU")) {
|
||||
println("UwU");
|
||||
setUiViewportState(viewportPosition, viewport.size, viewportScale);
|
||||
|
||||
setUiMargin(2);
|
||||
setUiStartPoint(Vec2(8));
|
||||
foreach (i; 0 .. 4) {
|
||||
if (uiButton(Vec2(14), i.toStr())) println(i);
|
||||
}
|
||||
drawVec2(uiMouse, 4);
|
||||
|
||||
viewport.detach();
|
||||
drawViewport(viewport, viewportPosition, DrawOptions(viewportScale));
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue