Skip to content

Commit

Permalink
Merge branch 'develop': add example for grid animations
Browse files Browse the repository at this point in the history
  • Loading branch information
Insality committed May 30, 2021
2 parents c34ce71 + 305c300 commit 105f672
Show file tree
Hide file tree
Showing 16 changed files with 869 additions and 28 deletions.
1 change: 1 addition & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ globals = {
"buffer",
"resource",
"defos",
"html5",
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ druid.on_window_callback(event)

- **[Dynamic Grid](docs_md/01-components.md#dynamic-grid)** - Component to manage node positions with different sizes. Only in one row or column

- **[Data List](docs_md/01-components.md#data-list)** - Component to manage data for huge dataset in scroll

- **[Input](docs_md/01-components.md#input)** - User text input component

- **[Lang text](docs_md/01-components.md#lang-text)** - Wrap on Text component to handle localization
Expand Down
2 changes: 1 addition & 1 deletion docs/druid/archive/archive_files.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"content":[{"name":"game.projectc","size":3432,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":10608,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":384566,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":23386,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]}
{"content":[{"name":"game.projectc","size":3432,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":11568,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":388522,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":25565,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]}
Binary file modified docs/druid/archive/game.arcd0
Binary file not shown.
Binary file modified docs/druid/archive/game.arci0
Binary file not shown.
Binary file modified docs/druid/archive/game.dmanifest0
Binary file not shown.
8 changes: 4 additions & 4 deletions docs/druid/archive/game.projectc0
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[project]
title = druid
version = 0.6.459
version = 0.6.466
write_log = 0
compress_archive = 1
publisher = Insality
developer = Insality
commit_sha = 015564f5b3e0d5e63e422056c69e53826ed689bf
build_time = 2021-04-05T21:00:43Z
commit_sha = ffa3bafa002c561f6f4a31e8bbca228c3606b1cc
build_time = 2021-05-30T08:51:36Z

[display]
width = 600
Expand Down Expand Up @@ -121,7 +121,7 @@ default_language = en
localizations = en

[android]
version_code = 459
version_code = 466
minimum_sdk_version = 16
target_sdk_version = 29
package = com.insality.druid
Expand Down
Binary file modified docs/druid/archive/game.public.der0
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/druid/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- The above 4 meta tags *must* come first in the head; any other head content must come *after* these tags -->

<title>druid 0.6.459</title>
<title>druid 0.6.466</title>
<style type='text/css'>
/* Disable user selection to avoid strange bug in Chrome on Windows:
* Selecting a text outside the canvas, then clicking+draging would
Expand Down
66 changes: 46 additions & 20 deletions docs_md/01-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


## Button
[Button API here](https://insality.github.io/druid/modules/druid.button.html)
[Button API here](https://insality.github.io/druid/modules/Button.html)

### Overview
Basic Druid input component. Handle input on node and provide different callbacks on touch events.
Expand Down Expand Up @@ -36,7 +36,7 @@ _fill example usecases_


## Text
[Text API here](https://insality.github.io/druid/modules/druid.text.html)
[Text API here](https://insality.github.io/druid/modules/Text.html)

### Overview
Basic Druid text component. Text components by default have the text size adjusting.
Expand All @@ -55,7 +55,7 @@ Create text node with druid: `text = druid:new_text(node_name, [initial_value],


## Blocker
[Blocker API here](https://insality.github.io/druid/modules/druid.blocker.html)
[Blocker API here](https://insality.github.io/druid/modules/Blocker.html)

### Overview
Druid component for block input. Use it to block input in special zone.
Expand All @@ -75,7 +75,7 @@ So you can do the safe zones, when you have the big buttons


## Back Handler
[Back handler API here](https://insality.github.io/druid/modules/druid.back_handler.html)
[Back handler API here](https://insality.github.io/druid/modules/BackHandler.html)

### Overview
Component to handle back button. It handle Android back button and Backspace key. Key triggers in `input.binding` should be setup for correct working.
Expand All @@ -87,7 +87,7 @@ Setup callback with `druid:new_back_handler(callback)`


## Lang text
[Lang text API here](https://insality.github.io/druid/modules/druid.lang_text.html)
[Lang text API here](https://insality.github.io/druid/modules/LangText.html)

### Overview
Wrap on Text component to handle localization. It uses druid get_text_function to set text by it's id
Expand All @@ -99,7 +99,7 @@ Create lang text component with druid `text = druid:new_lang_text(node_name, loc


## Scroll
[Scroll API here](https://insality.github.io/druid/modules/druid.scroll.html)
[Scroll API here](https://insality.github.io/druid/modules/Scroll.html)

### Overview
Basic Druid scroll component. Handle all scrolling stuff in druid GUI
Expand All @@ -120,7 +120,7 @@ Usually, Place _view_node_ and as children add _content_node_:
*Here content_node below view_node, in game content_node be able to scroll left until end*

### Notes
- Scroll by default style have inertion and extra size for strecthing effect. It can be adjust via scroll [style settings](https://insality.github.io/druid/modules/druid.scroll.html#Style)
- Scroll by default style have inertion and extra size for strecthing effect. It can be adjust via scroll [style settings](https://insality.github.io/druid/modules/Scroll.html#Style)
- You can setup "points of interest". Scroll always will be centered on closes point of interest. It is able to create slider without inertion and points of interest on each scroll element.
- Scroll have next events:
- *on_scroll* (self, position) On scroll move callback
Expand All @@ -133,7 +133,7 @@ Usually, Place _view_node_ and as children add _content_node_:


## Progress
[Progress API here](https://insality.github.io/druid/modules/druid.progress.html)
[Progress API here](https://insality.github.io/druid/modules/Progress.html)

### Overview
Basic Druid progress bar component
Expand All @@ -151,7 +151,7 @@ Key is value from druid const: const.SIDE.X (or just "x") or const.SIDE.Y (or ju


## Slider
[Slider API here](https://insality.github.io/druid/modules/druid.slider.html)
[Slider API here](https://insality.github.io/druid/modules/Slider.html)

### Overview
Basic Druid slider component
Expand All @@ -167,7 +167,7 @@ Pin node (node_name in params) should be placed in zero position (initial). It w


## Input
[Input API here](https://insality.github.io/druid/modules/druid.input.html)
[Input API here](https://insality.github.io/druid/modules/Input.html)

### Overview
Basic Druid text input component
Expand All @@ -187,7 +187,7 @@ Create input component with druid: `input = druid:new_input(button_node_name, te


## Checkbox
[Checkbox API here](https://insality.github.io/druid/modules/druid.checkbox.html)
[Checkbox API here](https://insality.github.io/druid/modules/Checkbox.html)

### Overview
Basic Druid checkbox component.
Expand All @@ -201,7 +201,7 @@ Create checkbox component with druid: `checkbox = druid:new_checkbox(node, callb


## Checkbox group
[Checkbox group API here](https://insality.github.io/druid/modules/druid.checkbox_group.html)
[Checkbox group API here](https://insality.github.io/druid/modules/CheckboxGroup.html)

### Overview
Several checkboxes in one group
Expand All @@ -215,7 +215,7 @@ Create checkbox_group component with druid: `group = druid:new_checkbox_group(no


## Radio group
[Radio group API here](https://insality.github.io/druid/modules/druid.radio_group.html)
[Radio group API here](https://insality.github.io/druid/modules/RadioGroup.html)

### Overview
Several checkboxes in one group with single choice
Expand All @@ -230,7 +230,7 @@ Create radio_group component with druid: `group = druid:new_radio_group(nodes[],


## Timer
[Timer API here](https://insality.github.io/druid/modules/druid.timer.html)
[Timer API here](https://insality.github.io/druid/modules/Timer.html)

### Overview
Handle timer work on gui text node
Expand All @@ -245,7 +245,7 @@ Create timer component with druid: `timer = druid:new_timer(text_node, from_seco


## Static Grid
[Static Grid API here](https://insality.github.io/druid/modules/druid.static_grid.html)
[Static Grid API here](https://insality.github.io/druid/modules/StaticGrid.html)

### Overview
Component for manage node positions.
Expand All @@ -266,7 +266,7 @@ Create component with druid: `grid = druid:new_static_grid(parent_node, prefab_


## Dynamic Grid
[Dynamic Grid API here](https://insality.github.io/druid/modules/druid.dynamic_grid.html)
[Dynamic Grid API here](https://insality.github.io/druid/modules/DynamicGrid.html)

### Overview
Component for manage node positions with different node sizes.
Expand All @@ -276,7 +276,7 @@ Dynamic Grid can't have gaps between elements
Dynamic Grid should have __West__, __East__, __South__ or __North__ pivot (vertical or horizontal element placement)

### Setup
Create component with druid: `grid = druid:new_dynamic_grid(parent_node)`
Create component with druid: `grid = druid:new_dynamic_grid(parent_node)`

Check the _parent_node_ have correct pivot point. You will get the error otherwise.

Expand All @@ -290,8 +290,34 @@ Check the _parent_node_ have correct pivot point. You will get the error otherwi
- First node placed at Grid pivot point. Other nodes placed nearby of other nodes.
- On *add/remove* nodes always shifted. You can point the shift side in this functions (*is_shift_left* boolean argumentp


## Data List
[Data List API here](https://insality.github.io/druid/modules/DataList.html)

### Overview
Component to manage data for huge dataset in scroll. DataList create elements only in scroll view.
It requires Druid Scroll and Druid Grid (Static or Dynamic) components


### Setup
Create component with druid: `grid = druid:new_data_list(scroll, grid, create_callback)`
- scroll - already created Scroll component
- grid - already created StaticGrid or DynamicGrid component
- create_function - your function to create node instances. This callback have next parameters: fun(self, data, index, data_list)
- self - Script/Druid context
- data- your element data
- index - element index
- data_list - current DataList component

Create function should return root node and optionaly, Druid component. It’s required to manage create/remove lifecycle.

### Notes
- Set data with `data_list:set_data({...})` after component initialize
- You can use `data_list:scroll_to_index()` function to show data element


## Hover
[Hover API here](https://insality.github.io/druid/modules/druid.hover.html)
[Hover API here](https://insality.github.io/druid/modules/Hover.html)

### Overview
System Druid component, handle hover node state.
Expand All @@ -306,7 +332,7 @@ Create hover component with druid: `hover = druid:new_hover(node, callback)`


## Swipe
[Swipe API here](https://insality.github.io/druid/modules/druid.swipe.html)
[Swipe API here](https://insality.github.io/druid/modules/Swipe.html)

### Overview
System Druid component, handle swipe actions on node
Expand All @@ -327,7 +353,7 @@ Create swipe component with druid: `hover = druid:new_swipe(node, swipe_callback


## Drag
[Drag API here](https://insality.github.io/druid/modules/druid.drag.html)
[Drag API here](https://insality.github.io/druid/modules/Drag.html)

### Overview
System Druid component, handle drag actions on node
Expand Down
4 changes: 2 additions & 2 deletions docs_md/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ Also check _component.template.lua_ what you can use for your own custom compone

Hey! Are you tired from **Druid** updates? _(It's a joke)_

Finally, got a time to release component to process huge amount of data. So introducing: **DataList** component. I can't say what it's "infinity" scroll, but it can help to solve your problem with `GUI nodes limit reached` and helps with scroll optimization. Give feedback about it!
Finally, got a time to release component to process huge amount of data. So introducing: **DataList** component. It can help solve your problem with `GUI nodes limit reached` and helps with scroll optimization. Give feedback about it!

The next important stuff is **EmmyLua** docs. I'm implemented EmmyLua doc generator from LuaDoc and Protofiles, so now you can use EmmyLua annotations inside your IDE instead of website API looking or source code scanning.

Also the **Druid examples** is reworked, so each example will be in separate collection. Now it's become a much easier to learn Druid via examples. A lot of stuff in progress now, but you already can see on it!

Input priority got reworked too. Now instead of two input stacks: usual and high, Druid use simple input priority value.

And I should note here is several breaking changes, take a look in changelogs.
And I should note here are several breaking changes, take a look in changelogs.

Wanna something more? [Add an issues!](https://github.com/Insality/druid/issues)
Have a good day.
Expand Down
63 changes: 63 additions & 0 deletions example/example.collection
Original file line number Diff line number Diff line change
Expand Up @@ -869,3 +869,66 @@ embedded_instances {
z: 1.0
}
}
embedded_instances {
id: "grid_animations"
data: "components {\n"
" id: \"screen_factory\"\n"
" component: \"/monarch/screen_factory.script\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
" properties {\n"
" id: \"screen_id\"\n"
" value: \"grid_animations\"\n"
" type: PROPERTY_TYPE_HASH\n"
" }\n"
" properties {\n"
" id: \"popup\"\n"
" value: \"true\"\n"
" type: PROPERTY_TYPE_BOOLEAN\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"collectionfactory\"\n"
" type: \"collectionfactory\"\n"
" data: \"prototype: \\\"/example/examples/grid/grid_animations/grid_animations.collection\\\"\\n"
"load_dynamically: false\\n"
"\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
Loading

0 comments on commit 105f672

Please sign in to comment.