mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 10:27:47 +02:00
Update
This commit is contained in:
parent
16d20da5ab
commit
d06ebd53f9
0
docs_md/api_reference/druid_button.md
Normal file
0
docs_md/api_reference/druid_button.md
Normal file
74
docs_md/quick_api_reference.md
Normal file
74
docs_md/quick_api_reference.md
Normal file
@ -0,0 +1,74 @@
|
||||
# Quick API Reference
|
||||
|
||||
## Druid
|
||||
```lua
|
||||
local druid = require("druid.druid")
|
||||
|
||||
druid.init_window_listener()
|
||||
druid.on_language_change()
|
||||
druid.on_window_callback(window_event)
|
||||
druid.set_default_style(style)
|
||||
druid.set_sound_function(callback)
|
||||
druid.set_text_function(callback)
|
||||
|
||||
self.druid = druid.new(context, [style])
|
||||
```
|
||||
|
||||
## Druid Instance
|
||||
```lua
|
||||
self.druid:final()
|
||||
self.druid:update(dt)
|
||||
self.druid:on_input(action_id, action)
|
||||
self.druid:on_message(message_id, message, sender)
|
||||
|
||||
self.druid:new(component, ...)
|
||||
self.druid:new_back_handler([callback], [params])
|
||||
self.druid:new_blocker(node)
|
||||
self.druid:new_button(node, [callback], [params], [anim_node])
|
||||
self.druid:new_container(node, [mode], [callback])
|
||||
self.druid:new_data_list(druid_scroll, druid_grid, create_function)
|
||||
self.druid:new_drag(node, [on_drag_callback])
|
||||
self.druid:new_grid(parent_node, item, [in_row])
|
||||
self.druid:new_hotkey(keys_array, [callback], [callback_argument])
|
||||
self.druid:new_hover(node, [on_hover_callback], [on_mouse_hover_callback])
|
||||
self.druid:new_input(click_node, text_node, [keyboard_type])
|
||||
self.druid:new_lang_text(node, [locale_id], [adjust_type])
|
||||
self.druid:new_layout(node, [mode])
|
||||
self.druid:new_progress(node, key, [init_value])
|
||||
self.druid:new_rich_input(template, [nodes])
|
||||
self.druid:new_rich_text(text_node, [value])
|
||||
self.druid:new_scroll(view_node, content_node)
|
||||
self.druid:new_slider(pin_node, end_pos, [callback])
|
||||
self.druid:new_swipe(node, [on_swipe_callback])
|
||||
self.druid:new_text(node, [value], [no_adjust])
|
||||
self.druid:new_timer(node, [seconds_from], [seconds_to], [callback])
|
||||
self.druid:new_widget(widget, [template], [nodes], ...)
|
||||
self.druid:on_window_event([window_event])
|
||||
self.druid:remove(component)
|
||||
self.druid:set_blacklist(blacklist_components)
|
||||
self.druid:set_whitelist(whitelist_components)
|
||||
```
|
||||
|
||||
## Components
|
||||
### Base Component
|
||||
### Blocker
|
||||
### Button
|
||||
### Container
|
||||
### Data List
|
||||
### Drag
|
||||
### Grid
|
||||
### Hotkey
|
||||
### Hover
|
||||
### Input
|
||||
### Lang Text
|
||||
### Layout
|
||||
### Progress
|
||||
### Rich Input
|
||||
### Rich Text
|
||||
### Scroll
|
||||
### Slider
|
||||
### Swipe
|
||||
### Text
|
||||
### Timer
|
||||
|
||||
## Helper
|
@ -91,30 +91,30 @@ local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
---@class druid.scroll: druid.base_component
|
||||
---@field node node
|
||||
---@field click_zone node|nil
|
||||
---@field on_scroll event On scroll move callback(self, position)
|
||||
---@field on_scroll_to event On scroll_to function callback(self, target, is_instant)
|
||||
---@field on_point_scroll event On scroll_to_index function callback(self, index, point)
|
||||
---@field view_node node Scroll view node
|
||||
---@field view_border vector4 Scroll view border
|
||||
---@field content_node node Scroll content node
|
||||
---@field view_size vector3 Scroll view size
|
||||
---@field node node The root node
|
||||
---@field click_zone node|nil Optional click zone to restrict scroll area
|
||||
---@field on_scroll event Triggered on scroll move with (self, position)
|
||||
---@field on_scroll_to event Triggered on scroll_to with (self, target, is_instant)
|
||||
---@field on_point_scroll event Triggered on scroll_to_index with (self, index, point)
|
||||
---@field view_node node The scroll view node (static part)
|
||||
---@field view_border vector4 The scroll view borders
|
||||
---@field content_node node The scroll content node (moving part)
|
||||
---@field view_size vector3 Size of the view node
|
||||
---@field position vector3 Current scroll position
|
||||
---@field target_position vector3 Current scroll target position
|
||||
---@field available_pos vector4 Available position for content node: (min_x, max_y, max_x, min_y)
|
||||
---@field available_size vector3 Size of available positions: (width, height, 0)
|
||||
---@field drag druid.drag Drag Druid component
|
||||
---@field selected number|nil Current index of points of interests
|
||||
---@field is_animate boolean Flag, if scroll now animating by gui.animate
|
||||
---@field private _is_inert boolean Flag, if scroll now moving by inertion
|
||||
---@field private inertion vector3 Current inert speed
|
||||
---@field private _is_horizontal_scroll boolean Flag, if scroll now horizontal
|
||||
---@field private _is_vertical_scroll boolean Flag, if scroll now vertical
|
||||
---@field private _grid_on_change event Grid on change items event
|
||||
---@field private _grid_on_change_callback function Grid on change items callback
|
||||
---@field private _offset vector3 Offset value to set, where content is starts
|
||||
---@field private style table Component style params
|
||||
---@field target_position vector3 Target scroll position for animations
|
||||
---@field available_pos vector4 Available content position (min_x, max_y, max_x, min_y)
|
||||
---@field available_size vector3 Size of available positions (width, height, 0)
|
||||
---@field drag druid.drag The drag component instance
|
||||
---@field selected number|nil Current selected point of interest index
|
||||
---@field is_animate boolean True if scroll is animating
|
||||
---@field private _is_inert boolean True if inertial scrolling is enabled
|
||||
---@field private inertion vector3 Current inertial movement vector
|
||||
---@field private _is_horizontal_scroll boolean True if horizontal scroll enabled
|
||||
---@field private _is_vertical_scroll boolean True if vertical scroll enabled
|
||||
---@field private _grid_on_change event Grid items change event
|
||||
---@field private _grid_on_change_callback function Grid change callback
|
||||
---@field private _offset vector3 Content start offset
|
||||
---@field private style table Component style parameters
|
||||
local M = component.create("scroll")
|
||||
|
||||
|
||||
|
@ -424,7 +424,7 @@ function M._update_nodes(lines, settings)
|
||||
gui.set_outline(node, word.outline)
|
||||
gui.set_shadow(node, word.shadow)
|
||||
gui.set_text(node, word.text)
|
||||
gui.set_color(node, word.color or word.text_color)
|
||||
gui.set_color(node, word.color)
|
||||
gui.set_font(node, word.font or settings.font)
|
||||
end
|
||||
word.node = node
|
||||
|
@ -100,6 +100,7 @@ local rich_text = require("druid.custom.rich_text.module.rt")
|
||||
---@class druid.rich_text.word
|
||||
---@field node node
|
||||
---@field relative_scale number
|
||||
---@field source_text string
|
||||
---@field color vector4
|
||||
---@field position vector3
|
||||
---@field offset vector3
|
||||
|
@ -7,6 +7,8 @@
|
||||
---@field height number
|
||||
---@field max_ascent number
|
||||
---@field max_descent number
|
||||
---@field offset_x number
|
||||
---@field offset_y number
|
||||
|
||||
---@class utf8
|
||||
---@field len fun(s: string):number
|
||||
|
@ -85,9 +85,8 @@ local function create_widget(self, widget_class)
|
||||
__index = setmetatable(widget_class, WIDGET_METATABLE)
|
||||
})
|
||||
|
||||
local uid = base_component.create_uid()
|
||||
instance._component = {
|
||||
_uid = uid,
|
||||
_uid = base_component.create_uid(),
|
||||
name = "Druid Widget",
|
||||
input_priority = const.PRIORITY_INPUT,
|
||||
default_input_priority = const.PRIORITY_INPUT,
|
||||
|
Loading…
x
Reference in New Issue
Block a user