blob: 7e3604e67eca83afafee53a9077e9232736bed1e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
import CLVGL
import SwiftLVGL
#if canImport(Glibc)
import Glibc
#endif
@main
struct Main {
static func main() {
lv_init()
let _ = lv_sdl_window_create(480, 480)
let _ = lv_sdl_mouse_create()
var myCounter: Int = 0
let label = LVGLLabel("", alignment: .bottomMid)
let button = LVGLButton("Click Me", eventType: .pressed) { event in
if let event = event, event.eventCode == .pressed {
myCounter += 1
label.setText("You clicked the button \(myCounter) times")
}
}
let _ = LVGLButton("Shift Button", alignment: .bottomRight, eventType: .pressed) { event in
button.align(alignment: .leftMid)
}
let _ = LVGLSlider("", alignment: .topMid, yOffset: 50)
let _ = LVGLSwitch(alignment: .rightMid)
while true {
lv_timer_handler()
usleep(5000)
}
}
}
|