/pixi-factory

Factory data parse stringify for objects and pixijs

Primary LanguageJavaScriptMIT LicenseMIT

pixi-factory

FEATURE

Data factory parser for make a complex rpg game with pixijs.

  • Convert PIXI element or obj into valide Parsed for JSON
  • Track and access obj data everywhere
  • customised preset for pixijs and plugins without circular error.

EXAMPLE

Factory.circulars = Factory.CIRCULARS.ALL;
Factory.flatters = Factory.FLATTERS.ALL;
Factory.mappers = Factory.MAPPERS.Points;
const container = new PIXI.Container();
const factory = new Factory(container);
console.log(factory);

console.log(JSON.stringify(factory,null,"/t"));

CUSTOM SETUP

3 options need to setup with preset, by default it use all preset from static classes.

Parameter

  • Factory.circulars - Know propreties with circular reference
  • Factory.flatters - Parent propreties to flatt in factoryPoint
  • Factory.mappers - Custom mapper for propreties names

Factory.circulars

Preset avaible

  • Projection - ['euler','proj','legacy','local']
  • Observable - ['cb','scope','world',"position","pivot","scale","skew"]

Set circular with all preset only

Factory.circulars = Factory.CIRCULARS.ALL; // include preset Observable,Projection

Set circular with pixi-Projection and some custom

Factory.circulars = [...Factory.CIRCULARS.Projection,"custom1","custom."]; // include only Projection and preset 

Factory.flatters

Preset avaible

  • Observable - ["position","pivot","scale","skew"]
  • Display - ["renderable","visible","zOrder","alpha","interactive","tint"]
  • Projection3d - ["euler","position3d","pivot3d","scale3d","proj"]

Set flatters with all presets

Factory.circulars = Factory.FLATTERS.ALL;

custom flatters with preset

Factory.circulars = [...Factory.FLATTERS.Observable,"zOrder"];

Factory.mappers

Preset avaible

  • Points - {_x:'x',_y:'y',_z:'z',_affine:'affine'}

Set mappers with pixi points

Factory.mappers = Factory.MAPPERS.Points;

custom mappers with preset points

Factory.circulars = {_foo:'foo',...Factory.MAPPERS.Points};

TODO:

  • add preset - pixiv5, pixi-display, pixi-heavens, pixi-filters and mode..
  • optimize mode codes
  • add hash integrity checker