feat: Scaling

This commit is contained in:
cha0s 2019-03-25 19:02:30 -05:00
parent 58cebcd827
commit d5356d8186
3 changed files with 10 additions and 4 deletions

View File

@ -1,3 +1,5 @@
const PIXI = 'undefined' !== typeof window ? require('pixi.js') : undefined;
export {AnimationView} from './animation-view'; export {AnimationView} from './animation-view';
export {Color} from './color'; export {Color} from './color';
export {Container} from './container'; export {Container} from './container';
@ -8,3 +10,7 @@ export {Renderable} from './renderable';
export {Renderer} from './renderer'; export {Renderer} from './renderer';
export {ShapeView} from './shape-view'; export {ShapeView} from './shape-view';
export {Sprite} from './sprite'; export {Sprite} from './sprite';
if (PIXI) {
PIXI.SCALE_MODES.DEFAULT = PIXI.SCALE_MODES.NEAREST
}

View File

@ -45,7 +45,7 @@ export class ShapeView extends Renderable {
primitives.drawLine( primitives.drawLine(
lastVertice, lastVertice,
vertice, vertice,
Primitives.lineStyle(new Color(255, 0, 255), 4), Primitives.lineStyle(new Color(255, 0, 255), 1),
); );
} }
lastVertice = vertice; lastVertice = vertice;
@ -53,7 +53,7 @@ export class ShapeView extends Renderable {
primitives.drawLine( primitives.drawLine(
lastVertice, lastVertice,
firstVertice, firstVertice,
Primitives.lineStyle(new Color(255, 0, 255), 4), Primitives.lineStyle(new Color(255, 0, 255), 1),
); );
this.container.removeAllChildren(); this.container.removeAllChildren();
this.container.addChild(primitives); this.container.addChild(primitives);

View File

@ -21,13 +21,13 @@ export class BodyView extends Renderable {
this.primitives.drawLine( this.primitives.drawLine(
[xMiddle, aabb[1]], [xMiddle, aabb[1]],
[xMiddle, aabb[1] + (aabb[3] - 0.0001)], [xMiddle, aabb[1] + (aabb[3] - 0.0001)],
Primitives.lineStyle(new Color(255, 255, 0), 4) Primitives.lineStyle(new Color(255, 255, 0), 1)
); );
const yMiddle = aabb[1] + (aabb[3] / 2); const yMiddle = aabb[1] + (aabb[3] / 2);
this.primitives.drawLine( this.primitives.drawLine(
[aabb[0], yMiddle], [aabb[0], yMiddle],
[aabb[0] + (aabb[2] -0.0001), yMiddle], [aabb[0] + (aabb[2] -0.0001), yMiddle],
Primitives.lineStyle(new Color(255, 255, 0), 4) Primitives.lineStyle(new Color(255, 255, 0), 1)
); );
} }