How to move bitmap over frames?

Discussion in 'Javascript/Plugin Support' started by Levolpehh, Mar 25, 2019.

  1. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,785
    Likes Received:
    9,463
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    You're not rendering the scenes.
    https://pixijs.io/examples/#/basics/basic.js

    Btw. Fun fact: PIXI doesn't have any garbage gollector that would be responsible for all textures and as such you need to flush (release them from GPU memory) them by yourself. There is a garbage collector on the renderer, however it serves to deal with procedurally generated textures (text, graphics, etc.)
     
    #21
  2. Levolpehh

    Levolpehh Veteran Veteran

    Messages:
    87
    Likes Received:
    62
    First Language:
    English
    Primarily Uses:
    RMMV
    Would changing the scene serve to "flush" the textures? I'm displaying 30 sprites at a time, then set each of them to a texture based on whether or not a skill is learned or not, so they become 1 of 3 images, and the images update each time you learn a skill.

    I've also tried removing the render multiple times. Hasn't worked..
     
    #22
  3. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,785
    Likes Received:
    9,463
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    In the worst case press f12 for dev tools, they should display if there are errors.
    The only thing that catches my eye is, I don't know what Skills[index] is in your code. Do you have the skills etc. defined properly?
    Also, no, changing thr scenes does not flush textures. They need to be flushed manually or reused.
     
    #23
  4. Levolpehh

    Levolpehh Veteran Veteran

    Messages:
    87
    Likes Received:
    62
    First Language:
    English
    Primarily Uses:
    RMMV
    Skills[index] is just an array filled with a bunch of components that setup positions and functions for each button/sprite.
    for (var x = 0; x < Skills.length; x++) {
    this.createSkillButton(x);
    }
    Index refers to the index of Skills and the respective Button]

    There's also no errors. Just nothing appears. For your cat video, how did you setup the stage/app?
     
    Last edited: Mar 29, 2019
    #24
  5. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,785
    Likes Received:
    9,463
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    I did not set it up at all, I used default MV's. I just planted the three functions there as a plugin and used the SceneManager._scene.
     
    #25
  6. Levolpehh

    Levolpehh Veteran Veteran

    Messages:
    87
    Likes Received:
    62
    First Language:
    English
    Primarily Uses:
    RMMV
    Oh okay, we're onto something. Tried SceneManager._scene.addChild(sprite) and it worked for a few buttons. For some reason only works for ones nearest the top of the screen. I'll keep testing to see what the problem is..

    Untitled.png

    Think this element is the problem. The buttons above and below that blue bit are all touchable. If i were to delete it in the console, it fixes the problem. Would I have to add an exception to it like how you aliased the other Graphics.functions? o-o I'll try that in the meantime..

    edit: Yup that worked! I thiiiink.. I'm good?

    add this to your description :p
    Code:
        Alias_Graphics_createErrorPrinter = Graphics._createErrorPrinter;
        Graphics._createErrorPrinter = function() {
            Alias_Graphics_createErrorPrinter.call(this);
            this._errorPrinter.style.pointerEvents = "none";
        };
    I think I may have fixed the problem hours ago but since I never noticed only the top and bottom slices were working since I usually only checked the middle bit I didnt realize.. T__T
     
    Last edited: Mar 29, 2019
    #26
  7. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,785
    Likes Received:
    9,463
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    Well, I did not have problems with it as I don't use any plugins, so in my window it's smaller and doesn't really cause any troubles.

    But aliasing the createErrorPrinter should do the trick, that's true.
     
    #27
  8. Levolpehh

    Levolpehh Veteran Veteran

    Messages:
    87
    Likes Received:
    62
    First Language:
    English
    Primarily Uses:
    RMMV
    Back to earlier's topic about removing the sprites? I was under the assumption that moving to a new scene cleared it all out, so that's how I was doing it even previously with Sprite_Buttons. Does this.removeChild(); work? Would be pretty shite design wise if it just caused a big memory leak.
     
    #28
  9. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,785
    Likes Received:
    9,463
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    It's not about the sprites, but about the textures. Sprites get dealt with through Javascript's garbage collector as they're saved in RAM, but textures don't and need to be flushed manually as they're saved in GPU, where Javascript doesn't have access to (as they're manipulated via WebGL).
     
    #29
  10. Levolpehh

    Levolpehh Veteran Veteran

    Messages:
    87
    Likes Received:
    62
    First Language:
    English
    Primarily Uses:
    RMMV
    texture.on('dispose', this.destroyTexture, this);
    this.destroyTexture(texture);
    this.removeAll();

    do you know how to dispose of them or would one of these work?

    edit: think I got it.. thingiwanttodelete.destroy(); ?
     
    Last edited: Mar 29, 2019
    #30
  11. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,785
    Likes Received:
    9,463
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    Yup. The destroy method.
     
    #31
    Levolpehh likes this.
  12. Levolpehh

    Levolpehh Veteran Veteran

    Messages:
    87
    Likes Received:
    62
    First Language:
    English
    Primarily Uses:
    RMMV
    Alrighty, thanks again for all your help with learning Pixi! :kaoluv:

    I think I've got a better understanding of it now!
     
    #32

Share This Page