Skip to content

Commit 8155d64

Browse files
committed
Fix for drag end touch fro mobule, update contributing, update input examples to make better for mobile (move up)
1 parent 4e71fee commit 8155d64

File tree

7 files changed

+110
-46
lines changed

7 files changed

+110
-46
lines changed

CONTRIBUTING

Lines changed: 88 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,116 @@
1-
# Contribution Guidelines
1+
# Contributing to Druid
22

3-
Hello, Defolder! Thanks for your interest in contributing to the **Druid** project. It's a massive project that has been around for a long time, and it's still growing. This project has a lot of places where you can help!
3+
Thank you for your interest in contributing to **Druid**! We welcome contributions of all sizes - even small fixes make a big difference.
44

5-
Finally, there are set of instructions that will help you to contribute to the project.
5+
## Table of Contents
6+
- [How to Report Issues](#how-to-report-issues)
7+
- [Small Fixes](#small-fixes)
8+
- [Larger Contributions](#larger-contributions)
9+
- [Documentation Updates](#documentation-updates)
10+
- [Adding or Updating Examples](#adding-or-updating-examples)
11+
- [Unit Tests](#unit-tests)
612

7-
Thanks for your help!
13+
## How to Report Issues
814

9-
## Issue Reporting
15+
Found a bug? Please report it to our [issue tracker](https://github.com/druid-js/druid/issues) with:
16+
- A clear description of the problem
17+
- Steps to reproduce the issue
18+
- Expected vs. actual behavior
19+
- Your environment (Defold version, OS, etc.)
1020

11-
If you find any bugs, please report them to the [issue tracker](https://github.com/druid-js/druid/issues).
21+
## Small Fixes
1222

13-
## Pull Requests
23+
**We highly encourage small improvements!** For bug fixes, typo corrections, or minor improvements, you can create a pull request directly to the `master` or `develop` branch.
1424

15-
Any pull requests are welcome!
25+
When making these contributions, you **must**:
1626

17-
Please, open PR against the `develop` branch. Very nice to have an issue, which this PR fixes.
27+
1. Update the patch version number in both:
28+
- `README.md` file (in the dependency section)
29+
- `game.project` file (in the project section)
30+
2. Add your changes to `wiki/changelog.md`
31+
3. These steps are required to properly tag a new release
1832

19-
You fix should contains only changes, which are related to the issue. Also please keep the code style the same!
33+
**Example of version updates:**
2034

21-
❤️ Thanks ❤️
35+
For README.md:
36+
```
37+
# Before
38+
https://github.com/Insality/druid/archive/refs/tags/1.1.0.zip
2239

23-
## Update Documentation
40+
# After (patch version increased)
41+
https://github.com/Insality/druid/archive/refs/tags/1.1.1.zip
42+
```
2443

25-
If you see any mistakes in the documentation, you can update it by yourself with the following steps:
44+
For game.project:
45+
```
46+
# Before
47+
[project]
48+
title = Druid
49+
version = 1.1.0
2650

27-
- Fork Druid repository
28-
- Create a new branch for your changes
29-
- Make your changes and commit them
30-
- Push your changes to your fork
31-
- Create a pull request to the Druid repository `develop` branch
51+
# After (patch version increased)
52+
[project]
53+
title = Druid
54+
version = 1.1.1
55+
```
3256

57+
## Larger Contributions
3358

34-
## Add or Update Examples
59+
For new features, major improvements, or complex fixes:
3560

36-
Examples contains a GUI scene, a Druid widget for this GUI. This GUI is included to the `examples.gui` and the information about examples are added in `examples_list.lua` file
61+
1. Fork the repository
62+
2. Create a branch from `develop`
63+
3. Make your changes
64+
4. Ensure code follows project style guidelines
65+
5. Test your changes thoroughly
66+
6. Submit a pull request to the `develop` branch
67+
7. Include references to any related issues (e.g., "Fixes #123")
3768

38-
You can add new examples or update existing ones.
69+
Please keep changes focused on addressing specific issues or features, and maintain the existing code style.
3970

40-
To add new example, you need to create a new folder in the `examples` directory.
71+
## Documentation Updates
4172

42-
On your repo fork:
73+
To improve documentation:
4374

44-
- Create a gui file with the example inside `/example/examples` directory
45-
- Add the example info to the `examples_list.lua` file.
46-
- Add this GUI template to the `/example/druid.gui` file
47-
- GUI should be placed inside relative example parent, e.g. `root -> container_center -> examples -> widgets`
48-
- Test the example by running the game
49-
- Create a pull request to the `develop` branch
75+
1. Fork the repository
76+
2. Create a branch for your changes
77+
3. Update the relevant documentation files
78+
4. Submit a pull request to the `master` or `develop` branch
5079

80+
Clear, accurate documentation helps everyone, so documentation improvements are always appreciated!
5181

52-
## Add or Update Unit Tests
82+
## Adding or Updating Examples
5383

54-
The unit tests was updated to cover more Druid's source code. So now I have more examples how to run and check some parts of the code.
84+
Examples are vital for helping users understand how to use Druid. Each example should include:
5585

56-
In case you face issue and want to reproduce it, you also can starts from the unit tests:
86+
1. A GUI scene with a Druid widget
87+
2. Information about the example in `examples_list.lua`
5788

58-
All tests placed in the `/test/tests` directory.
89+
To add a new example:
5990

60-
To run tests you need to set the bootstrap collection to `/test/test.collection` and run it.
91+
1. Create a new GUI file in the `/example/examples` directory
92+
2. Add the example information to `examples_list.lua`
93+
3. Include your GUI template in `/example/druid.gui`
94+
- Place it inside the proper hierarchy: `root -> container_center -> examples -> widgets`
95+
4. Test your example by running the game
96+
5. Submit a pull request to the `develop` branch
6197

62-
So the flow will be the similar:
98+
## Unit Tests
6399

64-
- Create a new branch for your changes
65-
- Make your changes and commit them
66-
- Push your changes to your fork
67-
- Create a pull request to the Druid repository `develop` branch
100+
Unit tests help ensure Druid works correctly. If you're facing an issue, unit tests can be a good starting point to understand or reproduce it.
101+
102+
All tests are located in the `/test/tests` directory.
103+
104+
To run tests:
105+
1. Set the bootstrap collection to `/test/test.collection`
106+
2. Run the project
107+
108+
To submit new or updated tests:
109+
1. Create a branch for your changes
110+
2. Add or modify tests
111+
3. Verify your tests pass
112+
4. Submit a pull request to the `develop` branch
113+
114+
---
115+
116+
Thank you for contributing to making Druid better for everyone! ❤️

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ Special thanks to all the contributors who have helped make **Druid** better!
223223
<img src="https://contributors-img.web.app/image?repo=insality/druid"/>
224224
</a>
225225

226-
Read the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information.
226+
Read the [CONTRIBUTING](CONTRIBUTING) file for more information.
227227

228228

229229
## ❤️ Support project ❤️

druid/base/drag.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function M:on_input(action_id, action)
162162
if touch.released and self.is_touch then
163163
if action.touch then
164164
-- Mobile
165-
self:_on_touch_release(action_id, action)
165+
self:_on_touch_release(action_id, action, touch)
166166
else
167167
-- PC
168168
self:_end_touch(touch)
@@ -321,7 +321,8 @@ end
321321
---touches exists to switch to another touch.
322322
---@param action_id hash Action id from on_input
323323
---@param action table Action from on_input
324-
function M:_on_touch_release(action_id, action)
324+
---@param touch table Touch action
325+
function M:_on_touch_release(action_id, action, touch)
325326
if #action.touch >= 2 then
326327
-- Find next unpressed touch
327328
local next_touch
@@ -337,10 +338,10 @@ function M:_on_touch_release(action_id, action)
337338
self.y = next_touch.y
338339
self.touch_id = next_touch.id
339340
else
340-
self:_end_touch()
341+
self:_end_touch(touch)
341342
end
342343
elseif #action.touch == 1 then
343-
self:_end_touch()
344+
self:_end_touch(touch)
344345
end
345346
end
346347

example/examples/basic/input/basic_input.gui

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ nodes {
99
visible: false
1010
}
1111
nodes {
12+
position {
13+
y: 301.0
14+
}
1215
type: TYPE_TEMPLATE
1316
id: "input"
1417
parent: "root"
@@ -29,7 +32,7 @@ nodes {
2932
}
3033
nodes {
3134
position {
32-
y: -150.0
35+
y: 151.0
3336
}
3437
type: TYPE_TEMPLATE
3538
id: "input_2"

example/examples/basic/input/input_password.gui

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ nodes {
99
visible: false
1010
}
1111
nodes {
12+
position {
13+
y: 249.0
14+
}
1215
type: TYPE_TEMPLATE
1316
id: "input"
1417
parent: "root"

example/examples/basic/input/rich_input.gui

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ nodes {
1313
visible: false
1414
}
1515
nodes {
16+
position {
17+
y: 309.0
18+
}
1619
type: TYPE_TEMPLATE
1720
id: "rich_input"
1821
parent: "root"
@@ -57,7 +60,7 @@ nodes {
5760
}
5861
nodes {
5962
position {
60-
y: -150.0
63+
y: 159.0
6164
}
6265
type: TYPE_TEMPLATE
6366
id: "rich_input_2"

wiki/changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,3 +681,8 @@ And all my other supporters! Very appreciated!
681681
Please support me if you like this project! It will help me keep engaged to update **Druid** and make it even better!
682682

683683
[![Github-sponsors](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/insality) [![Ko-Fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/insality) [![BuyMeACoffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/insality)
684+
685+
686+
### Druid 1.1.X
687+
688+
- {Place for the community changelogs}

0 commit comments

Comments
 (0)