Sim screen canvas implementation and _setPixel.
This commit is contained in:
@ -11,7 +11,7 @@ namespace pxsim {
|
||||
|
||||
namespace pxsim.output {
|
||||
|
||||
export function setLights(pattern: number){
|
||||
export function setLights(pattern: number) {
|
||||
const lightState = (board() as DalBoard).lightState;
|
||||
lightState.lightPattern = pattern;
|
||||
runtime.queueDisplayUpdate();
|
||||
|
34
sim/state/screen.ts
Normal file
34
sim/state/screen.ts
Normal file
@ -0,0 +1,34 @@
|
||||
|
||||
namespace pxsim {
|
||||
|
||||
export class EV3ScreenState {
|
||||
points: {[x: number]: {[y: number]: number}};
|
||||
constructor() {
|
||||
this.points = {};
|
||||
}
|
||||
|
||||
setPixel(x: number, y: number, v: number) {
|
||||
if (x < 0 || x > 178) return;
|
||||
if (y < 0 || y > 128) return;
|
||||
|
||||
const xPoints = this.points[x]
|
||||
if (!xPoints) this.points[x] = {};
|
||||
this.points[x][y] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace pxsim.screen {
|
||||
|
||||
export function _setPixel(x: number, y: number, mode: Draw) {
|
||||
const screenState = (board() as DalBoard).screenState;
|
||||
screenState.setPixel(x, y, mode);
|
||||
runtime.queueDisplayUpdate();
|
||||
}
|
||||
|
||||
|
||||
export function _blitLine(xw: number, y: number, buf: number, mode: Draw) {
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user