Giter VIP home page Giter VIP logo

Comments (3)

jonlepage avatar jonlepage commented on July 23, 2024

how we supose to deal with somthing like thats .
I do not want documentation comparable to Unity with here super doc on C#
but these difficult to understand what happens here OMG!

var PIXI;
(function (PIXI) {
    var tilemap;
    (function (tilemap_1) {
        var ZLayer = (function (_super) {
            __extends(ZLayer, _super);
            function ZLayer(tilemap, zIndex) {
                var _this = _super.call(this) || this;
                _this._lastAnimationFrame = -1;
                _this.tilemap = tilemap;
                _this.z = zIndex;
                return _this;
            }
            ZLayer.prototype.clear = function () {
                var layers = this.children;
                for (var i = 0; i < layers.length; i++)
                    layers[i].clear();
                this._previousLayers = 0;
            };
            ZLayer.prototype.cacheIfDirty = function () {
                var tilemap = this.tilemap;
                var layers = this.children;
                var modified = this._previousLayers != layers.length;
                this._previousLayers = layers.length;
                var buf = this.canvasBuffer;
                var tempRender = this._tempRender;
                if (!buf) {
                    buf = this.canvasBuffer = document.createElement('canvas');
                    tempRender = this._tempRender = new PIXI.CanvasRenderer(100, 100, { view: buf });
                    tempRender.context = tempRender.rootContext;
                    tempRender.plugins.tilemap.dontUseTransform = true;
                }
                if (buf.width != tilemap._layerWidth ||
                    buf.height != tilemap._layerHeight) {
                    buf.width = tilemap._layerWidth;
                    buf.height = tilemap._layerHeight;
                    modified = true;
                }
                var i;
                if (!modified) {
                    for (i = 0; i < layers.length; i++) {
                        if (layers[i].isModified(this._lastAnimationFrame != tilemap.animationFrame)) {
                            modified = true;
                            break;
                        }
                    }
                }
                this._lastAnimationFrame = tilemap.animationFrame;
                if (modified) {
                    if (tilemap._hackRenderer) {
                        tilemap._hackRenderer(tempRender);
                    }
                    tempRender.context.clearRect(0, 0, buf.width, buf.height);
                    for (i = 0; i < layers.length; i++) {
                        layers[i].clearModify();
                        layers[i].renderCanvas(tempRender);
                    }
                }
                this.layerTransform = this.worldTransform;
                for (i = 0; i < layers.length; i++) {
                    this.layerTransform = layers[i].worldTransform;
                    break;
                }
            };
            ;
            ZLayer.prototype.renderCanvas = function (renderer) {
                this.cacheIfDirty();
                var wt = this.layerTransform;
                renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution);
                var tilemap = this.tilemap;
                renderer.context.drawImage(this.canvasBuffer, 0, 0);
            };
            ;
            console.log('zzzzzzzzzzzzzzzzzzzzzzzzzzzZLayer: ', ZLayer);
            return ZLayer;
            
        }(PIXI.Container));
        tilemap_1.ZLayer = ZLayer;
    })(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})(PIXI || (PIXI = {}));

from corescript.

jonlepage avatar jonlepage commented on July 23, 2024

ok am not shure at 100% but what do you think about

ShaderTilemap.prototype._paintAllTiles = function(startX, startY) {

is the good class to call function and add some children in the ZLayer ?

from corescript.

jonlepage avatar jonlepage commented on July 23, 2024

ok close #127
it solved.
I hate this ShaderTilemap. 4 hours on and I think I have a solution. Why rmmv, do not do as UNITY and comment all codes.!!!!!!

pixiSSA._rmmvAlias.ShaderTilemap_paintAllTiles = ShaderTilemap.prototype._paintAllTiles;
ShaderTilemap.prototype._paintAllTiles = function(startX, startY) {
    pixiSSA._rmmvAlias.ShaderTilemap_paintAllTiles.call(this,startX, startY);
    // start add layer aniPictures
    this.addPictureAniLayers(pixiSSA._animationControler._pictures);

}


//TODO: faire un scan de tous les layer possible, et ajouter de haut en bas. Le scan peut etre fait au debut dans le plugin parameter
ShaderTilemap.prototype.addPictureAniLayers = function(aniLayersContainers) {
     console.log(this,'32áaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa32'); // wow work register Zindex
    //create all layer, but need check if we assign special rmmv layer
    for(layer in aniLayersContainers){
        console.log('layer: ', layer);
        if( aniLayersContainers[layer]._asignedRmmvLayer ){ // if assigned rmmv zLayer
            var layerGameName = aniLayersContainers[layer]._asignedLayerGame;
            if(layerGameName==='belowEvents'){ // couche sous Event dans lowerZLayer
                console.log('belowEvents: +++++++++++++++++++++');
                this.lowerZLayer.addChild(aniLayersContainers[layer]); // why i can no add all child to 0
                
            }
            
        }else{ // default Top Picture ZLayer TODO:
            //this.addChild(aniLayersContainers[layer]);
            
        }
        
    }
   
};

from corescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.