Druid 1.1.0
Hello there, Druid users!
The wait is over - Druid 1.1.0 has arrived! This update brings substantial improvements and exciting new features that make building UI in Defold easier and more powerful than ever.
By the way, the PR number of this release is #300. It’s sounds ve-eery huge and the long journey for me!
Highlights
- Widgets are here! This is the evolution of custom components, but Widgets with totally no boilerplate code and far more convenient usage. All Druid examples have been migrated to use widgets. Widgets are now a default way to create a new user custom components.
The widget code is simple as:
---@class my_widget: druid.widget
local M = {}
function M:init()
-- Druid is available now
self.button = self.druid:new_button("button")
end
return M
To instantiate a widget, you need to call
local my_widget = require("widgets.my_widget.my_widget")
self.widget = self.druid:new_widget(my_widget, "widget_template_id")
To create a widget with a even more fast way, now you always can right click on GUI file and select Create Druid Widget
to create a widget file for current GUI file nearby.
-
No more calling
druid.register()
! All Druid components are now available by default withself.druid:new_*
functions, making getting started simpler than ever. -
Druid UI Kit brings fonts, atlas, and ready-to-use GUI templates right out of the box - a long-requested feature that lets you use Druid UI elements instantly in your projects. I think now it’s a possible to create even a external dependencies with a set of GUI templates and Druid’s widgets to make a ready to use UI kit for projects! The flow to init widgets always now from two steps:
- Add GUI template to your GUI scene
- Call
self.widget = self.druid:new_widget(widget_file, "template_id")
to init widget - or Call
self.widget = self.druid:new_widget(widget_file, "template_id", "tempalate_id/root")
to clone root node from template and init widget from it
-
Completely reworked documentation with full code annotations. Let’s check the new brand Quick API Reference to get familiar with Druid. Any documentation are generated from the code annotations, so in case to update documentation, you need to update annotations in the code directly.
-
Updated Editor Scripts. The editor scripts also reworked to be in pure Lua without any dependencies, so using additional options now are much easier. Now for the “Create Widget” or “Create GUI Script” the template can be changed in dedicated “Druid Settings” menu
Breaking Changes
druid.event
has been replaced with the defold-event library, requiring a small migration in your code if you were using Druid events directly before. Double dependencies:defold-event
anddruid
are now required to use Druid.
This release represents a major step forward in making Druid more maintainable, readable, and powerful. Check out the full changelog for all the details!
The contributing guide is created for people who want to contribute to the Druid.
Thank you for using Druid and please share your feedback!
Changelog 1.1.0
- [Docs] Reworked all documentation pages
- The code now is fully annotated
- The old API website is removed
- The API now placed as a markdown files in the
api
folder of the repository - Start with Quick API Reference to learn how to use Druid
- [BREAKING] Remove
druid.event
, replaced withdefold-event
library. Now it required to two dependencies to use Druid.- This allow to make more flexible features, like shaders and sync init functions between script and gui_script in various cases.
- You need to migrate from
require("druid.event")
torequire("event.event")
if you are using it in your project - If you are used
event.is_exist()
now, you should use#event > 0
ornot event:is_empty()
instead - Use 11+ version of
defold-event
library:https://github.com/Insality/defold-event/archive/refs/tags/11.zip
- Read defold-event to learn more about the library
- [UI Kit] Add Druid UI Kit, contains
druid.atlas
,druid_text_bold.font
,druid_text_regular.font
so now you can use Druid GUI files in your projects.- Contains mostly basic shapes for the UI and can contains several icons. Atlas is a small, only
128x128
size and will be included in build only if you use it. Probably will grow a little bit in future. - A long waited feature which allows try or just use some Druid GUI features almost instantly.
- No more “rich_input” template is not working! Should be good for now.
- Now GUI files from Druid can be added inside your project.
- This allow to include
Default Widgets
- ready to use GUI templates - Two fonts will keep in the UI Kit:
druid_text_bold.font
anddruid_text_regular.font
. They each of them~100KB
, already contains extended characters set, with font size of40
.
- Contains mostly basic shapes for the UI and can contains several icons. Atlas is a small, only
- [Widgets] Widgets here!
- A replacement for Druid’s
custom_components
. Basically it’s the same, butwidgets
contains no boilerplate code and more convinient to use. - Now I can include a kind of
widgets
with Druid and you can use it almost instantly in your project. - All Druid Examples was migrated to use Widgets instead of Custom Components.
- A replacement for Druid’s
- [Widgets] Widgets can be used in GO
script
files.- It’s a kind of experimental feature, but looks fun to check.
- Added the
druid_widget.gui_script
which can register a Druid instance for this GUI scene. - You can use
druid.get_widget(class, url)
to get a Druid instance in GO context. - All top level functions from widget are available in GO context.
- It uses an
defold-event
library, so wrapping have a costs.
- [System]
No need for the
druid.register()
! Now all Druid’s components are available by default and available withself.druid:new_*
functions- This means the Druid will be bigger in size, but it’s much comfortable to use
- In case you want to delete components you are not using, you can do it in fork in
druid.lua
file - Read optimize_druid_size.md to learn how to reduce the size of the Druid library if you interested
- Any additional new widgets, utilities files will be not included until you use it
- You still can register your custom components to make a aliases for them. Widgets are not supported here.
- [BREAKING] Removed old
druid.no_stencil_check
anddruid.no_auto_template
flags. Now it’s always disabled - [System] Huge code refactoring and improvements. The goal is to raise maintainability and readability of the code to help people to contribute.
- [Docs] Add CONTRIBUTING.md file with various information to help people to contribute to the Druid.
- [Editor Scripts] Updated editor scripts
- [Editor Scripts] Add “[Druid] Create Druid Widget” instead of “Create Custom Component”
- [Editor Scripts] Add “[Druid] Create Druid GUI Script”
- [Editor Scripts] Add “[Druid] Settings” editor dialog
- Contains different documentation links
- You can adjust the widget template path to use your own templates in “Create Druid Widget” editor script
- And edit a template for the “Create GUI script” option
- [Text] Add
trim_left
andscale_then_trim_left
text adjust modes - [Text] Add
set_text
function insteadset_to
(theset_to
now deprecated) - [Widget] Add widget
mini_graph
- [Widget] Add widget
memory_panel
(works overmini_graph
widget) - [Widget] Add widget
fps_panel
(works overmini_graph
widget) - [Widget] Add widget
properties_panel
- [Unit Tests] Updated Unit tests
- Now it’s cover more cases and more code, which is great!
A big thanks to the my Github supporters:
And all my other supporters! Very appreciated!
Support
Please support me if you like this project! It will help me keep engaged to update Druid and make it even better!