Commit 8f20e2d8 authored by rockyl's avatar rockyl

版本锁定分支前提交

parent c495d003
This diff is collapsed.
This diff is collapsed.
......@@ -6,6 +6,7 @@
"types": "index.d.ts",
"dependencies": {
"color": "^3.1.2",
"emoji-regex": "^8.0.0",
"howler": "^2.1.2"
},
"devDependencies": {
......
......@@ -41,14 +41,6 @@ glob('types/src/**/*.d.ts', function (err, files) {
;
const content = `
declare const args: any;
declare const props: any;
declare const target: engine.Container;
declare const global: any;
declare const vm: engine.VM;
declare function next(type: string, payload?: any);
declare module engine{
${allExports}
}
......
......@@ -35,7 +35,7 @@ export default class Container extends DisplayObject {
*/
mouseChildren: boolean = true;
/**
* 子们
* 子们
* @member {DisplayObject[]}
* @readonly
*/
......@@ -68,6 +68,15 @@ export default class Container extends DisplayObject {
//子类需要时重写
}
attachVisibility() {
return;
this.dispatchEvent(this.worldVisible ? Event.VISIBLE : Event.HIDDEN);
for (let i = 0, li = this.children.length; i < li; i++) {
const child = <Container>this.children[i];
child.attachVisibility();
}
}
/**
* 添加child
* @param {DisplayObject} child
......
This diff is collapsed.
import Container from "./Container";
import { devicePixelRatio, osType, RENDERER_TYPE, StageScaleMode } from "../const"
import {devicePixelRatio, osType, RENDERER_TYPE, StageScaleMode} from "../const"
import SystemRenderer from "../renderers/SystemRenderer";
import { Point, Rectangle } from "../math";
import { EventDispatcher } from "../events/EventDispatcher";
import { Event } from "../events/Event";
import { FloatDisplay } from "./FloatDisplay";
import { DisplayObject } from "./DisplayObject";
import { MouseEvent } from "../events/MouseEvent";
import { WebglRenderer } from "../renderers/WebglRenderer";
import { GDispatcher } from "../events/GDispatcher";
import {Point, Rectangle} from "../math";
import {EventDispatcher} from "../events/EventDispatcher";
import {Event} from "../events/Event";
import {FloatDisplay} from "./FloatDisplay";
import {DisplayObject} from "./DisplayObject";
import {MouseEvent} from "../events/MouseEvent";
import {WebglRenderer} from "../renderers/WebglRenderer";
import {GDispatcher} from "../events/GDispatcher";
import CanvasRenderer from "../renderers/CanvasRenderer";
import { GlobalPro, isWebGLSupported } from "../utils";
import {GlobalPro, isWebGLSupported} from "../utils";
//如果以后还出现帧率问题,使用ticker;
//兼容requestAnimationFrame
......@@ -94,7 +94,7 @@ export class Stage extends Container {
* @default 0
* @readonly
*/
public renderType: number = 0;
public renderType: RENDERER_TYPE = RENDERER_TYPE.UNKNOWN;
/**
* 直接获取stage的引用,避免总是从Event.ADD_TO_STAGE 事件中去获取stage引用
......@@ -356,7 +356,7 @@ export class Stage extends Container {
desH: number = 1206,
frameRate: number = 60,
scaleMode: string = StageScaleMode.FIXED_WIDTH,
renderType: number = RENDERER_TYPE.WEBGL,
renderType: RENDERER_TYPE = RENDERER_TYPE.WEBGL,
transparent: boolean = true,
bgColor: number = 0x000000
) {
......
......@@ -113,6 +113,26 @@ export class Event extends HashObject {
* @since 1.0.0
*/
public static CALL_FRAME: string = "onCallFrame";
/**
* 可见事件
* @Event
* @property VISIBLE
* @type {string}
* @static
* @public
* @since 1.0.0
*/
public static VISIBLE: string = "visible";
/**
* 隐藏事件
* @Event
* @property HIDDEN
* @type {string}
* @static
* @public
* @since 1.0.0
*/
public static HIDDEN: string = "hidden";
/**
* 完成事件
* @Event
......@@ -312,5 +332,6 @@ export class Event extends HashObject {
s._pd = false;
s._bpd = false;
s.type = type;
delete s.data;
}
}
......@@ -13,8 +13,10 @@ import {injectProperties, obj2query} from "../zeroing/utils";
* @param headers
*/
export function httpRequest(url: string, method: string = 'get', params?: any, type: 'text' | 'json' | 'jsonp' = 'text', headers?) {
let openUrl = url.indexOf('blob') === 0 ? url : urlJoin(url, '__ts__=' + Date.now());
let mParams = injectProperties({}, params);
if (type === "jsonp") {
return jsonp(url, params);
return jsonp(openUrl, mParams);
} else {
return new Promise((resolve, reject) => {
let mHeaders = {
......@@ -22,18 +24,19 @@ export function httpRequest(url: string, method: string = 'get', params?: any, t
};
injectProperties(mHeaders, headers);
let request = {url, method, params, type, headers: mHeaders};
let request = {url, method, params: mParams, type, headers: mHeaders};
const mock = window['mock'];
let mockRule;
if (mock) {
mock(request, (rule)=>{
mock(request, (rule) => {
mockRule = rule;
if(!mockRule){
if (!mockRule) {
doRequest(request, resolve, reject);
}
}, resolve, reject);
}else{
} else {
request.url = openUrl;
doRequest(request, resolve, reject);
}
});
......@@ -54,11 +57,11 @@ function doRequest({url, method, params, type, headers}, resolve, reject) {
const queryStr = obj2query(params);
let openUrl = url;
if (isGet) {
openUrl = urlJoin(url, queryStr);
openUrl = urlJoin(openUrl, queryStr);
}
xhr.open(method, openUrl, true);
if (!isGet) {
for(let key in headers){
for (let key in headers) {
xhr.setRequestHeader(key, headers[key]);
}
}
......@@ -72,7 +75,7 @@ function doRequest({url, method, params, type, headers}, resolve, reject) {
reject(reason)
};
xhr.onloadend = (): void => {
if(xhr.status == 404){
if (xhr.status == 404) {
reject(url + ' 404 (Not Found)')
}
};
......
......@@ -26,7 +26,7 @@ export default class SystemRenderer extends EventDispatcher {
* @default RENDERER_TYPE.UNKNOWN
* @see RENDERER_TYPE
*/
type: number;
type: RENDERER_TYPE;
/**
* canvas对象
*/
......
......@@ -13,7 +13,7 @@ const padding = 10;
* 继承Sprite,暂时发现,只需要切换bitmap和Sprite,TextField永远都是最新的,到时替换
* 动态文本类,有时需要在canvas里有一个动态文本,能根据我们的显示内容来改变
* @class TextFieldCon
* @extends DisplayObject
* @extends Sprite
* @since 1.0.0
* @public
*/
......@@ -36,7 +36,7 @@ export class TextField extends Sprite {
canvas.height = 3;
const texture = Texture.fromCanvas(canvas, SCALE_MODES.LINEAR, 'textCanvas');
texture.orig = new Rectangle();
this.texture = texture
this.texture = texture;
//baseTexture已自动缓存,把texture也缓存,key textCanvas+num 和baseTexture的一致
Texture.addToCache(this._texture, this._texture.baseTexture.textureCacheIds[0]);
......
......@@ -4,13 +4,12 @@
* 过程
*/
import {VM} from "./VM";
import {getDataByPath, linkedFlag, nodeScheme, objClone} from "../utils";
import {getDataByPath, linkedFlag, linkScheme, nodeScheme, objClone} from "../utils";
import {dataCenter} from "../game-warpper/data-center";
import {env} from "../game-warpper/enviroment";
import {getLogSwitch, Logs} from "../log-switch";
const log = getLogSwitch(Logs.PROCESS);
const linkScheme = 'link://';
export class Process {
private readonly id;
......@@ -109,7 +108,9 @@ export class Process {
}
if (func) {
let globalContext = this._vm.globalContext;
globalContext.dataCenter = globalContext.gameStage.dataCenter;
globalContext.gameStage = engine.gameStage;
globalContext.dataCenter = engine.gameStage.dataCenter;
globalContext.env = engine.env;
result = await func(payload, this._config.props, this._target, globalContext, this._vm);
if (log){
console.log(`[${this._vm.id}:${this.id}] output: <${result.type}>`, result.payload);
......
......@@ -15,6 +15,8 @@ const eventsMapping = {
[MouseEvent.MOUSE_DOWN]: 'touchstart',
[MouseEvent.MOUSE_MOVE]: 'touchmove',
[MouseEvent.MOUSE_UP]: 'touchend',
[MouseEvent.VISIBLE]: 'visible',
[MouseEvent.HIDDEN]: 'hidden',
};
export const globalEvent = new EventDispatcher();
......@@ -52,7 +54,7 @@ class EventsProxy extends HashObject {
start(eventsConfig) {
this._eventsConfig = eventsConfig;
for(let name in eventsConfig){
for (let name in eventsConfig) {
globalEvent.addEventListener(name, this.onCustomEvent, this);
}
......@@ -63,8 +65,8 @@ class EventsProxy extends HashObject {
if (this._eventsConfig) {
const eventConfig = this._eventsConfig[name];
if (eventConfig) {
for(let behavior of eventConfig.behaviors){
if(behavior.disabled){
for (let behavior of eventConfig.behaviors) {
if (behavior.disabled) {
continue;
}
executeBehavior({
......
......@@ -13,7 +13,7 @@ import {Rect} from "./nodes";
import {injectEnv} from "./enviroment";
import {Toast} from "./Toast";
import {arrayFind} from "../utils";
import {registerScripts} from "..";
import {registerCustomModuleAssets, registerScripts} from "..";
import {registerCustomModuleFromConfig} from "./custom-module";
/**
......@@ -149,6 +149,9 @@ export class GameStage extends Container {
//registerScripts(scripts);
//registerCustomModuleFromConfig(customs);
registerCustomModuleAssets(customs);
if(dataMapping){
this.dataCenter.registerDataMapping(dataMapping);
}
......
......@@ -3,7 +3,7 @@
*/
import {globalLoader} from "../../2d/loader/Loader";
import {arrayFind} from "../utils";
import {arrayFind, linkScheme} from "../utils";
import {parse} from "./bmp-text-manager";
let assetsConfig = [];
......@@ -32,10 +32,16 @@ export function loadAssets(config, onProgress?, onComplete?) {
return Promise.all(
config.map(assetConfig => {
assetsConfig.push(assetConfig);
const loadFunc = loaderMapping[assetConfig.ext];
const {url, ext, uuid} = assetConfig;
const loadFunc = loaderMapping[ext];
if (loadFunc) {
if(url.indexOf(linkScheme) === 0){
loaded++;
onProgress && onProgress(loaded, total);
return Promise.resolve();
}
let method = globalLoader['load' + loadFunc];
return method.call(globalLoader, assetConfig.url, assetConfig.uuid).then(
return method.call(globalLoader, url, uuid).then(
(data) => {
parse(assetConfig, data);
......@@ -43,7 +49,7 @@ export function loadAssets(config, onProgress?, onComplete?) {
onProgress && onProgress(loaded, total);
},
(error) => {
failedList.push(assetConfig.url);
failedList.push(url);
}
);
} else {
......@@ -81,7 +87,7 @@ export function getAssetByName(name): any {
return result;
} else {
for (let assetConfig of assetsConfig) {
let res = engine.globalLoader.get(assetConfig.url);
let res = globalLoader.get(assetConfig.url);
if (res && res.frames) {
for (let key in res.frames) {
const frame = res.frames[key];
......
/**
* Created by rockyl on 2019-11-22.
*/
import {importCJSCode} from "../utils";
import {arrayFind, importCJSCode, linkScheme} from "../utils";
import {Container} from "../../2d/display";
import {getAssetByUUID} from "./assets-manager";
const customMap = {};
/**
* 注册自定义模块素材映射
* @param customs
*/
export function registerCustomModuleAssets(customs) {
for (let custom of customs) {
customMap[custom.id].assets = custom.assets;
}
}
/**
* 注册自定义模块
* @param id
* @param def
*/
export function registerCustomModule(id, def) {
customMap[id] = def;
customMap[id] = {
def,
};
}
/**
* 注册自定义模块代码段
* @param config
*/
export function registerCustomCodeModule(config) {
const {id, code} = config;
registerCustomModule(id, importCJSCode(code, true));
}
/**
* 通过配置注册自定义模块
* @param config
*/
export function registerCustomModuleFromConfig(config) {
if(config){
if (config) {
for (let item of config) {
registerCustomCodeModule(item);
}
}
}
/**
* 增加自定义模块
* @param id
* @param container
* @param options
*/
export function addCustomModule(id, container: Container, options?) {
let creator = customMap[id];
let creator = customMap[id].def;
if (creator) {
let instance = creator(options);
if (instance) {
......@@ -33,3 +65,25 @@ export function addCustomModule(id, container: Container, options?) {
}
}
}
/**
* 处理自定义模块资源
* @param id
* @param uuid
*/
export function resolveCustomAsset(id, uuid) {
let module = customMap[id];
if (module) {
let config = arrayFind(module.assets, item => item.uuid === uuid);
if (config) {
if (config.url.indexOf(linkScheme) === 0) {
let linkUUID = config.url.replace(linkScheme, '');
let linkConfig = getAssetByUUID(linkUUID);
if (linkConfig) {
config = linkConfig;
}
}
}
return config;
}
}
......@@ -3,14 +3,13 @@
*/
import Container from "../../../2d/display/Container";
import {Event} from "../../../2d/events";
import Sprite from "../../../2d/display/Sprite";
import Texture from "../../../2d/texture/Texture";
import {getFont} from "../bmp-text-manager";
import {dirtyFieldTrigger} from "../../decorators";
import {VERTICAL_ALIGN} from "../../..";
export class BitmapText extends Container {
private _dirty: boolean = true;
private _charCache = [];
private _fontConfig;
......@@ -19,47 +18,60 @@ export class BitmapText extends Container {
@dirtyFieldTrigger
public font: string;
@dirtyFieldTrigger
public verticalAlign: VERTICAL_ALIGN = VERTICAL_ALIGN.DOWN;
@dirtyFieldTrigger
public letterSpacing: number = 0;
constructor() {
super();
this.addEventListener(Event.ENTER_FRAME, this.onEnterFrame, this);
}
onModify(value, key) {
switch (key) {
case 'text':
this._dirty = true;
case 'letterSpacing':
case 'verticalAlign':
this.render();
break;
case 'font':
this._fontConfig = getFont(value);
this._dirty = true;
break;
case 'letterSpacing':
this._dirty = true;
break;
}
}
onEnterFrame(e) {
if (this._dirty) {
this._dirty = false;
if (!this._fontConfig) {
return;
}
protected render() {
if (!this._fontConfig || !this.text) {
return;
}
let text = this.text + '';
let x = 0, li = this.text.length;
for (let i = 0; i < li; i++) {
const char = this.text[i];
let sp = this.addChar(char, i);
sp.x = x;
x += sp.width + this.letterSpacing;
let x = 0, li = text.length, maxHeight = 0;
for (let i = 0; i < li; i++) {
const char = text[i];
let sp = this.addChar(char, i);
sp.x = x;
x += sp.width + this.letterSpacing;
if (sp.height > maxHeight) {
maxHeight = sp.height;
}
for (let i = li; i < this.children.length; i++) {
this._charCache.push(this.removeChildAt(li));
}
if (this._height) {
maxHeight = this._height;
}
for (let i = 0, li = this.children.length; i < li; i++) {
const child = this.children[i];
switch (this.verticalAlign) {
case VERTICAL_ALIGN.DOWN:
child.y = maxHeight - child.height;
break;
case VERTICAL_ALIGN.MIDDLE:
child.y = (maxHeight - child.height) / 2;
break;
case VERTICAL_ALIGN.UP:
child.y = 0;
break;
}
}
for (let i = li; i < this.children.length; i++) {
this._charCache.push(this.removeChildAt(li));
}
}
private addChar(char, index) {
......@@ -75,7 +87,7 @@ export class BitmapText extends Container {
this.addChild(sp);
}
let uuid = this._fontConfig[char];
if(!uuid){
if (!uuid) {
console.log(`font asset not found: [${char}] in`, this.font);
}
sp.texture = uuid ? Texture.fromImage(uuid) : null;
......
......@@ -21,6 +21,9 @@ export class Label extends TextField {
* @private
*/
protected _setText(value) {
if (typeof value !== 'string') {
value = value + '';
}
if (value !== this._text) {
let matchResult = value.match(ESCAPE_REG_EXP);
......
......@@ -36,7 +36,7 @@ export class ScrollList extends ScrollListBase {
}
}
private onNextFrame(event) {
protected onNextFrame(event) {
this.firstItem = <Container>this.removeChildAt(0);
this._updateViewRect();
}
......
......@@ -8,3 +8,4 @@ export * from './Label'
export * from './TextInput'
export * from './ScrollView'
export * from './ScrollList'
export * from './BitmapText'
......@@ -3,9 +3,8 @@
*/
import {Container} from "../../2d/display";
import {Rect, Image, Label, Circle, ScrollView, TextInput, ScrollList} from "./nodes";
import {injectProperties, instantiateScript, propertyParse} from "../utils";
import {BitmapText} from "./nodes/BitmapText";
import {Rect, Image, Label, Circle, ScrollView, TextInput, ScrollList, BitmapText} from "./nodes";
import {injectProperties, instantiateScript,} from "../utils";
const nodeTypeMapping = {
node: Container,
......
......@@ -14,8 +14,12 @@ export * from './log-switch'
import {instantiate, registerNodeType} from './game-warpper/view-interpreter'
export {Howl, Howler} from 'howler';
import emojiRegex from 'emoji-regex';
const emojiRegexp = emojiRegex();
export {
instantiate,
registerNodeType,
emojiRegexp,
}
......@@ -7,10 +7,11 @@ import {registerScriptDef} from "..";
export const ESCAPE_REG_EXP = /\$\{[\u4e00-\u9fa5_a-zA-Z0-9\|]+\}/g;
export const linkedFlag = '$_linked_$';
export const nodeScheme = 'node://';
export const linkScheme = 'link://';
export function arrayFind(arr, predicate) {
if(!arr){
return ;
if (!arr) {
return;
}
for (let i = 0, li = arr.length; i < li; i++) {
const item = arr[i];
......@@ -134,7 +135,7 @@ export function obj2query(obj: any): string {
return arr.join('&');
}
function requireForCJS(id){
function requireForCJS(id) {
return window[id];
}
......@@ -227,29 +228,30 @@ export function htmlToPureText(htmlText) {
}
const zhReg = /[\u4e00-\u9fa5]/;
export function strLen(str){
export function strLen(str) {
let len = 0;
for(let char of str){
for (let char of str) {
len += char.match(zhReg) ? 2 : 1;
}
return len;
}
export function strShort(str, limit, replace = '…'){
export function strShort(str, limit, replace = '…') {
let result = '';
if(strLen(str) > limit){
if (strLen(str) > limit) {
let len = 0;
for (let i = 0, li = str.length; i < li; i++) {
const char = str[i];
len += char.match(zhReg) ? 2 : 1;
if(len > limit){
if (len > limit) {
result += replace;
break;
}else{
} else {
result += char;
}
}
}else{
} else {
result = str;
}
return result;
......@@ -264,4 +266,6 @@ export function injectProperties(target, source) {
for (let key in source) {
propertyParse(key, target, source);
}
return target;
}
......@@ -3,7 +3,7 @@
*/
export let queryParams:any = {};
for(let item of location.search.replace('?', '').split('&')){
for(let item of top.location.search.replace('?', '').split('&')){
let arr = item.split('=');
queryParams[arr[0]] = arr.length === 1 ? true : arr[1];
}
export default class TouchZoom {
static id: string;
host: any;
zoomTo: number;
mounted(): void;
private _onMouseDown;
private _onMouseUp;
}
export default class Wave {
static id: string;
host: any;
duration: any;
mounted(): void;
destroy(): void;
update(t: any): void;
awake(): void;
sleep(): void;
}
export declare abstract class HashObject {
protected _instanceId: number;
protected _instanceType: string;
protected static _object_id: number;
constructor();
readonly instanceId: number;
readonly instanceType: string;
abstract destroy(): void;
}
export declare const VERSION = "1.0";
export declare const devicePixelRatio: number;
export declare let StageScaleMode: {
EXACT_FIT: string;
NO_BORDER: string;
NO_SCALE: string;
SHOW_ALL: string;
FIXED_WIDTH: string;
FIXED_HEIGHT: string;
};
export declare const osType: string;
export declare function cos(angle: number): number;
export declare function sin(angle: number): number;
export declare const PI_2: number;
export declare const RAD_TO_DEG: number;
export declare const DEG_TO_RAD: number;
export declare enum RENDERER_TYPE {
UNKNOWN = 0,
WEBGL = 1,
CANVAS = 2
}
export declare enum SHAPES {
POLY = 0,
RECT = 1,
CIRC = 2,
ELIP = 3,
RREC = 4
}
export declare enum PRECISION {
LOW = "lowp",
MEDIUM = "mediump",
HIGH = "highp"
}
export declare enum TEXT_GRADIENT {
LINEAR_VERTICAL = 0,
LINEAR_HORIZONTAL = 1
}
export declare enum TEXT_ALIGN {
CENTER = "center",
LEFT = "left",
RIGHT = "right"
}
export declare enum VERTICAL_ALIGN {
MIDDLE = "middle",
UP = "up",
DOWN = "down"
}
export declare enum TEXT_lINETYPE {
SINGLE = "single",
MULTI = "multi"
}
export declare enum LINE_ALIGNMENT {
middle = 0.5,
outter = 1,
inner = 0
}
export declare enum LINE_CAP {
BUTT = "butt",
ROUND = "round",
SQUARE = "square"
}
export declare enum LINE_JOIN {
MITER = "miter",
ROUND = "round",
BEVEL = "bevel"
}
export declare enum BLEND_MODES {
NORMAL = 0,
ADD = 1,
MULTIPLY = 2,
SCREEN = 3,
OVERLAY = 4,
DARKEN = 5,
LIGHTEN = 6,
COLOR_DODGE = 7,
COLOR_BURN = 8,
HARD_LIGHT = 9,
SOFT_LIGHT = 10,
DIFFERENCE = 11,
EXCLUSION = 12,
HUE = 13,
SATURATION = 14,
COLOR = 15,
LUMINOSITY = 16,
NORMAL_NPM = 17,
ADD_NPM = 18,
SCREEN_NPM = 19
}
export declare enum DRAW_MODES {
POINTS = 0,
LINES = 1,
LINE_LOOP = 2,
LINE_STRIP = 3,
TRIANGLES = 4,
TRIANGLE_STRIP = 5,
TRIANGLE_FAN = 6
}
export declare enum SCALE_MODES {
LINEAR = 0,
NEAREST = 1
}
export declare enum WRAP_MODES {
CLAMP = 33071,
REPEAT = 10497,
MIRRORED_REPEAT = 33648
}
export declare enum GC_MODES {
AUTO = 0,
MANUAL = 1
}
export declare const URL_FILE_EXTENSION: any;
export declare const DATA_URI: any;
export declare enum SCROLL_DIRECTION {
HORIZONTAL = "horizontal",
VERTICAL = "vertical"
}
import { DisplayObject } from './DisplayObject';
import { Point } from '../math';
import CanvasRenderer from '../renderers/CanvasRenderer';
import { WebglRenderer } from '../renderers/WebglRenderer';
export default class Container extends DisplayObject {
percentWidth: number;
percentHeight: number;
left: number;
top: number;
right: number;
bottom: number;
horizonCenter: number;
verticalCenter: number;
mouseChildren: boolean;
children: any[];
containerUpdateTransform: any;
constructor();
afterConstructor(): void;
onChildrenChange(index: any): void;
addChild(child: DisplayObject): DisplayObject;
addChildAt(child: DisplayObject, index: number): DisplayObject;
swapChildren(child1: DisplayObject, child2: DisplayObject): boolean;
getChildIndex(child: DisplayObject): number;
setChildIndex(child: DisplayObject, index: number): void;
getChildAt(index: number): DisplayObject;
getChildByName(name: string | RegExp, isOnlyOne?: boolean, isRecursive?: boolean): any;
removeChild(child: DisplayObject): DisplayObject;
removeChildAt(index: number): DisplayObject;
removeChildren(beginIndex?: number, endIndex?: number): DisplayObject[];
updateTransform(): void;
calculateBounds(): void;
protected _calculateBounds(): void;
hitTestPoint(globalPoint: Point, isMouseEvent?: boolean): any;
renderWebGL(renderer: WebglRenderer): void;
private renderAdvancedWebGL;
protected _renderWebGL(renderer: WebglRenderer): void;
renderCanvas(renderer: CanvasRenderer): void;
protected _renderCanvas(renderer: CanvasRenderer): void;
update(deltaTime: number): void;
_onDispatchBubbledEvent(type: string): void;
destroy(): void;
width: number;
height: number;
private static _getElementsByName;
}
import { EventDispatcher } from '../events/EventDispatcher';
import Transform from '../math/Transform';
import { Rectangle } from '../math/Rectangle';
import { Point } from "../math/Point";
import Graphics from '../graphics/Graphics';
export declare class DisplayObject extends EventDispatcher {
transform: Transform;
visible: boolean;
renderable: boolean;
parent: any;
stage: any;
name: string;
worldAlpha: number;
protected _localBoundsSelf: Rectangle;
protected _bounds: Rectangle;
protected _boundsID: number;
protected _lastBoundsID: number;
private _mask;
private _alpha;
destroyed: boolean;
mouseEnabled: boolean;
tempDisplayObjectParent: DisplayObject;
displayObjectUpdateTransform: any;
displayObjectHitTestPoint: any;
protected _width: number;
protected _height: number;
constructor();
private readonly _tempDisplayObjectParent;
updateTransform(): void;
static _bp: Point;
static _p1: Point;
static _p2: Point;
static _p3: Point;
static _p4: Point;
static temBounds: Rectangle;
hitTestPoint(point: Point, isMouseEvent?: boolean): DisplayObject;
private _recursivePostUpdateTransform;
getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle;
getLocalBounds(rect?: Rectangle): Rectangle;
calculateBounds(): void;
globalToLocal(point: Point, bp?: Point): Point;
localToGlobal(point: Point, bp?: Point): Point;
_onDispatchBubbledEvent(type: string): void;
renderWebGL(renderer: any): void;
renderCanvas(renderer: any): void;
setParent(container: any): any;
setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, anchorX?: number, anchorY?: number): DisplayObject;
destroy(): void;
alpha: number;
x: number;
y: number;
readonly worldMatrix: import("../../../../../../../../Users/rockyl/WorkSpaces/VisualEditor/renderingengine/src/2d/math/Matrix").Matrix;
readonly localMatrix: import("../../../../../../../../Users/rockyl/WorkSpaces/VisualEditor/renderingengine/src/2d/math/Matrix").Matrix;
position: import("../../../../../../../../Users/rockyl/WorkSpaces/VisualEditor/renderingengine/src/2d/math/ObservablePoint").ObservablePoint;
scale: import("../../../../../../../../Users/rockyl/WorkSpaces/VisualEditor/renderingengine/src/2d/math/ObservablePoint").ObservablePoint;
scaleX: number;
scaleY: number;
anchor: import("../../../../../../../../Users/rockyl/WorkSpaces/VisualEditor/renderingengine/src/2d/math/ObservablePoint").ObservablePoint;
anchorX: number;
anchorY: number;
skew: import("../../../../../../../../Users/rockyl/WorkSpaces/VisualEditor/renderingengine/src/2d/math/ObservablePoint").ObservablePoint;
rotation: number;
readonly worldVisible: boolean;
mask: Graphics;
width: number;
height: number;
update(deltaTime: number): void;
}
import { DisplayObject } from "./DisplayObject";
export declare class FloatDisplay extends DisplayObject {
htmlElement: any;
private _isAdded;
private _transformID;
constructor();
init(htmlElement: any): void;
private getStyle;
updateStyle(): void;
destroy(): void;
}
import { Point, Rectangle } from '../math';
import Texture from '../texture/Texture';
import Container from './Container';
import CanvasRenderer from '../renderers/CanvasRenderer';
import { WebglRenderer } from '../renderers/WebglRenderer';
export default class Sprite extends Container {
private _anchorTexture;
_texture: Texture;
_width: number;
_height: number;
_transformID: number;
_textureID: number;
_transformTrimmedID: number;
_textureTrimmedID: number;
pluginName: string;
indices: Uint16Array;
start: number;
uvs: Float32Array;
vertexData: Float32Array;
vertexTrimmedData: Float32Array;
constructor(texture?: Texture);
_onTextureUpdate(): void;
_onAnchorUpdate(): void;
calculateVertices(): void;
calculateTrimmedVertices(): void;
_renderWebGL(renderer: WebglRenderer): void;
_renderCanvas(renderer: CanvasRenderer): void;
_calculateBounds(): void;
getLocalBounds(rect?: Rectangle): Rectangle;
hitTestPoint(globalPoint: Point, isMouseEvent?: boolean): any;
destroy(): void;
anchorTexture: any;
texture: Texture;
static from(source: any): Sprite;
static fromFrame(frameId: string): Sprite;
static fromImage(imageId: string, crossorigin?: boolean, scaleMode?: number): Sprite;
}
import Container from "./Container";
import SystemRenderer from "../renderers/SystemRenderer";
import { Rectangle } from "../math";
import { DisplayObject } from "./DisplayObject";
export declare class Stage extends Container {
iosTouchendPreventDefault: boolean;
isPreventDefaultEvent: boolean;
rootDiv: any;
renderObj: SystemRenderer;
renderType: number;
static getStage(stageName?: string): Stage;
private static _stageList;
static pause: boolean;
private static _pause;
viewRect: Rectangle;
autoSteering: boolean;
autoResize: boolean;
desWidth: number;
desHeight: number;
divHeight: number;
divWidth: number;
private _bgColor;
bgColor: number;
scaleMode: string;
private _scaleMode;
private _flush;
private _currentFlush;
static _dragDisplay: DisplayObject;
private static _isLoadedVConsole;
private _lastDpList;
private _rid;
private _floatDisplayList;
constructor(rootDivId?: string, desW?: number, desH?: number, frameRate?: number, scaleMode?: string, renderType?: number, transparent?: boolean, bgColor?: number);
render(): void;
private _ml;
private _mp;
private _initMouseEvent;
private _mouseDownPoint;
flush(): void;
setFrameRate(fps: number): void;
getFrameRate(): number;
getRootDivWH(div: HTMLDivElement): {
w: number;
h: number;
};
kill(): void;
private _mouseEventTypes;
private onMouseEvent;
private setAlign;
resize(): void;
getBounds(): Rectangle;
private static allUpdateObjList;
static flushAll(): void;
static addUpdateObj(target: any): void;
static removeUpdateObj(target: any): void;
destroy(): void;
}
export { default as Container } from './Container';
export { DisplayObject } from './DisplayObject';
export { FloatDisplay } from "./FloatDisplay";
export { default as Sprite } from "./Sprite";
export { Stage } from "./Stage";
import { HashObject } from "../HashObject";
export declare class Event extends HashObject {
static RESIZE: string;
static ON_SCROLL_TO_HEAD: string;
static ON_SCROLL_STOP: string;
static ON_SCROLL_START: string;
static ON_SCROLL_TO_END: string;
static ON_INIT_STAGE: string;
static ADDED_TO_STAGE: string;
static REMOVED_FROM_STAGE: string;
static ENTER_FRAME: string;
static END_FRAME: string;
static CALL_FRAME: string;
static COMPLETE: string;
static PROGRESS: string;
static ERROR: string;
static ABORT: string;
static START: string;
static TIMER: string;
static TIMER_COMPLETE: string;
type: string;
target: any;
data: any;
constructor(type: string);
stopImmediatePropagation(): void;
stopPropagation(): void;
private _bpd;
private _pd;
destroy(): void;
reset(type: string, target: any): void;
}
import { HashObject } from "../HashObject";
export declare class EventDispatcher extends HashObject {
protected eventTypes: any;
protected eventTypes1: any;
constructor();
private static _MECO;
static _totalMEC: number;
static getMouseEventCount(type?: string): number;
addEventListener(type: string, listener: Function, context?: any, useCapture?: boolean): void;
once(type: string, listener: Function, context?: any, useCapture?: boolean): void;
private _changeMouseCount;
private _defaultEvent;
dispatchEvent(event: any, data?: any, useCapture?: boolean): boolean;
hasEventListener(type: string, useCapture?: boolean): boolean;
removeEventListener(type: string, listener: Function, context?: any, useCapture?: boolean): void;
removeAllEventListener(): void;
destroy(): void;
}
export declare class GDispatcher {
private static callbackPool;
private static thisObjPool;
static addEvent(name: string, callback: any, thisObj: any): void;
static removeEvent(name: string, callback: any, thisObj?: any): void;
static dispatchEvent(name: string, ...args: any[]): void;
}
import { Event } from "./Event";
import { DisplayObject } from "../display/DisplayObject";
export declare class MouseEvent extends Event {
static MOUSE_DOWN: string;
static MOUSE_UP: string;
static CLICK: string;
static MOUSE_MOVE: string;
static MOUSE_OVER: string;
static MOUSE_OUT: string;
clientX: number;
clientY: number;
stageX: number;
stageY: number;
localX: number;
localY: number;
currentTarget: DisplayObject;
identifier: any;
constructor(type: string);
updateAfterEvent(): void;
destroy(): void;
}
export * from './Event';
export * from './EventDispatcher';
export * from './GDispatcher';
export * from './MouseEvent';
import GraphicsData from './GraphicsData';
import { Matrix, Point } from '../math';
import { Polygon } from "./shapes";
import { DisplayObject } from '../display/DisplayObject';
import Texture from '../texture/Texture';
import CanvasRenderer from '../renderers/CanvasRenderer';
import { WebglRenderer } from '../renderers/WebglRenderer';
import FillStyle from './styles/FillStyle';
import LineStyle from './styles/LineStyle';
import Container from '../display/Container';
export default class Graphics extends Container {
private _fillStyle;
private _lineStyle;
readonly fill: FillStyle;
readonly line: LineStyle;
private _tint;
tint: number;
private batchTint;
private _matrix;
matrix: Matrix;
hitTestByPixel: boolean;
private _holeMode;
private _currentPath;
graphicsData: GraphicsData[];
isUsedToMask: boolean;
boundsPadding: number;
private dirty;
private boundsDirty;
cacheAsBitmap: boolean;
private cacheDirty;
private _canvasBuffer;
_texture: Texture;
offsetX: number;
offsetY: number;
verts: any;
indices: any;
private batches;
private geoBatches;
private batchDirty;
private uvs;
private vertexData;
private shapeIndex;
private _transformID;
constructor();
clone(): Graphics;
lineStyle(lineWidth?: number, color?: number, alpha?: number, alignment?: number, native?: boolean): Graphics;
lineTextureStyle(width?: number, texture?: Texture, color?: number, alpha?: number, matrix?: any, alignment?: number, native?: boolean): this;
private startPoly;
private finishPoly;
moveTo(x: number, y: number): Graphics;
lineTo(x: number, y: number): Graphics;
private _initCurve;
quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number): Graphics;
bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): Graphics;
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): Graphics;
arc(cx: number, cy: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): Graphics;
beginFill(color?: number | string, alpha?: number): Graphics;
beginTextureFill(texture?: Texture, color?: number, alpha?: number, matrix?: Matrix): this;
endFill(): Graphics;
closePath(): Graphics;
beginHole(): this;
endHole(): this;
drawRect(x: number, y: number, width: number, height: number): Graphics;
drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): Graphics;
drawCircle(x: number, y: number, radius: number): Graphics;
drawEllipse(x: number, y: number, width: number, height: number): Graphics;
drawPolygon(path: number[] | Point[] | Polygon): Graphics;
drawStar(x: number, y: number, points: number, radius: number, innerRadius: number, rotation?: number): Graphics;
private drawShape;
clear(): Graphics;
isFastRect(): boolean;
_renderWebGL(renderer: WebglRenderer): void;
private updateBatch;
private calculateTints;
private calculateVertices;
private transformPoints;
_renderCanvas(renderer: CanvasRenderer): void;
_calculateBounds(): void;
hitTestPoint(point: Point, isMouseEvent?: boolean): DisplayObject;
private hitTestPointAccuratly;
updateLocalBoundsSelf(): void;
private generateCanvasTexture;
destroy(): void;
private proccessHoles;
private addUvs;
private adjustUvs;
}
import Circle from "./shapes/Circle";
import { Matrix, Rectangle } from "../math";
import Ellipse from "./shapes/Ellipse";
import Polygon from "./shapes/Polygon";
import RoundedRectangle from "./shapes/RoundedRectangle";
import { HashObject } from "../HashObject";
import LineStyle from "./styles/LineStyle";
import FillStyle from "./styles/FillStyle";
export default class GraphicsData extends HashObject {
fillStyle: FillStyle;
lineStyle: LineStyle;
matrix: Matrix;
holes: any[];
shape: any;
type: number;
points: number[];
constructor(shape: Circle | Rectangle | Ellipse | Polygon | RoundedRectangle, fillStyle?: FillStyle, lineStyle?: LineStyle, matrix?: Matrix);
clone(): GraphicsData;
destroy(): void;
}
import { LINE_CAP, LINE_JOIN } from "../const";
import { Point } from "../math";
import { DisplayObject } from "../display/DisplayObject";
import Sprite from "../display/Sprite";
export declare class Shape extends Sprite {
canvas: HTMLCanvasElement;
context: CanvasRenderingContext2D;
dirty: boolean;
offsetX: number;
offsetY: number;
constructor();
private _command;
private _isBitmapStroke;
private _isBitmapFill;
hitTestByPixel: boolean;
drawRoundRect(x: number, y: number, w: number, h: number, rTL?: number, rTR?: number, rBL?: number, rBR?: number): void;
moveTo(x: number, y: number): void;
lineTo(x: number, y: number): void;
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
quadraticCurveTo(cpX: number, cpY: number, x: number, y: number): void;
bezierCurveTo(cp1X: number, cp1Y: number, cp2X: number, cp2Y: number, x: number, y: number): void;
closePath(): void;
drawRect(x: number, y: number, w: number, h: number): void;
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;
drawCircle(x: number, y: number, radius: number, counterclockwise?: boolean): void;
drawEllipse(x: number, y: number, w: number, h: number): void;
clear(): void;
beginFill(color: number, alpha?: number): void;
beginLinearGradientFill(points: any, colors: any): void;
beginRadialGradientFill: (points: any, colors: any) => void;
beginBitmapFill(image: any, matrix: Array<number>): void;
private _fill;
beginStroke(color: number, lineWidth?: number, cap?: LINE_CAP, join?: LINE_JOIN, miter?: number, alpha?: number): void;
beginLinearGradientStroke(points: Array<number>, colors: any, lineWidth?: number, cap?: LINE_CAP, join?: LINE_JOIN, miter?: number): void;
beginRadialGradientStroke(points: Array<number>, colors: any, lineWidth?: number, cap?: LINE_CAP, join?: LINE_JOIN, miter?: number): void;
beginBitmapStroke(image: any, matrix: Array<number>, lineWidth?: number, cap?: LINE_CAP, join?: LINE_JOIN, miter?: number): void;
private _stroke;
endFill(): void;
endStroke(): void;
updateShape(): void;
private _drawShape;
hitTestPoint(globalPoint: Point, isMouseEvent?: boolean): DisplayObject;
changeColor(infoObj: any): void;
updateTexture(): void;
_renderCanvas(renderer: any): void;
_renderWebGL(renderer: any): void;
destroy(): void;
}
import GraphicsData from "../GraphicsData";
import Graphics from "../Graphics";
declare const _default: {
build(graphicsData: GraphicsData): void;
triangulate(graphicsData: any, graphicsGeometry: Graphics): void;
};
export default _default;
import GraphicsData from "../GraphicsData";
import Graphics from "../Graphics";
export default function (graphicsData: GraphicsData, graphicsGeometry: Graphics): void;
import Graphics from "../Graphics";
import GraphicsData from "../GraphicsData";
declare const _default: {
build(graphicsData: GraphicsData): void;
triangulate(graphicsData: GraphicsData, graphicsGeometry: Graphics): void;
};
export default _default;
import GraphicsData from "../GraphicsData";
import Graphics from "../Graphics";
declare const _default: {
build(graphicsData: GraphicsData): void;
triangulate(graphicsData: GraphicsData, graphics: Graphics): void;
};
export default _default;
import GraphicsData from "../GraphicsData";
import Graphics from "../Graphics";
declare const _default: {
build(graphicsData: GraphicsData): void;
triangulate(graphicsData: GraphicsData, graphicsGeometry: Graphics): void;
};
export default _default;
export declare function earcut(data: any, holeIndices: any, dim: any): any[];
import { Point, Rectangle } from '../../math';
export default class Circle {
x: number;
y: number;
radius: number;
type: number;
constructor(x?: number, y?: number, radius?: number);
clone(): Circle;
isPointIn(point: Point): boolean;
getBounds(): Rectangle;
}
import { Point, Rectangle } from '../../math';
export default class Ellipse {
x: number;
y: number;
width: number;
height: number;
type: number;
constructor(x?: number, y?: number, width?: number, height?: number);
clone(): Ellipse;
isPointIn(point: Point): boolean;
getBounds(): Rectangle;
}
import { Point } from '../../math/Point';
export default class Polygon {
closed: boolean;
points: number[];
type: number;
constructor(...points: any[]);
clone(): Polygon;
close(): void;
isPointIn(point: Point): boolean;
}
import { Point } from '../../math';
export default class RoundedRectangle {
x: number;
y: number;
width: number;
height: number;
radius: number;
type: number;
constructor(x?: number, y?: number, width?: number, height?: number, radius?: number);
clone(): RoundedRectangle;
isPointIn(point: Point): boolean;
}
export { default as Circle } from './Circle';
export { default as Ellipse } from './Ellipse';
export { default as Polygon } from './Polygon';
export { default as RoundedRectangle } from './RoundedRectangle';
import Texture from "../../texture/Texture";
import { Matrix } from "../../math";
export default class FillStyle {
color: number;
alpha: number;
texture: Texture;
matrix: Matrix;
visible: boolean;
alphaBlock: boolean;
constructor();
clone(): FillStyle;
reset(): void;
destroy(): void;
}
import FillStyle from './FillStyle';
import { LINE_ALIGNMENT } from '../../const';
export default class LineStyle extends FillStyle {
native: boolean;
width: number;
alignment: LINE_ALIGNMENT;
clone(): LineStyle;
reset(): void;
}
export declare function bezierCurveControlPoint(points: any): {
A: any[];
B: any[];
};
export default function bezierCurveTo(fromX: number, fromY: number, cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number, n: number, path?: number[]): number[];
export { default as bezierCurveTo } from './bezierCurveTo';
export { bezierCurveControlPoint } from "./bezierCurveControlPoint";
export declare const GRAPHICS_CURVES: {
adaptive: boolean;
maxLength: number;
minSegments: number;
maxSegments: number;
segmentsCount: Function;
};
export declare function quadraticCurveLength(fromX: number, fromY: number, cpX: number, cpY: number, toX: number, toY: number): number;
export declare function bezierCurveLength(fromX: number, fromY: number, cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): number;
import { EventDispatcher } from "../events/EventDispatcher";
import { Texture } from "../texture";
export declare class Loader extends EventDispatcher {
caches: {};
crossOrigin: boolean;
constructor();
loadSheet(url: string): Promise<void>;
loadRaw(url: string, uuid?: string, type?: 'text' | 'json'): Promise<any>;
loadJson(url: string, uuid?: string): Promise<any>;
loadText(url: string, uuid?: string): Promise<any>;
loadImage(url: string, uuid?: string): Promise<{}>;
loadTexture(url: string, uuid?: string): Promise<Texture>;
cache(name: string, data: any): void;
}
export declare const globalLoader: Loader;
declare const GroupD8: {
E: number;
SE: number;
S: number;
SW: number;
W: number;
NW: number;
N: number;
NE: number;
MIRROR_VERTICAL: number;
MIRROR_HORIZONTAL: number;
uX: (ind: any) => number;
uY: (ind: any) => number;
vX: (ind: any) => number;
vY: (ind: any) => number;
inv: (rotation: any) => number;
add: (rotationSecond: any, rotationFirst: any) => any;
sub: (rotationSecond: any, rotationFirst: any) => any;
rotate180: (rotation: any) => number;
isVertical: (rotation: any) => boolean;
byDirection: (dx: any, dy: any) => number;
matrixAppendRotationInv: (matrix: any, rotation: any, tx?: number, ty?: number) => void;
};
export default GroupD8;
import { Point } from "././Point";
import { HashObject } from "../HashObject";
export declare class Matrix extends HashObject {
a: number;
b: number;
c: number;
d: number;
tx: number;
ty: number;
array: any;
constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
clone(): Matrix;
copy(matrix: Matrix | any): this;
transformPoint(x: number, y: number, bp?: Point): Point;
transformPointInverse(x: number, y: number, bp?: Point): Point;
setFrom(mtx: Matrix): void;
identity(): void;
invert(): Matrix;
createBox(x: number, y: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number, ax: number, ay: number): void;
prepend: (mtx: Matrix) => void;
append(matrix: Matrix): void;
static isEqual(m1: Matrix, m2: Matrix): boolean;
concat(mtx: Matrix): void;
rotate(angle: number): void;
scale(sx: number, sy: number): void;
translate(dx: number, dy: number): void;
set(a: any, b: any, c: any, d: any, tx: any, ty: any): this;
getRotation(): number;
toArray(transpose?: boolean, out?: any): any;
static readonly IDENTITY: Matrix;
static readonly TEMP_MATRIX: Matrix;
destroy(): void;
}
import { Point } from "../math/Point";
import { HashObject } from "../HashObject";
export declare class ObservablePoint extends HashObject {
_x: number;
_y: number;
cb: any;
scope: any;
constructor(cb: Function, scope: any, x?: number, y?: number);
set(x?: number, y?: number): void;
copy(point: Point | ObservablePoint): void;
x: number;
y: number;
destroy(): void;
}
import { HashObject } from "../HashObject";
export declare class Point extends HashObject {
destroy(): void;
constructor(x?: number, y?: number);
x: number;
y: number;
static distance(...args: any[]): number;
set(x: number, y: number): void;
}
import { HashObject } from "../HashObject";
import { Point } from "./Point";
export declare class Rectangle extends HashObject {
type: number;
constructor(x?: number, y?: number, width?: number, height?: number);
clear(): void;
copy(rect: Rectangle): this;
clone(): Rectangle;
x: number;
y: number;
width: number;
height: number;
readonly left: number;
readonly right: number;
readonly top: number;
readonly bottom: number;
isPointIn(point: Point): boolean;
fit(rectangle: Rectangle): void;
static createFromRects(...arg: Rectangle[]): Rectangle;
static createFromPoints(rect: Rectangle, ...arg: Point[]): Rectangle;
static createFromVertexData(rect: Rectangle, vertexData: Float32Array): Rectangle;
static createRectfrom2Point(rect: Rectangle, p1: Point, p2: Point): Rectangle;
static testRectCross(ra: Rectangle, rb: Rectangle): boolean;
destroy(): void;
}
import { ObservablePoint } from './ObservablePoint';
import { Matrix } from "./Matrix";
import { HashObject } from '../HashObject';
export default class Transform extends HashObject {
worldMatrix: Matrix;
localMatrix: Matrix;
_worldID: number;
_parentID: number;
position: ObservablePoint;
scale: ObservablePoint;
anchor: ObservablePoint;
skew: ObservablePoint;
_rotation: number;
_cx: number;
_sx: number;
_cy: number;
_sy: number;
_localID: number;
_currentLocalID: number;
constructor();
onChange(): void;
updateSkew(): void;
updateLocalMatrix(): void;
updateWorldMatrix(parentTransform: Transform): void;
rotation: number;
destroy(): void;
}
export { Matrix } from './Matrix';
export { Point } from './Point';
export { ObservablePoint } from './ObservablePoint';
export { Rectangle } from './Rectangle';
export { default as Transform } from './Transform';
export { default as GroupD8 } from './GroupD8';
export declare function httpRequest(url: string, method?: string, params?: any, type?: 'text' | 'json' | 'jsonp'): Promise<{}>;
export declare function jsonp(url: any, params: any): Promise<{}>;
export declare function urlJoin(url: any, query: any): any;
import SystemRenderer from './SystemRenderer';
import CanvasMaskManager from './managers/CanvasMaskManager';
import { RendererOptions } from './RendererOptions';
import { Matrix } from '../math';
import { DisplayObject } from '../display/DisplayObject';
import CanvasSpriteRenderer from './plugins/CanvasSpriteRenderer';
import { CanvasGraphicsRenderer } from './plugins/CanvasGraphicsRenderer';
export default class CanvasRenderer extends SystemRenderer {
rootContext: CanvasRenderingContext2D;
context: CanvasRenderingContext2D;
maskManager: CanvasMaskManager;
smoothProperty: string;
plugins: {
sprite: CanvasSpriteRenderer;
graphics: CanvasGraphicsRenderer;
};
renderingToScreen: boolean;
constructor(options: RendererOptions);
render(displayObject: DisplayObject, renderTexture?: any, transform?: Matrix): void;
clear(clearColor: string): void;
destroy(): void;
resize(screenWidth: number, screenHeight: number): void;
destroyPlugins(): void;
}
export interface RendererOptions {
htmlElement?: HTMLCanvasElement;
transparent?: boolean;
antialias?: boolean;
preserveDrawingBuffer?: boolean;
backgroundColor?: number;
roundPixels?: boolean;
}
import Container from '../display/Container';
import { EventDispatcher } from '../events/EventDispatcher';
import { DisplayObject } from "../display/DisplayObject";
import { RendererOptions } from "./RendererOptions";
export default class SystemRenderer extends EventDispatcher {
options: RendererOptions;
type: number;
htmlElement: HTMLCanvasElement;
transparent: boolean;
preserveDrawingBuffer: boolean;
_backgroundColor: number;
_backgroundColorRgba: number[];
_backgroundColorString: string;
_tempDisplayObjectParent: Container;
_lastObjectRendered: DisplayObject;
constructor(options: RendererOptions);
resize(width: number, height: number): void;
render(displayObject: any, renderTexture?: any, transform?: any): void;
destroy(): void;
backgroundColor: number;
}
import SystemRenderer from "./SystemRenderer";
import { RendererOptions } from "./RendererOptions";
import { GLShader, VertexArrayObject } from "../../glCore";
import RenderTarget from "./renderTarget/RenderTarget";
import TextureManager from "./managers/TextureManager";
import TextureGarbageCollector from "./managers/TextureGarbageCollector";
import { Matrix } from "../math";
import WebGLState from "./webgl/WebGLState";
import BatchManager from "./managers/BatchManager";
import MaskManager from "./managers/MaskManager";
import StencilManager from "./managers/StencilManager";
import { DisplayObject } from "../display/DisplayObject";
export declare class WebglRenderer extends SystemRenderer {
plugins: {};
gl: WebGLRenderingContext;
CONTEXT_UID: number;
maskManager: MaskManager;
stencilManager: StencilManager;
batchManager: BatchManager;
textureManager: TextureManager;
textureGC: TextureGarbageCollector;
state: WebGLState;
renderingToScreen: boolean;
_activeShader: GLShader;
_activeVao: VertexArrayObject;
_activeRenderTarget: RenderTarget;
rootRenderTarget: RenderTarget;
constructor(options: RendererOptions);
_initContext(): void;
render(displayObject: DisplayObject, renderTexture?: any, transform?: any): void;
clear(clearColor: number[]): void;
setTransform(matrix: Matrix): void;
clearRenderTexture(renderTexture: any, clearColor: any): this;
bindShader(shader: GLShader, autoProject?: boolean): WebglRenderer;
createVao(): VertexArrayObject;
bindVao(vao: VertexArrayObject): WebglRenderer;
reset(): WebglRenderer;
bindRenderTexture(renderTexture: any, transform?: Matrix): WebglRenderer;
bindRenderTarget(renderTarget: RenderTarget): WebglRenderer;
resize(screenWidth: any, screenHeight: any): void;
destroy(): void;
handleContextRestored(): void;
handleContextLost(event: WebGLContextEvent): void;
initPlugins(staticMap: any): void;
destroyPlugins(): void;
static __plugins: any;
static registerPlugin(pluginName: string, ctor: Function): void;
}
import ObjectRenderer from '../webgl/ObjectRenderer';
import { WebglRenderer } from '../WebglRenderer';
export default class BatchManager {
renderer: WebglRenderer;
emptyRenderer: ObjectRenderer;
currentRenderer: ObjectRenderer;
constructor(renderer: WebglRenderer);
setObjectRenderer(objectRenderer: ObjectRenderer): void;
flush(): void;
reset(): void;
}
import { HashObject } from '../../HashObject';
import CanvasRenderer from '../CanvasRenderer';
import Graphics from '../../graphics/Graphics';
export default class CanvasMaskManager extends HashObject {
renderer: any;
constructor(renderer: CanvasRenderer);
pushMask(maskData: Graphics): void;
renderGraphicsShape(graphics: Graphics): void;
popMask(renderer: CanvasRenderer): void;
destroy(): void;
}
import Graphics from '../../graphics/Graphics';
import { WebglRenderer } from '../WebglRenderer';
import RenderTarget from '../renderTarget/RenderTarget';
export default class MaskManager {
renderer: WebglRenderer;
scissor: boolean;
scissorData: any;
scissorRenderTarget: RenderTarget;
enableScissor: boolean;
alphaMaskPool: any[];
alphaMaskIndex: number;
constructor(renderer: WebglRenderer);
pushMask(target: any, maskData: any): void;
popMask(target: any, maskData: any): void;
pushStencilMask(maskData: Graphics): void;
popStencilMask(): void;
pushScissorMask(target: any, maskData: Graphics): void;
popScissorMask(): void;
destroy(): void;
}
import { WebglRenderer } from '../WebglRenderer';
import Graphics from '../../graphics/Graphics';
export default class StencilManager {
renderer: WebglRenderer;
stencilMaskStack: Graphics[];
constructor(renderer: WebglRenderer);
setMaskStack(stencilMaskStack: Graphics[]): void;
pushStencil(graphics: Graphics): void;
popStencil(): void;
_useCurrent(): void;
_getBitwiseMask(): number;
destroy(): void;
}
import { WebglRenderer } from '../WebglRenderer';
export default class TextureGarbageCollector {
renderer: WebglRenderer;
count: number;
checkCount: number;
maxIdle: number;
checkCountMax: number;
mode: number;
constructor(renderer: WebglRenderer);
update(): void;
run(): void;
unload(displayObject: any): void;
}
import { GLTexture } from '../../../glCore';
import { WebglRenderer } from '../WebglRenderer';
export default class TextureManager {
boundTextures: any;
renderer: WebglRenderer;
emptyTextures: any;
_nextTextureLocation: number;
currentLocation: number;
gl: WebGLRenderingContext;
_managedTextures: Array<any>;
constructor(renderer: WebglRenderer);
onContextChange(): void;
bindTexture(texture: any, location?: number, forceLocation?: boolean): number;
getTexture(): void;
updateTexture(texture: any, location?: number): GLTexture;
unbindTexture(texture: any): void;
destroyTexture(texture: any, skipRemove: any): void;
removeAll(): void;
destroy(): void;
}
import BatchDrawCall from '../webgl/BatchDrawCall';
import ObjectRenderer from '../webgl/ObjectRenderer';
import { WebglRenderer } from '../WebglRenderer';
import { GLBuffer, GLShader, VertexArrayObject } from '../../../glCore';
export default class BatchRenderer extends ObjectRenderer {
vertSize: number;
vertByteSize: number;
size: number;
currentSize: number;
currentIndexSize: number;
aBuffers: {};
iBuffers: {};
shader: GLShader;
currentIndex: number;
groups: BatchDrawCall[];
elements: any[];
vaos: VertexArrayObject[];
vaoMax: number;
vertexCount: number;
MAX_TEXTURES: number;
vertexBuffers: GLBuffer[];
indexBuffers: GLBuffer[];
constructor(renderer: WebglRenderer);
onContextChange(): void;
onPreRender(): void;
render(element: any): void;
getIndexBuffer(size: any): any;
getAttributeBuffer(size: number): any;
flush(): void;
packGeometry(element: any, float32View: any, uint32View: any, indexBuffer: any, index: any, indexCount: any): void;
start(): void;
stop(): void;
destroy(): void;
}
import CanvasRenderer from '../CanvasRenderer';
import Graphics from '../../graphics/Graphics';
import GraphicsData from '../../graphics/GraphicsData';
export declare class CanvasGraphicsRenderer {
renderer: CanvasRenderer;
constructor(renderer: CanvasRenderer);
render(graphics: Graphics): void;
destroy(): void;
}
export declare function holePath(graphicsData: GraphicsData, context: CanvasRenderingContext2D, ccw?: boolean): void;
export declare function judgeCcw(points: number[]): boolean;
import CanvasRenderer from '../CanvasRenderer';
export default class CanvasSpriteRenderer {
renderer: CanvasRenderer;
constructor(renderer: CanvasRenderer);
render(sprite: any): void;
destroy(): void;
}
export default class CanvasRenderTarget {
canvas: HTMLCanvasElement;
context: CanvasRenderingContext2D;
constructor(width: number, height: number);
clear(): void;
resize(width: number, height: number): void;
destroy(): void;
width: number;
height: number;
}
import { Matrix, Rectangle } from '../../math';
import { GLBuffer, GLFramebuffer, GLTexture } from '../../../glCore';
import Graphics from '../../graphics/Graphics';
export default class RenderTarget {
gl: WebGLRenderingContext;
frameBuffer: GLFramebuffer;
texture: GLTexture;
clearColor: number[];
size: Rectangle;
projectionMatrix: Matrix;
transform: Matrix;
frame: Rectangle;
defaultFrame: Rectangle;
destinationFrame: any;
sourceFrame: any;
stencilBuffer: GLBuffer;
stencilMaskStack: Graphics[];
scaleMode: number;
root: boolean;
constructor(gl: WebGLRenderingContext, width?: number, height?: number, scaleMode?: number, root?: boolean);
clear(clearColor?: number[]): void;
attachStencilBuffer(): void;
setFrame(destinationFrame?: Rectangle, sourceFrame?: Rectangle): void;
activate(): void;
calculateProjection(destinationFrame: Rectangle, sourceFrame?: Rectangle): void;
resize(width: number, height: number): void;
destroy(): void;
}
export declare class BatchBuffer {
vertices: ArrayBuffer;
float32View: Float32Array;
uint32View: Uint32Array;
positions: any;
uvs: any;
colors: any;
constructor(size: number);
destroy(): void;
}
import BaseTexture from "../../texture/BaseTexture";
export default class BatchDrawCall {
textures: BaseTexture[];
textureCount: number;
start: number;
size: number;
type: number;
constructor();
}
import { DisplayObject } from "../../display/DisplayObject";
import { WebglRenderer } from "../WebglRenderer";
export default class ObjectRenderer {
renderer: WebglRenderer;
constructor(renderer: WebglRenderer);
onContextChange(): void;
start(): void;
stop(): void;
flush(): void;
render(object: DisplayObject): void;
destroy(): void;
}
export default class WebGLState {
blendModes: any;
activeState: Uint8Array;
defaultState: Uint8Array;
gl: any;
maxAttribs: any;
attribState: {
tempAttribState: any[];
attribState: any[];
};
nativeVaoExtension: any;
constructor(gl: WebGLRenderingContext);
setState(state: any): void;
setBlend(value: any): void;
setBlendMode(value: any): void;
setDepthTest(value: any): void;
setCullFace(value: any): void;
setFrontFace(value: any): void;
resetAttributes(): void;
resetToDefault(): void;
resetTo3D(): void;
}
export declare function createIndicesForQuads(size: number): Uint16Array;
import { GLShader } from '../../../glCore';
export declare function generateMultiTextureShader(gl: any, maxTextures: any): GLShader;
import Container from "../display/Container";
import { VideoEntity } from "./VideoEntity";
export declare class MovieClip extends Container {
lockStep: boolean;
readonly currentFrame: number;
private _curFrame;
readonly isPlaying: boolean;
private _isPlaying;
readonly isFront: boolean;
private _isFront;
totalFrames: number;
loops: number;
private textures;
private timeInterval;
private deltaFrame;
private frameCount;
constructor(mv?: VideoEntity);
init(mv: VideoEntity): void;
private initChildren;
private resetTransform;
resetTransformAll(frameIndex: number): void;
setImage(imagekey: any, imageUrl: string): void;
stop(): void;
nextFrame(): void;
prevFrame(): void;
gotoAndStop(frameIndex: number): void;
play(isFront?: boolean): void;
private _lastFrame;
readonly isInTimeFrame: boolean;
gotoAndPlay(frameIndex: number, isFront?: boolean): void;
startAniRange(beginFrame?: number, endFrame?: number, loops?: number, callback?: Function): void;
private startTime;
private startFrame;
private lastDeltaFrame;
private _endMark;
commonDeltaTime: number;
updateFrame(): void;
private getCurFrameWhenLockStep;
update(deltaTime: number): void;
destroy(): void;
}
import { SpriteEntity } from './spriteEntity';
import { HashObject } from '../HashObject';
export declare class VideoEntity extends HashObject {
version: string;
videoSize: {
width: number;
height: number;
};
FPS: number;
frames: number;
images: {};
hasBeenCached: boolean;
sprites: SpriteEntity[];
audios: any[];
constructor(spec: any, images: any);
resetSprites(spec: any): void;
destroy(): void;
}
export declare class BezierPath {
_d: any;
_transform: any;
_styles: any;
_shape: any;
constructor(d?: any, transform?: any, styles?: any);
}
import { BezierPath } from './bezierPath';
export declare class EllipsePath extends BezierPath {
_x: any;
_y: any;
_radiusX: any;
_radiusY: any;
_transform: any;
_styles: any;
constructor(x: any, y: any, radiusX: any, radiusY: any, transform: any, styles: any);
}
export declare class FrameEntity {
alpha: number;
transform: {
a: number;
b: number;
c: number;
d: number;
tx: number;
ty: number;
};
layout: {
x: number;
y: number;
width: number;
height: number;
};
nx: number;
ny: number;
maskPath: any;
shapes: any[];
constructor(spec: any);
static lastShapes: any;
}
export { VideoEntity } from "./VideoEntity";
export { MovieClip } from "./MovieClip";
declare const _default: (data: any, cb: any, failure: any) => void;
export default _default;
declare function inflate(input: any, options: any): any;
declare const _default: {
inflate: typeof inflate;
};
export default _default;
declare function assign(obj: any, objO: any): any;
declare function shrinkBuf(buf: any, size: any): any;
export declare const utils: {
assign: typeof assign;
shrinkBuf: typeof shrinkBuf;
Buf8: any;
Buf16: any;
Buf32: any;
arraySet: any;
flattenChunks: any;
};
export {};
declare function string2buf(str: any): any;
declare function buf2binstring(buf: any, len?: any): any;
declare function binstring2buf(str: any): any;
declare function buf2string(buf: any, max: any): any;
declare function utf8border(buf: any, max: any): any;
export declare const strings: {
utf8border: typeof utf8border;
buf2string: typeof buf2string;
binstring2buf: typeof binstring2buf;
buf2binstring: typeof buf2binstring;
string2buf: typeof string2buf;
};
export {};
declare function adler32(adler: any, buf: any, len: any, pos: any): number;
export default adler32;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment