Files
kryon/examples/11_basic_controls.kry
T
2026-08-09 19:52:01 -03:00

43 lines
1.1 KiB
Plaintext

#import "kryon.h"
app "Kryon Basic Controls" {
size 800 600
fps 60
font examples
theme THEME_SKY light
}
state {
radio: int = 1
spin: int = 4
combo: int = 0
progress: int = 45
choices: [3] const char * = {"Alpha","Beta","Gamma"}
}
screen BasicControlsExample(viewport: Rectangle) {
Background(GetThemeBackground())
Text("Basic controls", 40, 40, UI_TEXT_24, GetThemeText())
picked: int = Radio((RadioButtonProps){{40,90,160,28},"Choice A",1,radio==1,0})
if picked {
radio = picked
}
picked = Radio((RadioButtonProps){{40,124,160,28},"Choice B",2,radio==2,0})
if picked {
radio = picked
}
Spinbox((SpinboxProps){{240,90,140,34},201,0,10,1,&spin,0})
Combobox((ComboboxProps){{240,140,180,34},202,choices,3,&combo,0})
Progress((ProgressBarProps){{40,210,380,28},0,100,progress,"Progress"})
if (IsKeyPressed(KEY_RIGHT)) {
if progress < 100 {
progress += 5
}
}
if (IsKeyPressed(KEY_LEFT)) {
if progress > 0 {
progress -= 5
}
}
}