more missing simulator functions
This commit is contained in:
parent
5e23bc96ca
commit
6cbc6a53b2
@ -564,6 +564,34 @@ namespace pxsim.ImageMethods {
|
|||||||
runtime.queueDisplayUpdate()
|
runtime.queueDisplayUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function height(leds: Image) : number {
|
||||||
|
if (!leds) panic(PanicCode.MICROBIT_NULL_DEREFERENCE);
|
||||||
|
return Image.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function width(leds: Image) : number {
|
||||||
|
if (!leds) panic(PanicCode.MICROBIT_NULL_DEREFERENCE);
|
||||||
|
return leds.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function plotFrame(leds: Image, frame: number) {
|
||||||
|
ImageMethods.plotImage(leds, frame * Image.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function showFrame(leds: Image, frame: number) {
|
||||||
|
ImageMethods.showImage(leds, frame * Image.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function pixel(leds: Image, x: number, y: number) : number {
|
||||||
|
if (!leds) panic(PanicCode.MICROBIT_NULL_DEREFERENCE);
|
||||||
|
return leds.get(x,y);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setPixel(leds: Image, x: number, y: number, v:number) {
|
||||||
|
if (!leds) panic(PanicCode.MICROBIT_NULL_DEREFERENCE);
|
||||||
|
leds.set(x,y,v);
|
||||||
|
}
|
||||||
|
|
||||||
export function clear(leds: Image) {
|
export function clear(leds: Image) {
|
||||||
if (!leds) panic(PanicCode.MICROBIT_NULL_DEREFERENCE);
|
if (!leds) panic(PanicCode.MICROBIT_NULL_DEREFERENCE);
|
||||||
|
|
||||||
|
@ -611,6 +611,7 @@ namespace pxsim {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Image {
|
export class Image {
|
||||||
|
public static height: number = 5;
|
||||||
public width: number;
|
public width: number;
|
||||||
public data: number[];
|
public data: number[];
|
||||||
constructor(width: number, data: number[]) {
|
constructor(width: number, data: number[]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user