Ezelia / EZGUI

EZGUI - The missing GUI for Pixi.js and Phaser.io
http://ezgui.ezelia.com
440 stars 95 forks source link

Dynamic images? #54

Closed Shadowstep33 closed 8 years ago

Shadowstep33 commented 8 years ago

Is there a way to dynamically load images for button textures? The image property seems to be only trying to pull from PIXI's texture cache

alaa-eddine commented 8 years ago

No sorry, there is no such feature, since EZGUI is based on PIXI, and I don't think that Pixi provide such feature. if so, I can add it to EZGUI.

Shadowstep33 commented 8 years ago

PIXI's Sprites have a .fromImage function that will load in any url as a texture

Shadowstep33 commented 8 years ago

more specifically too, you could verify if something is in the cache first with

PIXI.utils.TextureCache[texture_name]
Shadowstep33 commented 8 years ago
                   if(typeof PIXI.utils.TextureCache[cfg.default] == "undefined"){
                        var img = new PIXI.Sprite( new PIXI.Texture.fromImage(cfg.default) );
                    }else{
                        var img = new PIXI.Sprite(cfg.texture);
                    }

The above around line 2220 in the built EZGUI.js seems to resolve this problem