From 5a0cf42e3dc4b11abbccc3b23497b72a2b3d5d3b Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 16 Jul 2023 12:28:46 +0300 Subject: [PATCH] Update README, move emmylua section to Advanced Setup manual --- README.md | 22 ++-------------------- docs_md/advanced-setup.md | 30 +++++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index caa5a5b..63ffcdb 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ To integrate the **Druid** extension into your own project, add this project as Here is a list of [all releases](https://github.com/Insality/druid/releases). -Size: **68.73 KB** +Size: **67.16 KB** > The size metrics exlcude the extended components, which are including only on demand. @@ -87,25 +87,7 @@ For all **Druid** instance functions, [see here](https://insality.github.io/drui Start reading the API documentation [here](https://insality.github.io/druid/modules/Druid.html). - -### EmmyLua Annotations [optional] - -[EmmyLua](https://emmylua.github.io/annotation.html) is a Lua annotation library. It is a useful tool for enabling Lua code autocompletion in editors such as [VSCode](https://github.com/EmmyLua/VSCode-EmmyLua) and [IntelliJ IDEA](https://github.com/EmmyLua/IntelliJ-EmmyLua). - -Since dependencies cannot be processed by external editors, to use the EmmyLua annotations, you should copy the _druid/annotations.lua_ file to your project. - -Remember that you can restart the EmmyLua server to refresh the changes if something goes wrong. - -After the annotations are processed, you should specify the type of "Druid" in the "require" statement: - -```lua ----@type druid -local druid = require("druid.druid") - --- Now the autocomplete is working -``` - - +**Druid** provide the *EmmyLua* annotations to add autocomplete inside your IDE. Check [EmmyLua Setup here](docs_md/advanced-setup.md#emmylua-annotations). ### Create custom components diff --git a/docs_md/advanced-setup.md b/docs_md/advanced-setup.md index 24a1f68..ac13ec9 100644 --- a/docs_md/advanced-setup.md +++ b/docs_md/advanced-setup.md @@ -20,7 +20,7 @@ By default, **Druid** utilizes the `/builtins/input/all.input_binding` for input ![](../media/input_binding_1.png) -## Changing Key Bindings (optional) +## Changing Key Bindings If you need to use your own key bindings or key names, you can modify them in your *game.project* file. @@ -40,7 +40,7 @@ input_scroll_down = mouse_wheel_down ``` -## Input Capturing (optional) +## Input Capturing By default, **Druid** automatically captures input focus if any input component is created. Therefore, you do not need to call `msg.post(".", "acquire_input_focus")`. @@ -51,7 +51,7 @@ no_auto_input = 1 ``` -## Template Name Check (optional) +## Template Name Check By default, **Druid** automatically checks the parent component's template name to construct the full template name for the component. It's used in user custom components. @@ -63,7 +63,7 @@ no_auto_template = 1 ``` -## Stencil Check (optional) +## Stencil Check When creating input components inside stencil nodes, **Druid** automatically sets up `component:set_click_zone()` during the _late_init_ component step to restrict input clicks outside of the stencil zone. This is particularly useful for buttons inside scroll stencil nodes. @@ -74,7 +74,7 @@ no_stencil_check = 1 ``` -## Code Bindings (optional) +## Code Bindings Adjust **Druid** settings as needed: ```lua @@ -109,3 +109,23 @@ local function on_window_callback(self, event, data) end window.set_listener(on_window_callback) ``` + + +## EmmyLua Annotations + +[EmmyLua](https://emmylua.github.io/annotation.html) is a Lua annotation library. It is a useful tool for enabling Lua code autocompletion in editors such as [VSCode](https://github.com/EmmyLua/VSCode-EmmyLua) and [IntelliJ IDEA](https://github.com/EmmyLua/IntelliJ-EmmyLua). + +Since dependencies cannot be processed by external editors, to use the EmmyLua annotations, you should copy the _druid/annotations.lua_ file to your project. + +Remember that you can restart the EmmyLua server to refresh the changes if something goes wrong. + +After the annotations are processed, you should specify the type of "Druid" in the "require" statement: + +```lua +---@type druid +local druid = require("druid.druid") + +-- Now the autocomplete is working +``` + +