Files
esengine/source/src/Graphics/Viewport.ts

51 lines
1.3 KiB
TypeScript
Raw Normal View History

2020-07-23 11:00:46 +08:00
module es {
export class Viewport {
private _x: number;
private _y: number;
private _width: number;
private _height: number;
private _minDepth: number;
private _maxDepth: number;
2020-06-29 15:41:02 +08:00
public get height(){
return this._height;
}
public set height(value: number){
this._height = value;
}
public get width(){
return this._width;
}
public set width(value: number){
this._width = value;
}
2020-07-23 11:00:46 +08:00
public get aspectRatio(){
if ((this._height != 0) && (this._width != 0))
return (this._width / this._height);
return 0;
}
public get bounds(){
return new Rectangle(this._x, this._y, this._width, this._height);
}
public set bounds(value: Rectangle){
this._x = value.x;
this._y = value.y;
this._width = value.width;
this._height = value.height;
}
constructor(x: number, y: number, width: number, height: number){
this._x = x;
this._y = y;
this._width = width;
this._height = height;
this._minDepth = 0;
this._maxDepth = 1;
}
2020-06-29 15:41:02 +08:00
}
2020-07-23 11:00:46 +08:00
}