Skip to content

Commit eaeada9

Browse files
committed
Updated pxt.json/user-interface-base to use latest version, added controlSetupFn to all startup() {}, increase basic.pause() time during startup(), removed unneccessary microgui include, modified home.ts to use modern style afforded by user-interface-base upgrade.
1 parent 4bc93bd commit eaeada9

8 files changed

Lines changed: 60 additions & 62 deletions

compile_commands.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]

home.ts

Lines changed: 43 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,72 +4,68 @@ namespace micromusic {
44
import Button = user_interface_base.Button
55
import ButtonStyles = user_interface_base.ButtonStyles
66
import AppInterface = user_interface_base.AppInterface
7-
import CursorSceneEnum = user_interface_base.CursorSceneEnum
87
import font = user_interface_base.font
98
import resolveTooltip = user_interface_base.resolveTooltip
109

1110
export class Home extends CursorScene {
12-
private liveDataBtn: Button
13-
private recordDataBtn: Button
14-
private distributedLoggingBtn: Button
15-
1611
constructor(app: AppInterface) {
1712
super(app)
1813
}
1914

20-
/* override */ startup() {
15+
/* override */ startup(controlSetupFn: () => void) {
2116
super.startup()
22-
basic.pause(10)
17+
basic.pause(50)
18+
2319
this.cursor.setBorderThickness(2)
2420
const y = Screen.HEIGHT * 0.234 // y = 30 on an Arcade Shield of height 128 pixels
2521
this.navigator.setBtns([
2622
[
27-
(this.liveDataBtn = new Button({
28-
parent: null,
29-
style: ButtonStyles.Transparent,
30-
icon: "edit_program",
31-
ariaId: "New Song",
32-
x: -40,
33-
y,
34-
onClick: () => {
35-
this.app.popScene()
36-
this.app.pushScene(
37-
SongComposerScreen.getInstance(this.app),
38-
)
39-
},
40-
})),
41-
(this.recordDataBtn = new Button({
42-
parent: null,
43-
style: ButtonStyles.Transparent,
44-
icon: "largeDisk",
45-
ariaId: "Saved Songs",
46-
x: 0,
47-
y,
48-
onClick: () => {},
49-
})),
50-
(this.distributedLoggingBtn = new Button({
51-
parent: null,
52-
style: ButtonStyles.Transparent,
53-
icon: "largeSettingsGear",
54-
ariaId: "Settings",
55-
x: 40,
56-
y,
57-
onClick: () => {
58-
this.app.popScene()
59-
this.app.pushScene(
60-
SettingsScreen.getInstance(this, this.app),
61-
)
62-
},
63-
})),
23+
new Button({
24+
parent: null,
25+
style: ButtonStyles.Transparent,
26+
icon: "edit_program",
27+
ariaId: "New Song",
28+
x: -40,
29+
y,
30+
onClick: () => {
31+
this.app.popScene()
32+
this.app.pushScene(
33+
SongComposerScreen.getInstance(this.app),
34+
)
35+
},
36+
}),
37+
new Button({
38+
parent: null,
39+
style: ButtonStyles.Transparent,
40+
icon: "largeDisk",
41+
ariaId: "Saved Songs",
42+
x: 0,
43+
y,
44+
onClick: () => {},
45+
}),
46+
new Button({
47+
parent: null,
48+
style: ButtonStyles.Transparent,
49+
icon: "largeSettingsGear",
50+
ariaId: "Settings",
51+
x: 40,
52+
y,
53+
onClick: () => {
54+
this.app.popScene()
55+
this.app.pushScene(
56+
SettingsScreen.getInstance(this, this.app),
57+
)
58+
},
59+
}),
6460
],
6561
])
6662
}
6763

6864
private drawVersion() {
6965
const font = bitmaps.font5
7066
Screen.print(
71-
"v0.1",
72-
Screen.RIGHT_EDGE - font.charWidth * "v0.1".length,
67+
"v0.2",
68+
Screen.RIGHT_EDGE - font.charWidth * "v0.2".length,
7369
Screen.BOTTOM_EDGE - font.charHeight - 2,
7470
0xb,
7571
font,
@@ -124,10 +120,7 @@ namespace micromusic {
124120
)
125121
}
126122

127-
this.liveDataBtn.draw()
128-
this.recordDataBtn.draw()
129-
this.distributedLoggingBtn.draw()
130-
123+
this.navigator.drawComponents();
131124
this.drawVersion()
132125
super.draw()
133126
}

patternComposer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ namespace micromusic {
159159
return PatternScreen.instance
160160
}
161161

162-
/* override */ startup() {
162+
/* override */ startup(controlSetupFn: () => void) {
163163
super.startup()
164-
basic.pause(10)
164+
basic.pause(50)
165165

166166
this.icon = getIcon("placeholder", true)
167167
.doubled()

pxt.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
{
22
"name": "MicroMusic",
3-
"version": "0.0.01",
3+
"version": "0.0.1",
44
"description": "Making music with micro:bit v2",
55
"dependencies": {
66
"core": "*",
77
"radio": "*",
88
"microphone": "*",
99
"datalogger": "*",
10-
"user-interface-base": "github:microbit-apps/user-interface-base#589d51e8901fe16bc4c1dfb6c81d3ffc86edb2fe",
11-
"microgui": "github:microbit-apps/microgui#cd5827ba0a3b8e87c12750612218aea7b320b98d",
10+
"user-interface-base": "github:microbit-apps/user-interface-base#v0.0.23",
1211
"audio-samples": "*"
1312
},
1413
"files": [

sampleSelectionScreen.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ namespace micromusic {
3939
this.selectedIndex = this.sampleNames.indexOf(this.currentSample)
4040
}
4141

42-
/* override */ startup() {
42+
43+
/* override */ startup(controlSetupFn: () => void) {
4344
super.startup()
44-
basic.pause(10)
45+
basic.pause(50)
4546

4647
this.cursor.setBorderThickness(1)
4748
this.resetNavigator()

saveLoadScreen.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ namespace micromusic {
9797
return SaveLoadScreen.instance
9898
}
9999

100-
/* override */ startup() {
100+
101+
/* override */ startup(controlSetupFn: () => void) {
101102
super.startup()
103+
basic.pause(50)
102104
// this.loadSaves()
103105
this.resetNavigator()
104106
}

settingsScreen.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ namespace micromusic {
3838
this.previousScene = previousScene
3939
}
4040

41-
/* override */ startup() {
41+
42+
/* override */ startup(controlSetupFn: () => void) {
4243
super.startup()
43-
basic.pause(10)
44+
basic.pause(50)
4445

4546
this.cursor.setBorderThickness(1)
4647

songComposer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ namespace micromusic {
9090
this.song = song
9191
}
9292

93-
/*override*/ startup() {
93+
94+
/* override */ startup(controlSetupFn: () => void) {
9495
super.startup()
95-
basic.pause(10)
96+
basic.pause(50)
9697

9798
this.playedNote = 0
9899
this.playedPattern = 0

0 commit comments

Comments
 (0)