Integrate screen APIs from common packages (#343)

* starting screen api intergration

* Further image integration

* Aligning with new screen apis

* Build fixes

* Adjust to common screen state

* Fix unpackPNG

* Add game library

* Optimize screen rendering

* bumping common packages

* updated shims

* moving images into ev3

* upgrading to common packages

* added try/use

* cap

* fixed tryp age
This commit is contained in:
Michał Moskal
2018-02-26 23:16:17 +00:00
committed by Peli de Halleux
parent 5bd9705966
commit c2d26a8418
23 changed files with 733 additions and 908 deletions

View File

@ -500,7 +500,7 @@ namespace pxsim.visuals {
}
}
private updateScreenStep(state: EV3ScreenState) {
private updateScreenStep(state: ScreenState) {
const bBox = this.layoutView.getBrick().getScreenBBox();
if (!bBox || bBox.width == 0) return;
@ -515,13 +515,7 @@ namespace pxsim.visuals {
this.screenCanvasData = this.screenCanvasCtx.getImageData(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
let sp = 3
const points = state.points
const data = this.screenCanvasData.data
for (let i = 0; i < points.length; ++i) {
data[sp] = points[i]
sp += 4;
}
new Uint32Array(this.screenCanvasData.data.buffer).set(state.screen)
// Move the image to another canvas element in order to scale it
this.screenCanvasTemp.style.width = `${SCREEN_WIDTH}`;