Prepare for release 0.8.0

This commit is contained in:
Insality
2022-02-12 17:02:27 +02:00
parent a75dd5a6f9
commit 4e0fd264b1
39 changed files with 280 additions and 175 deletions

View File

@@ -19,52 +19,53 @@ local M = component.create("my_component")
function M.init(self, ...)
end
-- Call only if exist interest: component.ON_UPDATE
-- [OPTIONAL] If declared, will call this on script.update function
function M.update(self, dt)
end
-- Call only if exist interest: component.ON_INPUT
-- [OPTIONAL] If declared, will call this on script.on_input function
function M.on_input(self, action_id, action)
end
-- Call on component creation and on component:set_style() function
-- [OPTIONAL] If declared, will call on component creation and on component:set_style() function
function M.on_style_change(self, style)
end
-- Call only if exist interest: component.ON_MESSAGE
-- [OPTIONAL] If declared, will call this on script.on_message function
function M.on_message(self, message_id, message, sender)
end
-- Call only if component with ON_LANGUAGE_CHANGE interest
-- [OPTIONAL] If declared, will call this on druid.on_language_change call
function M.on_language_change(self)
end
-- Call only if component with ON_MESSAGE_INPUT interest
-- [OPTIONAL] If declared, will call this on const.ON_MESSAGE_INPUT message to Druid script instance
function M.on_message_input(self, node_id, message)
end
-- Call only if component with ON_LAYOUT_CHANGE interest
-- [OPTIONAL] If declared, will call this on layout changing
function M.on_layout_change(self)
end
-- Call, if input was capturing before this component
-- [OPTIONAL] If declared, will call this on layout changing, if input was capturing before this component
-- Example: scroll is start scrolling, so you need unhover button
function M.on_input_interrupt(self)
end
-- Call, if game lost focus. Need ON_FOCUS_LOST intereset
-- [OPTIONAL] If declared, will call this if game lost focus
function M.on_focus_lost(self)
end
-- Call, if game gained focus. Need ON_FOCUS_GAINED intereset
-- [OPTIONAL] If declared, will call this if game gained focus
function M.on_focus_gained(self)
end
-- Call only if exist interest: component.ON_LATE_INIT
-- [OPTIONAL] If declared, will call this if late init step (first frame on update)
function M.on_late_init(self)
end
-- Call on component remove or on druid:final
-- [OPTIONAL] If declared, will call this on component remove from Druid instance
function M.on_remove(self)
end
@@ -100,29 +101,6 @@ function init(self)
end
```
### Interest
Interest - is a way to indicate what events your component will respond to.
There is next interests in druid:
- **ON_MESSAGE** - component will receive messages from on_message
- **ON_UPDATE** - component will be updated from update
- **ON_INPUT_HIGH** - component will receive input from on_input, before other components with ON_INPUT
- **ON_INPUT** - component will receive input from on_input, after other components with ON_INPUT_HIGH
- **ON_LANGUAGE_CHANGE** - will call _on_language_change_ function on language change trigger
- **ON_MESSAGE_INPUT** - will call _on_message_input_ function on Druid _const.ON_MESSAGE_INPUT_ message
- **ON_LAYOUT_CHANGE** will call _on_layout_change_ function on layout change trigger
- **ON_FOCUS_LOST** will call _on_focust_lost_ function in on focus lost event. You need to pass window_callback to global `druid:on_window_callback`
- **ON_FOCUS_GAINED** will call _on_focust_gained_ function in on focus gained event. You need to pass window_callback to global `druid:on_window_callback`
- **ON_LATE_INIT** will call _on_late_init_ function once after component init on update step.
## Best practice on custom components
On each component recommended describe component scheme in next way:
@@ -160,4 +138,4 @@ end
## Power of using templates
You can use one component, but creating and customizing templates for them. Templates only requires to match the component scheme.
You can use one component, but creating and customizing templates for them. Templates only requires to match the component scheme.

View File

@@ -184,7 +184,7 @@ Have a good day.
- Lang text now can be initialized without default locale id
- Input component: rename field _selected_ to _is_selected_ (according to the docs)
- **#92** Setup repo for CI and unit tests. (Yea, successful build and tests badges!)
- **#86** Fix a lot of event triggers on scroll inertia moving
- **#86** Fix a lot of event triggers on scroll inertia moving
- **#101** Fix scroll to other node instead of swipe direction with scroll's points of interest (without inert settings)
- **#103** Add `helper.centate_nodes` function. It can horizontal align several Box and Text nodes
- **#105** Add `Input:select` and `Input:unselect` function.
@@ -269,4 +269,48 @@ Good luck!
- **#144** [Scroll] Fix some glitches with scroll Points of Interest. Remove false detection of scroll stopped.
- **#142** [Scroll] Add Scroll style param `WHEEL_SCROLL_BY_INERTION` (default - false). If true - mouse wheel will add inertion to scroll, if false - set position directly per mouse wheel event.
- This fix caused because Mac trackpad seems have additional mouse wheel events for simulate inertion. If you uncomfortable with this, you can disable `WHEEL_SCROLL_BY_INERTION` for more controllable scroll by mouse wheel.
- **#132** Add example with grid add/remove with animations
- **#132** Add example with grid add/remove with animations
### Druid 0.8.0
Hello!
In this Druid update no any huge special features. Mostly the bug fixes and reworking the component's interest points. If you used interests in your custom components, you should remove it from `component.create` and all should works as before.
Also added last row allignment in Static Grid component with "dynamic content poses" style enabled. You can look how it is work here: https://insality.github.io/druid/druid/?example=grid_static_grid_dynamic_pos
You can say thanks to me via stars on GitHub 3! :wink:
Wanna something more? [Add an issues!](https://github.com/Insality/druid/issues)
Have a nice day!
**Changelog 0.8.0**
---
- **#160** __[BREAKING]__ Remove component interests list
- The component interests now setup via function declaration inside your components. The functions are still the same.
- Now `component.create` function have next signature: _create(component_name, input_priority)_
- Your should remove interests list from your custom components if exists
- From `component.create("custom", { component.ON_INPUT, component.ON_LATE_INIT }, const.PRIORITY_INPUT_HIGH)` to
`component.create("custom", const.PRIORITY_INPUT_HIGH)`
- **#166** [Input] Fix issue with Cyrillic symbols in range "[А-я]"
- **#162** [Static Grid] Add last row alignment with dynamic content poses enabled
- Add style param: _static_grid.IS_ALIGN_LAST_ROW_, true by default. Works only if _static_grid.IS_DYNAMIC_NODE_POSES_ enabled. See the "Static grid with dynamic poses" example.
- **#163** [Lang Text] Set default locale_id value from text node
- **#147** [Lang Text] Remove `...` from lang_text to fixed arguments, add _format_ function to change only string format arguments
- There are some issues with `...`. Now Lang Text will support up to 7 _string.format_ arguments
- [Lang Text] Add more self chaining to Lang text component (_set_to_, _translate_ and _format_ functions)
- **#151** [Text] Fix text adjust by height
- It still have not perfect fitting, but it's good enough!
- **#164 #150** [Scroll] Fix `scroll:scroll_to_percent` by Y position
- **#148** [Scroll] Remove scroll inertion after scroll `animate` or `set_to` functions
- [Input] Add current text argument to _on_input_unselect_ event
- **#152** [Checkbox] Add _is_instant_ argument to `set_state` function
- Add _initial_state_ argument to Checkbox component constructor
- **#149** [Button] Call button style functions after actual callback
- **#153** System: Mode Druid acquire input to late_init step
- Required to solve issues, when go input acquire can be later, when gui input acquire (on init step)
- **#154** System: Change text adjust const to strings
- **#155** Fix: Add margin to total width calculation in `helper.centrate_nodes`