Description
Refactor and improvements include:
- reduce GC by not creating tables/strings when they can be reused
- consistent casing:
snake_case
for variables,PascalCase
for methods - abstraction of commonly used strings/types
- easier to read boolean evaluation (lua's ternary operation) for default values
- convert single-quote strings to double-quote strings
After refactoring:
- measure performance/garbage generated of both the old and new version for comparison
NOTE that these are internals thus wont be breaking changes for the users.
Im seriously thinking of changing the fields passed in table/option to widgets from PascalCase
to snake_case
to make it uniform, this would however lead to breaking changes and users will have to update all of their code to match the new casing. What do you users of Slab think of this? Please feel free to share your thoughts :)
Example of the change would be:
Slab.BeginWindow("id", {Title = "PascalCase Title", X = 0, Y = 0, AutoResizeWindow = true)})
--to
Slab.BeginWindow("id", {title = "snake_case title", x = 0, y = 0, auto_resize_window = true})
-
Button
-
CheckBox
-
ColorPicker
-
ComboBox
-
Config
-
Dialog
-
Dock
-
DrawCommands
-
FileSystem
-
Image
-
Input
-
Keyboard
-
LayoutManager
-
ListBox
-
Menu
-
MenuBar
-
MenuState
-
Messages
-
Mouse
-
Region
-
Seperator
-
Shape
-
Stats
-
Text
-
Tooltip
-
Tree
-
Utility
-
Window
Development of v1.0.0 is taking a long break since I have been really busy with work + 3 side projects.
The only thing we are missing for this major release is some functionalities are not working anymore:
- resizing window
- moving/dragging window
- Almost every mouse interaction
- Button layout and rendering
- Checkbox layout and rendering
Tested widgets/UIs:
- Button
- CheckBox
- ColorPicker
- ComboBox
- Cursor
- Dialog
- Dock
- Image
- Input
- Interaction
- Layout
- ListBox
- Menus
- Messages
- Properties
- SaveState
- ScrollBar
- Separator
- Setup
- Shader
- Shape
- SlabDebug
- Stats
- Style
- Text
- Tooltip
- Tree
- Window
It would be great if someone can do a full test and list here the things that are broken so that other people can also help with the fixing. Thank you!
BREAKING CHANGES
The following now have the function signature (id, selected, opt)
- ComboBox
- ListBoxItem
- RadioButton
Example:
--before
if Slab.ComboBox("combobox", {Selected = "Apple"}) then end
--after
if Slab.ComboBox("combobox", "Apple"}) then end