Skip to content

Commit 626af5c

Browse files
committed
scene.ts changes for MicroData debugging
1 parent f701432 commit 626af5c

File tree

2 files changed

+23
-29
lines changed

2 files changed

+23
-29
lines changed

scene.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,17 @@ namespace user_interface_base {
113113

114114
public pushScene(scene: Scene) {
115115
const currScene = this.currScene()
116-
basic.showNumber(9)
116+
// basic.showNumber(9)
117117

118118
if (currScene) {
119119
currScene.deactivate()
120120
}
121-
basic.showNumber(0)
121+
// basic.showNumber(0)
122122
context.pushEventContext()
123123
this.scenes.push(scene)
124-
basic.showNumber(1)
124+
// basic.showNumber(1)
125125
scene.startup()
126-
basic.showNumber(2)
126+
// basic.showNumber(2)
127127
scene.activate()
128128
scene.__init()
129129
}
@@ -154,16 +154,16 @@ namespace user_interface_base {
154154
}
155155

156156
private currScene(): Scene {
157-
if (this.scenes != null) {
158-
basic.showString("N");
159-
} else {
160-
basic.showString("H")
161-
}
157+
// if (this.scenes != null) {
158+
// basic.showString("N");
159+
// } else {
160+
// basic.showString("H")
161+
// }
162162
if (this.scenes.length) {
163-
basic.showString("ye");
163+
// basic.showString("ye");
164164
return this.scenes[this.scenes.length - 1]
165165
}
166-
basic.showString("undef")
166+
// basic.showString("undef")
167167
return undefined
168168
}
169169
}

screen.ts

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,14 @@ namespace user_interface_base {
124124

125125
// basic.showNumber(SCREEN_FN_ID_DRAW_LINE);
126126
// radio.sendNumber(SCREEN_FN_ID_DRAW_LINE);
127-
radio.sendBuffer(Buffer.fromArray([SCREEN_FN_ID_DRAW_LINE, x0, y0, x1, y1, c]));
127+
radio.sendBuffer(
128+
Buffer.fromArray([
129+
SCREEN_FN_ID_DRAW_LINE,
130+
x0 + Screen.HALF_WIDTH, y0 + Screen.HALF_HEIGHT,
131+
x1 + Screen.HALF_WIDTH, y1 + Screen.HALF_HEIGHT,
132+
c
133+
])
134+
);
128135
}
129136

130137
public static drawLineXfrm(
@@ -171,7 +178,7 @@ namespace user_interface_base {
171178
// Screen.image.drawRect(Screen.x(x), Screen.y(y), width, height, c)
172179
// basic.showNumber(SCREEN_FN_ID_DRAW_RECT);
173180
// radio.sendNumber(SCREEN_FN_ID_DRAW_RECT);
174-
radio.sendBuffer(Buffer.fromArray([SCREEN_FN_ID_DRAW_RECT, x, y, width, height, c]));
181+
radio.sendBuffer(Buffer.fromArray([SCREEN_FN_ID_DRAW_RECT, x + Screen.HALF_WIDTH, y + Screen.HALF_HEIGHT, width, height, c]));
175182
}
176183

177184
public static drawRectXfrm(
@@ -203,20 +210,7 @@ namespace user_interface_base {
203210
) {
204211
// basic.showNumber(SCREEN_FN_ID_FILL_RECT);
205212

206-
const b = Buffer.fromArray([SCREEN_FN_ID_FILL_RECT, x + Screen.HALF_WIDTH, y + Screen.HALF_HEIGHT, width, height, c])
207-
208-
// -80, -64, 176, 192
209-
basic.showString("S")
210-
basic.showNumber(x)
211-
basic.showString("p")
212-
basic.showNumber(y)
213-
for (let i = 0; i < b.length; i++) {
214-
basic.showString("" + i + ":" + b[i])
215-
216-
}
217-
basic.showString("D")
218-
219-
radio.sendBuffer(Buffer.fromArray([SCREEN_FN_ID_FILL_RECT, x, y, width, height, c]));
213+
radio.sendBuffer(Buffer.fromArray([SCREEN_FN_ID_FILL_RECT, x + Screen.HALF_WIDTH, y + Screen.HALF_HEIGHT, width, height, c]))
220214
}
221215

222216
public static fillRectXfrm(
@@ -383,7 +377,7 @@ namespace user_interface_base {
383377
if (c) {
384378
// Screen.image.setPixel(Screen.x(x), Screen.y(y), c)
385379
// basic.showNumber(SCREEN_FN_ID_SET_PIXEL);
386-
radio.sendBuffer(Buffer.fromArray([SCREEN_FN_ID_SET_PIXEL, x, y, c]));
380+
radio.sendBuffer(Buffer.fromArray([SCREEN_FN_ID_SET_PIXEL, x + Screen.HALF_WIDTH, y + Screen.HALF_HEIGHT, c]));
387381
}
388382
}
389383

@@ -410,7 +404,7 @@ namespace user_interface_base {
410404
radio.sendString(text);
411405

412406
const c: number = (color == null) ? 0 : color;
413-
radio.sendBuffer(Buffer.fromArray([SCREEN_FN_ID_PRINT, x, y, c]));
407+
radio.sendBuffer(Buffer.fromArray([SCREEN_FN_ID_PRINT, x + Screen.HALF_WIDTH, y + Screen.HALF_HEIGHT, c]));
414408

415409
// Screen.image.print(
416410
// text,

0 commit comments

Comments
 (0)