-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexampleScene.ts
More file actions
61 lines (53 loc) · 1.3 KB
/
exampleScene.ts
File metadata and controls
61 lines (53 loc) · 1.3 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
namespace example_project {
import Screen = user_interface_base.Screen
import Scene = user_interface_base.Scene
import AppInterface = user_interface_base.AppInterface
import font = user_interface_base.font
// Use a Scene instead of a CursorScene when you want to control display-shield button behaviour yourself.
export class ExampleScene extends Scene {
constructor(app: AppInterface) {
super(app)
}
startup() {
// Setup display-shield buttons yourself
control.onEvent(
ControllerButtonEvent.Pressed,
controller.A.id,
() => {
this.app.pushScene(new ExampleMicroGUIScene(this.app))
}
)
control.onEvent(
ControllerButtonEvent.Pressed,
controller.B.id,
() => {
this.app.popScene()
}
)
}
draw() {
Screen.fillRect(
Screen.LEFT_EDGE,
Screen.TOP_EDGE,
Screen.WIDTH,
Screen.HEIGHT,
0x6
)
const txt1 = "Press A for the next scene"
Screen.print(
txt1,
-txt1.length * font.charWidth >> 1,
-20,
15
)
const txt2 = "Press B to go back"
Screen.print(
txt2,
-txt2.length * font.charWidth >> 1,
20,
15
)
super.draw()
}
}
}