Another FlashPunk GUI Library (FPGUI)

(Martí Angelats i Ribera) #1

I’m creating a full GUI Library wich i called FPGUI. It’s not finished and pretty unestable but there are some parts that i think can help to other people (especially the components or the GUIText).
This library have two ways to work (you can use both at the same time but they work independetly). The first one you can call directly the different components you want and add them in a world like a normal Entity. The second one is using an Skin.

Using components directly

You only need to call a constructor and you have an entity.
You can handle differents events by setting the function that you want to be called as a variable (depending of the variable, you’ll handle a different event).

Using skins

This part is not finished yet.
The way it works is importing an skin wich have an encoded data on the top (i’ve planned to make an editor). You only need to embed the .png file in a class and use it to create a new class (no more arguments needed).
To get components from an Skin, you simply use public function that have less arguments.

I would apreciate any suggestion, idea or help for my project.
GitHub link of the project

(azrafe7) #2


Some random notes (hopefully constructive :wink:):

  • you should probably try to avoid adding/removing event listeners on stage and only use FP.Input also for clicks/doubleclicks
  • some constructors take a high number of parameters which makes their use a bit weird, you may consider refactoring into a sort of Settings class, split it into separate functions or maybe use the same approach used by FlashPunk’s Text
  • there are quite a bunch of 1-2-letter variables in there, hehe
  • adding some 9-slice scaling features would be really nice
  • also a default skin to play with
  • … aaand a showcase swf so that everyone can take a look at it before cloning the repo

Keep up the good work! :smiley:

(Martí Angelats i Ribera) #3

Hi, thanks for your notes (another way of see what you do, makes you improve) :smiley:

  • The event listeners i’ve used for clicking/doubleclicking was used becouse if you double click pretty fast there is a change that there is no disctincion between a click or a double click. It also means that the speed of the double click is different that the one setted in your computer (maybe i should make a class to be sure there is only one listener or find a way to not use it at all).
  • Yeah you are probably right about the contructors (i think the wierest constructor is the Slider’s one, but it allows you to make an Slider in any direction, even in diagonal). Maybe also using geom Classes like more Points and Rectangles would make the constructor have less parameters. For the Settings, i’m working on it: it will use an Skin (it don’t have to have images).
  • I liked the idea of using an options Object like in Text in a contructor. I’ll probably use it.
  • The 1-2-letters variable will be killed (I let you choose: violently but fast, or slowly ;))
  • The 9-slice scalling is actually in the SkinPart code (with 3-slice scale). Maybe allowing to do it to any image would be great.
  • I have to change and debug the Skin class, when done, I’ll probably make a default one.
  • Make a showcase swf? Great idea! Didn’t think about it.

Thank you again for your time. I think it really helped me :smile:

TL;DR: Thanks for that notes, they really helped (i’ll modify some things).