mirror of
https://github.com/photonstorm/phaser
synced 2024-12-24 12:03:36 +00:00
38 lines
896 B
TypeScript
38 lines
896 B
TypeScript
/// <reference path="../../Phaser/Game.ts" />
|
|
/// <reference path="../../Phaser/core/Plugin.ts" />
|
|
|
|
/**
|
|
* Phaser - Plugins - Camera FX - Scanlines
|
|
*
|
|
* Give your game that classic retro feel!
|
|
*/
|
|
|
|
module Phaser.Plugins.CameraFX {
|
|
|
|
export class Scanlines extends Phaser.Plugin {
|
|
|
|
constructor(game: Phaser.Game, parent) {
|
|
|
|
super(game, parent);
|
|
this.camera = parent;
|
|
|
|
}
|
|
|
|
public camera: Phaser.Camera;
|
|
|
|
public spacing: number = 4;
|
|
public color: string = 'rgba(0, 0, 0, 0.3)';
|
|
|
|
public postRender() {
|
|
|
|
this.game.stage.context.fillStyle = this.color;
|
|
|
|
for (var y = this.camera.screenView.y; y < this.camera.screenView.height; y += this.spacing)
|
|
{
|
|
this.game.stage.context.fillRect(this.camera.screenView.x, y, this.camera.screenView.width, 1);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|