mirror of
https://github.com/Kapendev/parin.git
synced 2025-04-26 21:19:56 +03:00
27 lines
750 B
D
27 lines
750 B
D
/// This example serves as a classic hello-world example, introducing the UI system of Parin.
|
|
|
|
import parin;
|
|
|
|
auto buttonText = "Hello world!";
|
|
|
|
void ready() {
|
|
lockResolution(320, 180);
|
|
}
|
|
|
|
bool update(float dt) {
|
|
// Prepare the UI for this frame. This call is required for the UI to function as expected.
|
|
prepareUi();
|
|
// Disable the UI focus for this frame. Focus is only needed for UIs that support keyboard controls.
|
|
setUiFocus(0);
|
|
// Set the starting point for subsequent UI items.
|
|
setUiStartPoint(Vec2(8));
|
|
// Create a button and print if it is clicked.
|
|
if (uiButton(Vec2(80, 30), buttonText)) {
|
|
println(buttonText);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void finish() { }
|
|
|
|
mixin runGame!(ready, update, finish);
|