~repos /plum

#treesitter#compiler#wasm

git clone https://pyrossh.dev/repos/plum.git

A statically typed, imperative programming language inspired by rust, python


a6ba4f6f Peter John

3 years ago
add menu example
Files changed (1) hide show
  1. examples/MenuScene.kt +25 -0
examples/MenuScene.kt ADDED
@@ -0,0 +1,25 @@
1
+ @Scene
2
+ class MenuScene(
3
+ name: string
4
+ )
5
+
6
+ fun MenuScene.init() {
7
+ log("Hello world")
8
+ log("new data")
9
+ showToast("Toasting", 2)
10
+ }
11
+
12
+ fun MenuScene.onClick(scene: Scene, actor: Actor) {
13
+ val nextScene = when (actor.name) {
14
+ "Play" -> GameScene,
15
+ "Play3d" -> Game3dScene,
16
+ "Options" -> OptionsScene,
17
+ "Exit" -> {
18
+ showMessageDialog(title = "Exit", message = "Are you sure you want \n to quit?")
19
+ exit(0)
20
+ }
21
+ }
22
+ nextScene?.run {
23
+ scene.setScene(it)
24
+ }
25
+ }