新增场景截图 requestScreenshot
This commit is contained in:
2
demo/libs/framework/framework.d.ts
vendored
2
demo/libs/framework/framework.d.ts
vendored
@@ -348,6 +348,7 @@ declare module es {
|
||||
readonly entities: EntityList;
|
||||
readonly renderableComponents: RenderableComponentList;
|
||||
readonly entityProcessors: EntityProcessorList;
|
||||
_screenshotRequestCallback: Function;
|
||||
readonly _sceneComponents: SceneComponent[];
|
||||
_renderers: Renderer[];
|
||||
readonly _postProcessors: PostProcessor[];
|
||||
@@ -364,6 +365,7 @@ declare module es {
|
||||
update(): void;
|
||||
render(): void;
|
||||
postRender(): void;
|
||||
requestScreenshot(callback: Function): void;
|
||||
addSceneComponent<T extends SceneComponent>(component: T): T;
|
||||
getSceneComponent<T extends SceneComponent>(type: any): T;
|
||||
getOrCreateSceneComponent<T extends SceneComponent>(type: any): T;
|
||||
|
||||
@@ -1719,6 +1719,15 @@ var es;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this._screenshotRequestCallback) {
|
||||
var tex = new egret.RenderTexture();
|
||||
tex.drawToTexture(this, new es.Rectangle(0, 0, this.stage.stageWidth, this.stage.stageHeight));
|
||||
this._screenshotRequestCallback(tex);
|
||||
this._screenshotRequestCallback = null;
|
||||
}
|
||||
};
|
||||
Scene.prototype.requestScreenshot = function (callback) {
|
||||
this._screenshotRequestCallback = callback;
|
||||
};
|
||||
Scene.prototype.addSceneComponent = function (component) {
|
||||
component.scene = this;
|
||||
|
||||
2
demo/libs/framework/framework.min.js
vendored
2
demo/libs/framework/framework.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user