Flaxis / slick-ui

Lightweight Phaser UI plugin
http://slick-ui.com/
190 stars 25 forks source link

Added remove method in panel + Fix Phaser.Game reference in keyboard. #18

Closed elsemieni closed 7 years ago

elsemieni commented 7 years ago

I'm using Slick-UI in a professional project and I found some issues. Made some workarounds to handle them.

There's no destroy method for Slick-UI elements. (I think putting visible = false it's not much acceptable due to resource usage reasons). I implemented a basic one for SlickUI.Element.Panel. (Most used element I guess).

There's a reference to Phaser.Gameelement in SlickUI.Keyboard.Key, that doesn't work in some environments. In the code it references to "game", that didn't work when game is not defined as Phaser.Game. Replaced with Slick-UI Phaser.Game reference (plugin.game).

Any improvement to the code will be appreciated.

P.S. That's a good lib :) Good work!

Flaxis commented 7 years ago

Looks like I missed the reference to the game variable in the SlickUI.Keyboard.Key when cleaning up that stuff. Destroying panels does seem useful, so this can be merged :)

Thanks for your contribution!