Hey so i saw a thread today that someone is making a custom Interface System based on Flutter so I thought ill show you all the system I made a few weeks back using Kotlin DSL, So i will show you what i have so far and a few interface samples please note I'm learning kotlin still so please post constructive feedback
Why?
Long Story short i hate how the 317 engine handles hard coded interfaces and how other people do it looks really ugly i think before you say Don't hardcode interfaces i like doing it a lot more just due to not having great tools and find it much faster (MY SYSTEM DOES ALLOW FOR PACKING THE INTERFACE FILE ALSO AND LOADING ON DEMAND)
InterfaceBuilder:
This contains basic information
- Starting ID
- List of children
- Widget Type
buildInterface:
Build interface is the method that invokes the InterfaceBuilder and builds up the interface
this has 6 basic parameters
- ID - Starting ID of the interface
- Interface Width - Width of the interface (Optional)
- Interface Height - Height of the interface (Optional)
- Center - This allows the programmer to center the interface based on the two above parameters them 3 are optional, this is nice for development so i can get the X and Y of the thing in the interface on Photoshop and put it in game and not have to worry about repositioning everything (Optional)
- BuildFrame - If you want the frame to automatically build dynamically
- HasClose - If the interface needs a close button
Components:
Every single Component has 1 basic pram the Position the rest are defined individually for example
They also have 1 extra function at the moment this allows you to add row/cols of Components very quick bu just calling this
Code:
buttons(SkillData.values().size,8,13,20) {
normal { 29 }
hover { 27 }
position { Position(12,40) }
}
if you have a 's' in the method it acts like its a look and take a minimum of 2 parameters or 4 parameters but they are optional
- How many you want in the loop
- How many you want per row
- PadX - Adds extra padding to the component if you don't have any extra padding it will use the size of the component + 1
- PadY - Adds extra padding to the component if you don't have any extra padding it will use the size of the component + 1
Current Components:
Some Components as special things for example buttons will resize depending on the size and if u you want it dynamically built or you can use sprites, I do plan on adding a lot more Components and building on this system.
Pros and Cons:
Pros:
- Really Quick to build interfaces
- Nice and clean for other Developers to come in and look at
- Can be Cache Packed and Loaded on demand
- Lots of Features to allow for even the crappy of devs to make a interface with no sprite work
- Tells you if the interface ID is taken already by some existing interface
Cons:
- not everyone knows kotlin
- Hard to see components IDs like Item Containers working on a fix
Thanks for reading i will be updating this post as and when i add new things here are some Examples of some working interfaces using this system
Credits:
Thanks for the help from raccas and his moral support