├── .gitignore
├── LICENSE
├── README.md
├── build.gradle
├── docs
└── apidocs
│ ├── allclasses-index.html
│ ├── allpackages-index.html
│ ├── com
│ └── dongbat
│ │ └── jbump
│ │ ├── Cell.html
│ │ ├── Collision.html
│ │ ├── CollisionFilter.html
│ │ ├── Collisions.html
│ │ ├── Extra.html
│ │ ├── Grid.TraverseCallback.html
│ │ ├── Grid.html
│ │ ├── IntPoint.html
│ │ ├── Item.html
│ │ ├── ItemInfo.html
│ │ ├── Point.html
│ │ ├── Rect.html
│ │ ├── RectHelper.html
│ │ ├── Response.Result.html
│ │ ├── Response.html
│ │ ├── World.html
│ │ ├── package-summary.html
│ │ ├── package-tree.html
│ │ └── util
│ │ ├── BooleanArray.html
│ │ ├── FloatArray.html
│ │ ├── IntArray.html
│ │ ├── IntIntMap.Entries.html
│ │ ├── IntIntMap.Entry.html
│ │ ├── IntIntMap.Keys.html
│ │ ├── IntIntMap.Values.html
│ │ ├── IntIntMap.html
│ │ ├── MathUtils.html
│ │ ├── ObjectSet.ObjectSetIterator.html
│ │ ├── ObjectSet.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ ├── constant-values.html
│ ├── element-list
│ ├── help-doc.html
│ ├── index-all.html
│ ├── index.html
│ ├── jquery-ui.overrides.css
│ ├── legal
│ ├── ADDITIONAL_LICENSE_INFO
│ ├── ASSEMBLY_EXCEPTION
│ ├── LICENSE
│ ├── jquery.md
│ └── jqueryUI.md
│ ├── member-search-index.js
│ ├── module-search-index.js
│ ├── overview-summary.html
│ ├── overview-tree.html
│ ├── package-search-index.js
│ ├── resources
│ ├── glass.png
│ └── x.png
│ ├── script-dir
│ ├── images
│ │ ├── ui-bg_glass_55_fbf9ee_1x400.png
│ │ ├── ui-bg_glass_65_dadada_1x400.png
│ │ ├── ui-bg_glass_75_dadada_1x400.png
│ │ ├── ui-bg_glass_75_e6e6e6_1x400.png
│ │ ├── ui-bg_glass_95_fef1ec_1x400.png
│ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png
│ │ ├── ui-icons_222222_256x240.png
│ │ ├── ui-icons_2e83ff_256x240.png
│ │ ├── ui-icons_454545_256x240.png
│ │ ├── ui-icons_888888_256x240.png
│ │ └── ui-icons_cd0a0a_256x240.png
│ ├── jquery-3.5.1.min.js
│ ├── jquery-ui.min.css
│ ├── jquery-ui.min.js
│ └── jquery-ui.structure.min.css
│ ├── script.js
│ ├── search.js
│ ├── stylesheet.css
│ ├── tag-search-index.js
│ └── type-search-index.js
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── images
├── shoot.gif
├── sprite.gif
└── tile.gif
├── jbump
├── build.gradle
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── dongbat
│ │ └── jbump
│ │ ├── Cell.java
│ │ ├── Collision.java
│ │ ├── CollisionFilter.java
│ │ ├── Collisions.java
│ │ ├── Extra.java
│ │ ├── Grid.java
│ │ ├── IntPoint.java
│ │ ├── Item.java
│ │ ├── ItemInfo.java
│ │ ├── Point.java
│ │ ├── Rect.java
│ │ ├── RectHelper.java
│ │ ├── Response.java
│ │ ├── World.java
│ │ └── util
│ │ ├── BooleanArray.java
│ │ ├── FloatArray.java
│ │ ├── IntArray.java
│ │ ├── IntIntMap.java
│ │ ├── MathUtils.java
│ │ └── ObjectSet.java
│ └── resources
│ └── com
│ └── dongbat
│ └── jbump.gwt.xml
├── jitpack.yml
├── settings.gradle
└── test
├── build.gradle
└── src
└── main
└── java
└── com
└── dongbat
└── jbump
└── test
└── TestBump.java
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Gradle
2 | .gradle
3 | gradle-app.setting
4 | build/
5 |
6 | ## Java:
7 | *.class
8 | *.war
9 | *.ear
10 | hs_err_pid*
11 |
12 | ## Android:
13 | android/libs/armeabi/
14 | android/libs/armeabi-v7a/
15 | android/libs/x86/
16 | android/gen/
17 | local.properties
18 | com_crashlytics_export_strings.xml
19 |
20 | ## GWT:
21 | war/
22 | html/war/gwt_bree/
23 | html/gwt-unitCache/
24 | .apt_generated/
25 | html/war/WEB-INF/deploy/
26 | html/war/WEB-INF/classes/
27 | .gwt/
28 | gwt-unitCache/
29 | www-test/
30 | .gwt-tmp/
31 |
32 | ## IntelliJ, Android Studio:
33 | .idea/
34 | *.ipr
35 | *.iws
36 | *.iml
37 | out/
38 |
39 | ## Eclipse
40 | .classpath
41 | .project
42 | .metadata
43 | **/bin/
44 | tmp/
45 | *.tmp
46 | *.bak
47 | *.swp
48 | *~.nib
49 | .settings/
50 | .loadpath
51 | .externalToolBuilders/
52 | *.launch
53 |
54 | ## NetBeans
55 | **/nbproject/private/
56 | build/
57 | nbbuild/
58 | dist/
59 | nbdist/
60 | nbactions.xml
61 | nb-configuration.xml
62 |
63 | ## OS Specific
64 | .DS_Store
65 | *.symbolMap
66 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | mavenLocal()
4 | mavenCentral()
5 | maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
6 | gradlePluginPortal()
7 | }
8 | dependencies {
9 | classpath 'com.vanniktech:gradle-maven-publish-plugin:0.22.0'
10 | }
11 | }
12 |
13 | allprojects {
14 | group = 'com.github.implicit-invocation'
15 | version = "$VERSION_NAME"
16 |
17 | repositories {
18 | mavenLocal()
19 | mavenCentral()
20 | maven { url "https://oss.sonatype.org/content/repositories/releases/" }
21 | maven { url 'https://jitpack.io' }
22 | gradlePluginPortal()
23 | }
24 | }
25 |
26 | // Disable JDK 8's doclint
27 | // http://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html
28 | if (JavaVersion.current().isJava8Compatible()) {
29 | allprojects {
30 | tasks.withType(Javadoc) {
31 | // The -quiet is because of some sort of weird JDK JavaCompiler bug:
32 | // https://discuss.gradle.org/t/passing-arguments-to-compiler-and-javadoc/1661
33 | options.addStringOption('Xdoclint:none,-missing', '-quiet')
34 | options.tags('apiNote:a:"API Note"', 'implSpec:a:"Implementation Requirements"', 'implNote:a:"Implementation Note"')
35 | }
36 | }
37 | }
38 |
39 | if(JavaVersion.current().isJava9Compatible()) {
40 | project(':jbump') {
41 | tasks.withType(JavaCompile) {
42 | options.release.set(7)
43 | }
44 | }
45 | project(':test') {
46 | tasks.withType(JavaCompile) {
47 | options.release.set(8)
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/docs/apidocs/allclasses-index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | All Classes and Interfaces (jbump 1.0.2 API)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
24 |
25 | JavaScript is disabled on your browser.
26 |
27 |
28 |
51 |
52 |
53 |
56 |
57 |
All Classes and Interfaces Interfaces Classes
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
Small helper methods for math tasks, as well as the configurable
Extra.DELTA
.
75 |
76 |
77 |
78 |
79 |
80 |
grid_traverse* methods are based on "A Fast Voxel Traversal Algorithm for Ray Tracing",
81 | by John Amanides and Andrew Woo - http://www.cse.yorku.ca/~amana/research/grid.pdf
82 | It has been modified to include both cells when the ray "touches a grid corner",
83 | and with a different exit condition
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
A map of primitive int keys to primitive int values.
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
A 2D point with integer x and y.
104 |
105 |
106 |
107 |
Wraps an
E
value in
Item.userData
, so it is compared by the identity
108 | of the Item, not the E value.
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
An unordered set where the keys are objects.
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
--------------------------------------------------------------------------------
/docs/apidocs/allpackages-index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | All Packages (jbump 1.0.2 API)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
20 |
21 | JavaScript is disabled on your browser.
22 |
23 |
24 |
47 |
48 |
49 |
52 | Package Summary
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/docs/apidocs/com/dongbat/jbump/CollisionFilter.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CollisionFilter (jbump 1.0.2 API)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
24 |
25 | JavaScript is disabled on your browser.
26 |
27 |
28 |
66 |
67 |
68 |
69 |
73 |
74 |
75 | public interface CollisionFilter
76 |
77 |
78 |
79 |
80 |
81 |
82 | Field Summary
83 | Fields
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 | Method Summary
98 |
99 |
All Methods Instance Methods Abstract Methods
100 |
101 |
102 |
103 |
104 |
105 |
106 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 | Field Details
122 |
123 |
124 |
125 | defaultFilter
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 | Method Details
136 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
--------------------------------------------------------------------------------
/docs/apidocs/com/dongbat/jbump/Grid.TraverseCallback.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Grid.TraverseCallback (jbump 1.0.2 API)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
24 |
25 | JavaScript is disabled on your browser.
26 |
27 |
28 |
66 |
67 |
68 |
69 |
73 |
74 |
75 | Enclosing class:
76 | Grid
77 |
78 |
79 | public static interface Grid.TraverseCallback
80 |
81 |
82 |
83 |
84 |
85 |
86 | Method Summary
87 |
88 |
All Methods Instance Methods Abstract Methods
89 |
90 |
91 |
92 |
93 |
94 |
boolean
95 |
onTraverse (float cx,
96 | float cy,
97 | int stepX,
98 | int stepY)
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 | Method Details
113 |
114 |
115 |
116 | onTraverse
117 | boolean onTraverse (float cx,
118 | float cy,
119 | int stepX,
120 | int stepY)
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
--------------------------------------------------------------------------------
/docs/apidocs/com/dongbat/jbump/RectHelper.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | RectHelper (jbump 1.0.2 API)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
24 |
25 | JavaScript is disabled on your browser.
26 |
27 |
28 |
66 |
67 |
68 |
69 |
73 |
76 |
77 |
78 | public class RectHelper
79 |
extends Object
80 |
81 |
82 |
83 |
84 |
85 |
86 | Constructor Summary
87 | Constructors
88 |
94 |
95 |
96 |
97 |
98 |
99 | Method Summary
100 |
101 |
All Methods Instance Methods Concrete Methods
102 |
103 |
104 |
105 |
106 |
107 |
108 |
rect_detectCollision (float x1,
109 | float y1,
110 | float w1,
111 | float h1,
112 | float x2,
113 | float y2,
114 | float w2,
115 | float h2,
116 | float goalX,
117 | float goalY)
118 |
119 |
120 |
121 |
122 |
123 |
Methods inherited from class java.lang.Object
124 |
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 | Constructor Details
135 |
136 |
137 |
138 | RectHelper
139 | public RectHelper ()
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 | Method Details
149 |
150 |
151 |
152 | rect_detectCollision
153 | public Collision rect_detectCollision (float x1,
154 | float y1,
155 | float w1,
156 | float h1,
157 | float x2,
158 | float y2,
159 | float w2,
160 | float h2,
161 | float goalX,
162 | float goalY)
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
--------------------------------------------------------------------------------
/docs/apidocs/com/dongbat/jbump/Response.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Response (jbump 1.0.2 API)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
24 |
25 | JavaScript is disabled on your browser.
26 |
27 |
28 |
66 |
67 |
68 |
69 |
73 |
74 |
75 | public interface Response
76 |
77 |
78 |
79 |
80 |
81 |
82 | Nested Class Summary
83 | Nested Classes
84 |
85 |
86 |
87 |
88 |
static class
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 | Field Summary
98 | Fields
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 | Method Summary
122 |
123 |
All Methods Instance Methods Abstract Methods
124 |
125 |
126 |
127 |
128 |
129 |
130 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 | Field Details
154 |
155 |
156 |
160 |
161 |
162 |
166 |
167 |
168 |
172 |
173 |
174 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 | Method Details
186 |
187 |
188 |
189 | response
190 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
--------------------------------------------------------------------------------
/docs/apidocs/com/dongbat/jbump/package-summary.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.dongbat.jbump (jbump 1.0.2 API)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
24 |
25 | JavaScript is disabled on your browser.
26 |
27 |
28 |
59 |
60 |
61 |
64 |
65 | package com.dongbat.jbump
66 |
67 |
68 |
69 |
78 |
79 |
80 |
81 |
All Classes and Interfaces Interfaces Classes
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
Small helper methods for math tasks, as well as the configurable
Extra.DELTA
.
97 |
98 |
99 |
100 |
grid_traverse* methods are based on "A Fast Voxel Traversal Algorithm for Ray Tracing",
101 | by John Amanides and Andrew Woo - http://www.cse.yorku.ca/~amana/research/grid.pdf
102 | It has been modified to include both cells when the ray "touches a grid corner",
103 | and with a different exit condition
104 |
105 |
106 |
107 |
108 |
109 |
A 2D point with integer x and y.
110 |
111 |
112 |
113 |
Wraps an
E
value in
Item.userData
, so it is compared by the identity
114 | of the Item, not the E value.
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
--------------------------------------------------------------------------------
/docs/apidocs/com/dongbat/jbump/package-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.dongbat.jbump Class Hierarchy (jbump 1.0.2 API)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
20 |
21 | JavaScript is disabled on your browser.
22 |
23 |
24 |
47 |
48 |
49 |
56 |
57 | Class Hierarchy
58 |
59 | java.lang.Object
60 |
75 |
76 |
77 |
78 |
79 | Interface Hierarchy
80 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/docs/apidocs/com/dongbat/jbump/util/package-summary.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.dongbat.jbump.util (jbump 1.0.2 API)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
20 |
21 | JavaScript is disabled on your browser.
22 |
23 |
24 |
55 |
56 |
57 |
60 |
61 | package com.dongbat.jbump.util
62 |
63 |
64 |
65 |
74 |
75 |
76 |
77 |
Classes
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
A map of primitive int keys to primitive int values.
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
An unordered set where the keys are objects.
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/docs/apidocs/com/dongbat/jbump/util/package-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.dongbat.jbump.util Class Hierarchy (jbump 1.0.2 API)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
20 |
21 | JavaScript is disabled on your browser.
22 |
23 |
24 |
47 |
48 |
49 |
56 |
57 | Class Hierarchy
58 |
59 | java.lang.Object
60 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/docs/apidocs/constant-values.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Constant Field Values (jbump 1.0.2 API)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
20 |
21 | JavaScript is disabled on your browser.
22 |
23 |
24 |
47 |
48 |
49 |
58 |
59 | com.dongbat.*
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
public static final float
68 |
69 |
0.01745329238474369f
70 |
public static final float
71 |
72 |
0.01745329238474369f
73 |
public static final float
74 |
75 |
2.7182817459106445f
76 |
public static final float
77 |
78 |
9.999999974752427E-7f
79 |
public static final float
80 |
81 |
9.999999717180685E-10f
82 |
public static final float
83 |
84 |
3.1415927410125732f
85 |
public static final float
86 |
87 |
6.2831854820251465f
88 |
public static final float
89 |
90 |
57.2957763671875f
91 |
public static final float
92 |
93 |
57.2957763671875f
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/docs/apidocs/element-list:
--------------------------------------------------------------------------------
1 | com.dongbat.jbump
2 | com.dongbat.jbump.util
3 |
--------------------------------------------------------------------------------
/docs/apidocs/help-doc.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | API Help (jbump 1.0.2 API)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
20 |
21 | JavaScript is disabled on your browser.
22 |
23 |
24 |
54 |
55 |
56 | JavaDoc Help
57 |
77 |
78 |
79 |
Navigation
80 | Starting from the
Overview page, you can browse the documentation using the links in each page, and in the navigation bar at the top of each page. The
Index and Search box allow you to navigate to specific declarations and summary pages, including:
All Packages ,
All Classes and Interfaces
81 |
82 | Search
83 | You can search for definitions of modules, packages, types, fields, methods, system properties and other terms defined in the API, using some or all of the name, optionally using "camelCase" abbreviations. For example:
84 |
85 | j.l.obj
will match "java.lang.Object"
86 | InpStr
will match "java.io.InputStream"
87 | HM.cK
will match "java.util.HashMap.containsKey(Object)"
88 |
89 | Refer to the Javadoc Search Specification for a full description of search features.
90 |
91 |
92 |
93 |
94 |
Kinds of Pages
95 | The following sections describe the different kinds of pages in this collection.
96 |
97 | Overview
98 | The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
99 |
100 |
101 | Package
102 | Each package has a page that contains a list of its classes and interfaces, with a summary for each. These pages may contain the following categories:
103 |
104 | Interfaces
105 | Classes
106 | Enum Classes
107 | Exceptions
108 | Errors
109 | Annotation Interfaces
110 |
111 |
112 |
113 | Class or Interface
114 | Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a declaration and description, member summary tables, and detailed member descriptions. Entries in each of these sections are omitted if they are empty or not applicable.
115 |
116 | Class Inheritance Diagram
117 | Direct Subclasses
118 | All Known Subinterfaces
119 | All Known Implementing Classes
120 | Class or Interface Declaration
121 | Class or Interface Description
122 |
123 |
124 |
125 | Nested Class Summary
126 | Enum Constant Summary
127 | Field Summary
128 | Property Summary
129 | Constructor Summary
130 | Method Summary
131 | Required Element Summary
132 | Optional Element Summary
133 |
134 |
135 |
136 | Enum Constant Details
137 | Field Details
138 | Property Details
139 | Constructor Details
140 | Method Details
141 | Element Details
142 |
143 | Note: Annotation interfaces have required and optional elements, but not methods. Only enum classes have enum constants. The components of a record class are displayed as part of the declaration of the record class. Properties are a feature of JavaFX.
144 | The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
145 |
146 |
147 | Other Files
148 | Packages and modules may contain pages with additional information related to the declarations nearby.
149 |
150 |
151 | Tree (Class Hierarchy)
152 | There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. Classes are organized by inheritance structure starting with java.lang.Object
. Interfaces do not inherit from java.lang.Object
.
153 |
154 | When viewing the Overview page, clicking on TREE displays the hierarchy for all packages.
155 | When viewing a particular package, class or interface page, clicking on TREE displays the hierarchy for only that package.
156 |
157 |
158 |
159 | Constant Field Values
160 | The Constant Field Values page lists the static final fields and their values.
161 |
162 |
163 | All Packages
164 | The All Packages page contains an alphabetic index of all packages contained in the documentation.
165 |
166 |
167 | All Classes and Interfaces
168 | The All Classes and Interfaces page contains an alphabetic index of all classes and interfaces contained in the documentation, including annotation interfaces, enum classes, and record classes.
169 |
170 |
171 | Index
172 | The Index contains an alphabetic index of all classes, interfaces, constructors, methods, and fields in the documentation, as well as summary pages such as All Packages , All Classes and Interfaces .
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
--------------------------------------------------------------------------------
/docs/apidocs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Overview (jbump 1.0.2 API)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
20 |
21 | JavaScript is disabled on your browser.
22 |
23 |
24 |
47 |
48 |
49 |
52 |
53 |
Packages
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/docs/apidocs/jquery-ui.overrides.css:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | .ui-state-active,
27 | .ui-widget-content .ui-state-active,
28 | .ui-widget-header .ui-state-active,
29 | a.ui-button:active,
30 | .ui-button:active,
31 | .ui-button.ui-state-active:hover {
32 | /* Overrides the color of selection used in jQuery UI */
33 | background: #F8981D;
34 | }
35 |
--------------------------------------------------------------------------------
/docs/apidocs/legal/ADDITIONAL_LICENSE_INFO:
--------------------------------------------------------------------------------
1 | Please see ..\java.base\ADDITIONAL_LICENSE_INFO
2 |
--------------------------------------------------------------------------------
/docs/apidocs/legal/ASSEMBLY_EXCEPTION:
--------------------------------------------------------------------------------
1 | Please see ..\java.base\ASSEMBLY_EXCEPTION
2 |
--------------------------------------------------------------------------------
/docs/apidocs/legal/LICENSE:
--------------------------------------------------------------------------------
1 | Please see ..\java.base\LICENSE
2 |
--------------------------------------------------------------------------------
/docs/apidocs/legal/jquery.md:
--------------------------------------------------------------------------------
1 | ## jQuery v3.5.1
2 |
3 | ### jQuery License
4 | ```
5 | jQuery v 3.5.1
6 | Copyright JS Foundation and other contributors, https://js.foundation/
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining
9 | a copy of this software and associated documentation files (the
10 | "Software"), to deal in the Software without restriction, including
11 | without limitation the rights to use, copy, modify, merge, publish,
12 | distribute, sublicense, and/or sell copies of the Software, and to
13 | permit persons to whom the Software is furnished to do so, subject to
14 | the following conditions:
15 |
16 | The above copyright notice and this permission notice shall be
17 | included in all copies or substantial portions of the Software.
18 |
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 |
27 | ******************************************
28 |
29 | The jQuery JavaScript Library v3.5.1 also includes Sizzle.js
30 |
31 | Sizzle.js includes the following license:
32 |
33 | Copyright JS Foundation and other contributors, https://js.foundation/
34 |
35 | This software consists of voluntary contributions made by many
36 | individuals. For exact contribution history, see the revision history
37 | available at https://github.com/jquery/sizzle
38 |
39 | The following license applies to all parts of this software except as
40 | documented below:
41 |
42 | ====
43 |
44 | Permission is hereby granted, free of charge, to any person obtaining
45 | a copy of this software and associated documentation files (the
46 | "Software"), to deal in the Software without restriction, including
47 | without limitation the rights to use, copy, modify, merge, publish,
48 | distribute, sublicense, and/or sell copies of the Software, and to
49 | permit persons to whom the Software is furnished to do so, subject to
50 | the following conditions:
51 |
52 | The above copyright notice and this permission notice shall be
53 | included in all copies or substantial portions of the Software.
54 |
55 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
56 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
57 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
58 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
59 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
60 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
61 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
62 |
63 | ====
64 |
65 | All files located in the node_modules and external directories are
66 | externally maintained libraries used by this software which have their
67 | own licenses; we recommend you read them, as their terms may differ from
68 | the terms above.
69 |
70 | *********************
71 |
72 | ```
73 |
--------------------------------------------------------------------------------
/docs/apidocs/legal/jqueryUI.md:
--------------------------------------------------------------------------------
1 | ## jQuery UI v1.12.1
2 |
3 | ### jQuery UI License
4 | ```
5 | Copyright jQuery Foundation and other contributors, https://jquery.org/
6 |
7 | This software consists of voluntary contributions made by many
8 | individuals. For exact contribution history, see the revision history
9 | available at https://github.com/jquery/jquery-ui
10 |
11 | The following license applies to all parts of this software except as
12 | documented below:
13 |
14 | ====
15 |
16 | Permission is hereby granted, free of charge, to any person obtaining
17 | a copy of this software and associated documentation files (the
18 | "Software"), to deal in the Software without restriction, including
19 | without limitation the rights to use, copy, modify, merge, publish,
20 | distribute, sublicense, and/or sell copies of the Software, and to
21 | permit persons to whom the Software is furnished to do so, subject to
22 | the following conditions:
23 |
24 | The above copyright notice and this permission notice shall be
25 | included in all copies or substantial portions of the Software.
26 |
27 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
31 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
32 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
33 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 |
35 | ====
36 |
37 | Copyright and related rights for sample code are waived via CC0. Sample
38 | code is defined as all source code contained within the demos directory.
39 |
40 | CC0: http://creativecommons.org/publicdomain/zero/1.0/
41 |
42 | ====
43 |
44 | All files located in the node_modules and external directories are
45 | externally maintained libraries used by this software which have their
46 | own licenses; we recommend you read them, as their terms may differ from
47 | the terms above.
48 |
49 | ```
50 |
--------------------------------------------------------------------------------
/docs/apidocs/module-search-index.js:
--------------------------------------------------------------------------------
1 | moduleSearchIndex = [];updateSearchResults();
--------------------------------------------------------------------------------
/docs/apidocs/overview-summary.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | jbump 1.0.2 API
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | JavaScript is disabled on your browser.
21 |
22 | index.html
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/docs/apidocs/overview-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Class Hierarchy (jbump 1.0.2 API)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
20 |
21 | JavaScript is disabled on your browser.
22 |
23 |
24 |
47 |
48 |
49 |
57 |
58 | Class Hierarchy
59 |
60 | java.lang.Object
61 |
87 |
88 |
89 |
90 |
91 | Interface Hierarchy
92 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/docs/apidocs/package-search-index.js:
--------------------------------------------------------------------------------
1 | packageSearchIndex = [{"l":"All Packages","u":"allpackages-index.html"},{"l":"com.dongbat.jbump"},{"l":"com.dongbat.jbump.util"}];updateSearchResults();
--------------------------------------------------------------------------------
/docs/apidocs/resources/glass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/docs/apidocs/resources/glass.png
--------------------------------------------------------------------------------
/docs/apidocs/resources/x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/docs/apidocs/resources/x.png
--------------------------------------------------------------------------------
/docs/apidocs/script-dir/images/ui-bg_glass_55_fbf9ee_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/docs/apidocs/script-dir/images/ui-bg_glass_55_fbf9ee_1x400.png
--------------------------------------------------------------------------------
/docs/apidocs/script-dir/images/ui-bg_glass_65_dadada_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/docs/apidocs/script-dir/images/ui-bg_glass_65_dadada_1x400.png
--------------------------------------------------------------------------------
/docs/apidocs/script-dir/images/ui-bg_glass_75_dadada_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/docs/apidocs/script-dir/images/ui-bg_glass_75_dadada_1x400.png
--------------------------------------------------------------------------------
/docs/apidocs/script-dir/images/ui-bg_glass_75_e6e6e6_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/docs/apidocs/script-dir/images/ui-bg_glass_75_e6e6e6_1x400.png
--------------------------------------------------------------------------------
/docs/apidocs/script-dir/images/ui-bg_glass_95_fef1ec_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/docs/apidocs/script-dir/images/ui-bg_glass_95_fef1ec_1x400.png
--------------------------------------------------------------------------------
/docs/apidocs/script-dir/images/ui-bg_highlight-soft_75_cccccc_1x100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/docs/apidocs/script-dir/images/ui-bg_highlight-soft_75_cccccc_1x100.png
--------------------------------------------------------------------------------
/docs/apidocs/script-dir/images/ui-icons_222222_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/docs/apidocs/script-dir/images/ui-icons_222222_256x240.png
--------------------------------------------------------------------------------
/docs/apidocs/script-dir/images/ui-icons_2e83ff_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/docs/apidocs/script-dir/images/ui-icons_2e83ff_256x240.png
--------------------------------------------------------------------------------
/docs/apidocs/script-dir/images/ui-icons_454545_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/docs/apidocs/script-dir/images/ui-icons_454545_256x240.png
--------------------------------------------------------------------------------
/docs/apidocs/script-dir/images/ui-icons_888888_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/docs/apidocs/script-dir/images/ui-icons_888888_256x240.png
--------------------------------------------------------------------------------
/docs/apidocs/script-dir/images/ui-icons_cd0a0a_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/docs/apidocs/script-dir/images/ui-icons_cd0a0a_256x240.png
--------------------------------------------------------------------------------
/docs/apidocs/script-dir/jquery-ui.structure.min.css:
--------------------------------------------------------------------------------
1 | /*! jQuery UI - v1.12.1 - 2018-12-06
2 | * http://jqueryui.com
3 | * Copyright jQuery Foundation and other contributors; Licensed MIT */
4 |
5 | .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}
--------------------------------------------------------------------------------
/docs/apidocs/script.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Oracle designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Oracle in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 | * or visit www.oracle.com if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | var moduleSearchIndex;
27 | var packageSearchIndex;
28 | var typeSearchIndex;
29 | var memberSearchIndex;
30 | var tagSearchIndex;
31 | function loadScripts(doc, tag) {
32 | createElem(doc, tag, 'search.js');
33 |
34 | createElem(doc, tag, 'module-search-index.js');
35 | createElem(doc, tag, 'package-search-index.js');
36 | createElem(doc, tag, 'type-search-index.js');
37 | createElem(doc, tag, 'member-search-index.js');
38 | createElem(doc, tag, 'tag-search-index.js');
39 | }
40 |
41 | function createElem(doc, tag, path) {
42 | var script = doc.createElement(tag);
43 | var scriptElement = doc.getElementsByTagName(tag)[0];
44 | script.src = pathtoroot + path;
45 | scriptElement.parentNode.insertBefore(script, scriptElement);
46 | }
47 |
48 | function show(tableId, selected, columns) {
49 | if (tableId !== selected) {
50 | document.querySelectorAll('div.' + tableId + ':not(.' + selected + ')')
51 | .forEach(function(elem) {
52 | elem.style.display = 'none';
53 | });
54 | }
55 | document.querySelectorAll('div.' + selected)
56 | .forEach(function(elem, index) {
57 | elem.style.display = '';
58 | var isEvenRow = index % (columns * 2) < columns;
59 | elem.classList.remove(isEvenRow ? oddRowColor : evenRowColor);
60 | elem.classList.add(isEvenRow ? evenRowColor : oddRowColor);
61 | });
62 | updateTabs(tableId, selected);
63 | }
64 |
65 | function updateTabs(tableId, selected) {
66 | document.querySelector('div#' + tableId +' .summary-table')
67 | .setAttribute('aria-labelledby', selected);
68 | document.querySelectorAll('button[id^="' + tableId + '"]')
69 | .forEach(function(tab, index) {
70 | if (selected === tab.id || (tableId === selected && index === 0)) {
71 | tab.className = activeTableTab;
72 | tab.setAttribute('aria-selected', true);
73 | tab.setAttribute('tabindex',0);
74 | } else {
75 | tab.className = tableTab;
76 | tab.setAttribute('aria-selected', false);
77 | tab.setAttribute('tabindex',-1);
78 | }
79 | });
80 | }
81 |
82 | function switchTab(e) {
83 | var selected = document.querySelector('[aria-selected=true]');
84 | if (selected) {
85 | if ((e.keyCode === 37 || e.keyCode === 38) && selected.previousSibling) {
86 | // left or up arrow key pressed: move focus to previous tab
87 | selected.previousSibling.click();
88 | selected.previousSibling.focus();
89 | e.preventDefault();
90 | } else if ((e.keyCode === 39 || e.keyCode === 40) && selected.nextSibling) {
91 | // right or down arrow key pressed: move focus to next tab
92 | selected.nextSibling.click();
93 | selected.nextSibling.focus();
94 | e.preventDefault();
95 | }
96 | }
97 | }
98 |
99 | var updateSearchResults = function() {};
100 |
101 | function indexFilesLoaded() {
102 | return moduleSearchIndex
103 | && packageSearchIndex
104 | && typeSearchIndex
105 | && memberSearchIndex
106 | && tagSearchIndex;
107 | }
108 |
109 | // Workaround for scroll position not being included in browser history (8249133)
110 | document.addEventListener("DOMContentLoaded", function(e) {
111 | var contentDiv = document.querySelector("div.flex-content");
112 | window.addEventListener("popstate", function(e) {
113 | if (e.state !== null) {
114 | contentDiv.scrollTop = e.state;
115 | }
116 | });
117 | window.addEventListener("hashchange", function(e) {
118 | history.replaceState(contentDiv.scrollTop, document.title);
119 | });
120 | contentDiv.addEventListener("scroll", function(e) {
121 | var timeoutID;
122 | if (!timeoutID) {
123 | timeoutID = setTimeout(function() {
124 | history.replaceState(contentDiv.scrollTop, document.title);
125 | timeoutID = null;
126 | }, 100);
127 | }
128 | });
129 | if (!location.hash) {
130 | history.replaceState(contentDiv.scrollTop, document.title);
131 | }
132 | });
133 |
--------------------------------------------------------------------------------
/docs/apidocs/tag-search-index.js:
--------------------------------------------------------------------------------
1 | tagSearchIndex = [{"l":"Constant Field Values","h":"","u":"constant-values.html"}];updateSearchResults();
--------------------------------------------------------------------------------
/docs/apidocs/type-search-index.js:
--------------------------------------------------------------------------------
1 | typeSearchIndex = [{"l":"All Classes and Interfaces","u":"allclasses-index.html"},{"p":"com.dongbat.jbump.util","l":"BooleanArray"},{"p":"com.dongbat.jbump","l":"Cell"},{"p":"com.dongbat.jbump","l":"Collision"},{"p":"com.dongbat.jbump","l":"CollisionFilter"},{"p":"com.dongbat.jbump","l":"Collisions"},{"p":"com.dongbat.jbump.util","l":"IntIntMap.Entries"},{"p":"com.dongbat.jbump.util","l":"IntIntMap.Entry"},{"p":"com.dongbat.jbump","l":"Extra"},{"p":"com.dongbat.jbump.util","l":"FloatArray"},{"p":"com.dongbat.jbump","l":"Grid"},{"p":"com.dongbat.jbump.util","l":"IntArray"},{"p":"com.dongbat.jbump.util","l":"IntIntMap"},{"p":"com.dongbat.jbump","l":"IntPoint"},{"p":"com.dongbat.jbump","l":"Item"},{"p":"com.dongbat.jbump","l":"ItemInfo"},{"p":"com.dongbat.jbump.util","l":"IntIntMap.Keys"},{"p":"com.dongbat.jbump.util","l":"MathUtils"},{"p":"com.dongbat.jbump.util","l":"ObjectSet"},{"p":"com.dongbat.jbump.util","l":"ObjectSet.ObjectSetIterator"},{"p":"com.dongbat.jbump","l":"Point"},{"p":"com.dongbat.jbump","l":"Rect"},{"p":"com.dongbat.jbump","l":"RectHelper"},{"p":"com.dongbat.jbump","l":"Response"},{"p":"com.dongbat.jbump","l":"Response.Result"},{"p":"com.dongbat.jbump","l":"Grid.TraverseCallback"},{"p":"com.dongbat.jbump.util","l":"IntIntMap.Values"},{"p":"com.dongbat.jbump","l":"World"}];updateSearchResults();
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.daemon=true
2 | org.gradle.jvmargs=-Xms128m -Xmx512m -Dfile.encoding=UTF-8 -Dconsole.encoding=UTF-8
3 | org.gradle.configureondemand=false
4 |
5 | # The group has to be one that exists on Maven Central and that can be published to.
6 | # Most usage will still be via JitPack.
7 | GROUP=com.github.tommyettinger
8 | POM_ARTIFACT_ID=jbump
9 | VERSION_NAME=1.0.2
10 |
11 | POM_NAME=jbump
12 | POM_DESCRIPTION=A 2D AABB collision detection and response library.
13 | POM_INCEPTION_YEAR=2017
14 |
15 | POM_URL=https://github.com/implicit-invocation/jbump/
16 | POM_SCM_URL=https://github.com/implicit-invocation/jbump/
17 | POM_SCM_CONNECTION=scm:https://implicit-invocation@github.com/implicit-invocation/jbump.git
18 | POM_SCM_DEV_CONNECTION=scm:git://github.com/implicit-invocation/jbump.git
19 |
20 | POM_LICENCE_NAME=The Apache Software License, Version 2.0
21 | POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
22 | POM_LICENCE_DIST=repo
23 |
24 | POM_DEVELOPER_ID=tommyettinger
25 | POM_DEVELOPER_NAME=Tommy Ettinger
26 | POM_DEVELOPER_URL=https://github.com/tommyettinger/
27 |
28 | # Enables Maven Central deployment.
29 | SONATYPE_HOST=DEFAULT
30 | RELEASE_SIGNING_ENABLED=true
31 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
4 | networkTimeout=10000
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | # This is normally unused
84 | # shellcheck disable=SC2034
85 | APP_BASE_NAME=${0##*/}
86 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
87 |
88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 |
142 | # Increase the maximum file descriptors if we can.
143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144 | case $MAX_FD in #(
145 | max*)
146 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147 | # shellcheck disable=SC3045
148 | MAX_FD=$( ulimit -H -n ) ||
149 | warn "Could not query maximum file descriptor limit"
150 | esac
151 | case $MAX_FD in #(
152 | '' | soft) :;; #(
153 | *)
154 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155 | # shellcheck disable=SC3045
156 | ulimit -n "$MAX_FD" ||
157 | warn "Could not set maximum file descriptor limit to $MAX_FD"
158 | esac
159 | fi
160 |
161 | # Collect all arguments for the java command, stacking in reverse order:
162 | # * args from the command line
163 | # * the main class name
164 | # * -classpath
165 | # * -D...appname settings
166 | # * --module-path (only if needed)
167 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
168 |
169 | # For Cygwin or MSYS, switch paths to Windows format before running java
170 | if "$cygwin" || "$msys" ; then
171 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
172 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
173 |
174 | JAVACMD=$( cygpath --unix "$JAVACMD" )
175 |
176 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
177 | for arg do
178 | if
179 | case $arg in #(
180 | -*) false ;; # don't mess with options #(
181 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
182 | [ -e "$t" ] ;; #(
183 | *) false ;;
184 | esac
185 | then
186 | arg=$( cygpath --path --ignore --mixed "$arg" )
187 | fi
188 | # Roll the args list around exactly as many times as the number of
189 | # args, so each arg winds up back in the position where it started, but
190 | # possibly modified.
191 | #
192 | # NB: a `for` loop captures its iteration list before it begins, so
193 | # changing the positional parameters here affects neither the number of
194 | # iterations, nor the values presented in `arg`.
195 | shift # remove old arg
196 | set -- "$@" "$arg" # push replacement arg
197 | done
198 | fi
199 |
200 | # Collect all arguments for the java command;
201 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
202 | # shell script including quotes and variable substitutions, so put them in
203 | # double quotes to make sure that they get re-expanded; and
204 | # * put everything else in single quotes, so that it's not re-expanded.
205 |
206 | set -- \
207 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
208 | -classpath "$CLASSPATH" \
209 | org.gradle.wrapper.GradleWrapperMain \
210 | "$@"
211 |
212 | # Stop when "xargs" is not available.
213 | if ! command -v xargs >/dev/null 2>&1
214 | then
215 | die "xargs is not available"
216 | fi
217 |
218 | # Use "xargs" to parse quoted args.
219 | #
220 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
221 | #
222 | # In Bash we could simply go:
223 | #
224 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
225 | # set -- "${ARGS[@]}" "$@"
226 | #
227 | # but POSIX shell has neither arrays nor command substitution, so instead we
228 | # post-process each arg (as a line of input to sed) to backslash-escape any
229 | # character that might be a shell metacharacter, then use eval to reverse
230 | # that process (while maintaining the separation between arguments), and wrap
231 | # the whole thing up as a single "set" statement.
232 | #
233 | # This will of course break if any of these variables contains a newline or
234 | # an unmatched quote.
235 | #
236 |
237 | eval "set -- $(
238 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
239 | xargs -n1 |
240 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
241 | tr '\n' ' '
242 | )" '"$@"'
243 |
244 | exec "$JAVACMD" "$@"
245 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/images/shoot.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/images/shoot.gif
--------------------------------------------------------------------------------
/images/sprite.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/images/sprite.gif
--------------------------------------------------------------------------------
/images/tile.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/implicit-invocation/jbump/a5d7e5f2987ccef04eadc1304d7da17fa0b19592/images/tile.gif
--------------------------------------------------------------------------------
/jbump/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java-library'
2 | apply plugin: 'com.vanniktech.maven.publish'
3 |
4 | sourceCompatibility = 1.7
5 | [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
6 |
7 | javadoc.options.source("17")
8 | javadoc.destinationDir = file("../docs/apidocs")
9 |
10 | [compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
11 | if (JavaVersion.current().isJava9Compatible()) {
12 | compileJava.targetCompatibility = 7
13 | }
14 |
15 | def projectName = 'jbump'
16 |
17 | jar {
18 | archiveBaseName.set(projectName)
19 | duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
20 | manifest {
21 | attributes 'Implementation-Title': projectName, 'Implementation-Version': archiveVersion
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/jbump/src/main/java/com/dongbat/jbump/Cell.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 tao.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.dongbat.jbump;
17 |
18 | import com.dongbat.jbump.util.ObjectSet;
19 |
20 | /**
21 | *
22 | * @author tao
23 | */
24 | public class Cell {
25 | public float x;
26 | public float y;
27 | /**
28 | * This class is compared by identity, like {@link Item}, and it also caches its identityHashCode() result.
29 | */
30 | protected final int identityHash;
31 | /**
32 | * Stores the Item values in this Cell.
33 | *
34 | * This uses a different implementation of Set than usual; {@link ObjectSet} reuses its iterators where HashSet does
35 | * not, and in general uses less memory. Avoiding GC pressure is important in games, especially those that target
36 | * mobile or web platforms, and JBump iterates over these items fairly often, so we don't want to create many
37 | * Iterators without needing to. ObjectSet doesn't support nested iteration over the same Set, so that is something to
38 | * be aware of. This was a HashSet, but ObjectSet implements about the same API.
39 | */
40 | public ObjectSet- items = new ObjectSet
- (11);
41 |
42 | /**
43 | * Constructs a Cell with a position of 0,0 and no items (it will be empty).
44 | *
45 | * If you subclass Cell, you should call {@code super()} so the cached identity hash code is stored correctly.
46 | */
47 | public Cell() {
48 | identityHash = System.identityHashCode(this);
49 | }
50 |
51 | @Override
52 | public boolean equals(Object o) {
53 | return (this == o);
54 | }
55 |
56 | @Override
57 | public int hashCode() {
58 | return identityHash;
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/jbump/src/main/java/com/dongbat/jbump/Collision.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 tao.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.dongbat.jbump;
17 |
18 | /**
19 | *
20 | * @author tao
21 | */
22 | public class Collision {
23 | public boolean overlaps;
24 | public float ti;
25 | public Point move = new Point();
26 | public IntPoint normal = new IntPoint();
27 | public Point touch = new Point();
28 | public Rect itemRect = new Rect();
29 | public Rect otherRect = new Rect();
30 | public Item item;
31 | public Item other;
32 | public Response type;
33 |
34 | public Collision() {
35 | }
36 |
37 | public void set(boolean overlaps, float ti, float moveX, float moveY, int normalX, int normalY, float touchX, float touchY,
38 | float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2) {
39 | this.overlaps = overlaps;
40 | this.ti = ti;
41 | this.move.set(moveX, moveY);
42 | this.normal.set(normalX, normalY);
43 | this.touch.set(touchX, touchY);
44 | this.itemRect.set(x1, y1, w1, h1);
45 | this.otherRect.set(x2, y2, w2, h2);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/jbump/src/main/java/com/dongbat/jbump/CollisionFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 tao.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.dongbat.jbump;
17 |
18 | /**
19 | *
20 | * @author tao
21 | */
22 | public interface CollisionFilter {
23 |
24 | Response filter(Item item, Item other);
25 |
26 | CollisionFilter defaultFilter = new CollisionFilter() {
27 | @Override
28 | public Response filter(Item item, Item other) {
29 | return Response.slide;
30 | }
31 | };
32 | }
33 |
--------------------------------------------------------------------------------
/jbump/src/main/java/com/dongbat/jbump/Collisions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 DongBat.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.dongbat.jbump;
17 |
18 | import static com.dongbat.jbump.Rect.rect_getSquareDistance;
19 | import com.dongbat.jbump.util.BooleanArray;
20 | import com.dongbat.jbump.util.FloatArray;
21 | import com.dongbat.jbump.util.IntArray;
22 | import com.dongbat.jbump.util.IntIntMap;
23 | import java.util.ArrayList;
24 | import java.util.Collections;
25 | import java.util.Comparator;
26 | import java.util.List;
27 |
28 | /**
29 | *
30 | * @author tao
31 | */
32 | public class Collisions implements Comparator {
33 |
34 | private final BooleanArray overlaps = new BooleanArray();
35 | private final FloatArray tis = new FloatArray();
36 | private final FloatArray moveXs = new FloatArray();
37 | private final FloatArray moveYs = new FloatArray();
38 | private final IntArray normalXs = new IntArray();
39 | private final IntArray normalYs = new IntArray();
40 | private final FloatArray touchXs = new FloatArray();
41 | private final FloatArray touchYs = new FloatArray();
42 | private final FloatArray x1s = new FloatArray();
43 | private final FloatArray y1s = new FloatArray();
44 | private final FloatArray w1s = new FloatArray();
45 | private final FloatArray h1s = new FloatArray();
46 | private final FloatArray x2s = new FloatArray();
47 | private final FloatArray y2s = new FloatArray();
48 | private final FloatArray w2s = new FloatArray();
49 | private final FloatArray h2s = new FloatArray();
50 | public ArrayList- items = new ArrayList
- ();
51 | public ArrayList
- others = new ArrayList
- ();
52 | public ArrayList
types = new ArrayList();
53 | private int size = 0;
54 |
55 | public Collisions() {
56 |
57 | }
58 |
59 | public Collisions(Collisions other) {
60 | overlaps.addAll(other.overlaps);
61 | tis.addAll(other.tis);
62 | moveXs.addAll(other.moveXs);
63 | moveYs.addAll(other.moveYs);
64 | normalXs.addAll(other.normalXs);
65 | normalYs.addAll(other.normalYs);
66 | touchXs.addAll(other.touchXs);
67 | touchYs.addAll(other.touchYs);
68 | x1s.addAll(other.x1s);
69 | y1s.addAll(other.y1s);
70 | w1s.addAll(other.w1s);
71 | h1s.addAll(other.h1s);
72 | x2s.addAll(other.x2s);
73 | y2s.addAll(other.y2s);
74 | w2s.addAll(other.w2s);
75 | h2s.addAll(other.h2s);
76 | items.addAll(other.items);
77 | others.addAll(other.others);
78 | types.addAll(other.types);
79 | size = other.size;
80 | }
81 |
82 | public void add(Collision col) {
83 | add(col.overlaps, col.ti, col.move.x, col.move.y, col.normal.x, col.normal.y, col.touch.x, col.touch.y,
84 | col.itemRect.x, col.itemRect.y, col.itemRect.w, col.itemRect.h, col.otherRect.x, col.otherRect.y,
85 | col.otherRect.w, col.otherRect.h, col.item, col.other, col.type);
86 | }
87 |
88 | public void add(boolean overlap, float ti, float moveX, float moveY, int normalX, int normalY, float touchX, float touchY,
89 | float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2, Item item, Item other, Response type) {
90 | size++;
91 | overlaps.add(overlap);
92 | tis.add(ti);
93 | moveXs.add(moveX);
94 | moveYs.add(moveY);
95 | normalXs.add(normalX);
96 | normalYs.add(normalY);
97 | touchXs.add(touchX);
98 | touchYs.add(touchY);
99 | x1s.add(x1);
100 | y1s.add(y1);
101 | w1s.add(w1);
102 | h1s.add(h1);
103 | x2s.add(x2);
104 | y2s.add(y2);
105 | w2s.add(w2);
106 | h2s.add(h2);
107 | items.add(item);
108 | others.add(other);
109 | types.add(type);
110 | }
111 |
112 | private final Collision collision = new Collision();
113 |
114 | public Collision get(int index) {
115 | if (index >= size) {
116 | return null;
117 | }
118 | collision.set(overlaps.get(index), tis.get(index), moveXs.get(index), moveYs.get(index), normalXs.get(index), normalYs.get(index), touchXs.get(index), touchYs.get(index), x1s.get(index), y1s.get(index), w1s.get(index), h1s.get(index), x2s.get(index), y2s.get(index), w2s.get(index), h2s.get(index));
119 | collision.item = items.get(index);
120 | collision.other = others.get(index);
121 | collision.type = types.get(index);
122 | return collision;
123 | }
124 |
125 | public void remove(int index) {
126 | if (index < size) {
127 | size--;
128 | overlaps.removeIndex(index);
129 | tis.removeIndex(index);
130 | moveXs.removeIndex(index);
131 | moveYs.removeIndex(index);
132 | normalXs.removeIndex(index);
133 | normalYs.removeIndex(index);
134 | touchXs.removeIndex(index);
135 | touchYs.removeIndex(index);
136 | x1s.removeIndex(index);
137 | y1s.removeIndex(index);
138 | w1s.removeIndex(index);
139 | h1s.removeIndex(index);
140 | x2s.removeIndex(index);
141 | y2s.removeIndex(index);
142 | w2s.removeIndex(index);
143 | h2s.removeIndex(index);
144 | items.remove(index);
145 | others.remove(index);
146 | types.remove(index);
147 | }
148 | }
149 |
150 | public int size() {
151 | return size;
152 | }
153 |
154 | public boolean isEmpty() {
155 | return size == 0;
156 | }
157 |
158 | public void clear() {
159 | size = 0;
160 | overlaps.clear();
161 | tis.clear();
162 | moveXs.clear();
163 | moveYs.clear();
164 | normalXs.clear();
165 | normalYs.clear();
166 | touchXs.clear();
167 | touchYs.clear();
168 | x1s.clear();
169 | y1s.clear();
170 | w1s.clear();
171 | h1s.clear();
172 | x2s.clear();
173 | y2s.clear();
174 | w2s.clear();
175 | h2s.clear();
176 | items.clear();
177 | others.clear();
178 | types.clear();
179 | }
180 |
181 | private final ArrayList order = new ArrayList();
182 | private final IntIntMap swapMap = new IntIntMap();
183 |
184 | public void keySort(
185 | final List indices, List> list) {
186 | swapMap.clear();
187 | for (int i = 0; i < indices.size(); i++) {
188 | int k = indices.get(i);
189 | while (swapMap.containsKey(k)) {
190 | k = swapMap.get(k, 0);
191 | }
192 |
193 | swapMap.put(i, k);
194 | }
195 |
196 | for (IntIntMap.Entry e : swapMap) {
197 | Collections.swap(list, e.key, e.value);
198 | }
199 | }
200 |
201 | public void keySort(
202 | final List indices, FloatArray list) {
203 | swapMap.clear();
204 | for (int i = 0; i < indices.size(); i++) {
205 | int k = indices.get(i);
206 | while (swapMap.containsKey(k)) {
207 | k = swapMap.get(k, 0);
208 | }
209 |
210 | swapMap.put(i, k);
211 | }
212 |
213 | for (IntIntMap.Entry e : swapMap) {
214 | list.swap(e.key, e.value);
215 | }
216 | }
217 |
218 | public void keySort(
219 | final List indices, IntArray list) {
220 | swapMap.clear();
221 | for (int i = 0; i < indices.size(); i++) {
222 | int k = indices.get(i);
223 | while (swapMap.containsKey(k)) {
224 | k = swapMap.get(k, 0);
225 | }
226 |
227 | swapMap.put(i, k);
228 | }
229 |
230 | for (IntIntMap.Entry e : swapMap) {
231 | list.swap(e.key, e.value);
232 | }
233 | }
234 |
235 | public void keySort(
236 | final List indices, BooleanArray list) {
237 | swapMap.clear();
238 | for (int i = 0; i < indices.size(); i++) {
239 | int k = indices.get(i);
240 | while (swapMap.containsKey(k)) {
241 | k = swapMap.get(k, 0);
242 | }
243 |
244 | swapMap.put(i, k);
245 | }
246 |
247 | for (IntIntMap.Entry e : swapMap) {
248 | list.swap(e.key, e.value);
249 | }
250 | }
251 |
252 | public void sort() {
253 | order.clear();
254 | for (int i = 0; i < size; i++) {
255 | order.add(i);
256 | }
257 | Collections.sort(order, this);
258 | keySort(order, overlaps);
259 | keySort(order, tis);
260 | keySort(order, moveXs);
261 | keySort(order, moveYs);
262 | keySort(order, normalXs);
263 | keySort(order, normalYs);
264 | keySort(order, touchXs);
265 | keySort(order, touchYs);
266 | keySort(order, x1s);
267 | keySort(order, y1s);
268 | keySort(order, w1s);
269 | keySort(order, h1s);
270 | keySort(order, x2s);
271 | keySort(order, y2s);
272 | keySort(order, w2s);
273 | keySort(order, h2s);
274 | keySort(order, items);
275 | keySort(order, others);
276 | keySort(order, types);
277 | }
278 |
279 | @Override
280 | public int compare(Integer a, Integer b) {
281 | if (tis.get(a) == (tis.get(b))) {
282 |
283 | float ad = rect_getSquareDistance(x1s.get(a), y1s.get(a), w1s.get(a), h1s.get(a), x2s.get(a), y2s.get(a), w2s.get(a), h2s.get(a));
284 | float bd = rect_getSquareDistance(x1s.get(a), y1s.get(a), w1s.get(a), h1s.get(a), x2s.get(b), y2s.get(b), w2s.get(b), h2s.get(b));
285 |
286 | return Float.compare(ad, bd);
287 | }
288 | return Float.compare(tis.get(a), tis.get(b));
289 | }
290 | }
291 |
--------------------------------------------------------------------------------
/jbump/src/main/java/com/dongbat/jbump/Extra.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 tao.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.dongbat.jbump;
17 |
18 | /**
19 | * Small helper methods for math tasks, as well as the configurable {@link #DELTA}.
20 | * @author tao
21 | */
22 | public class Extra {
23 |
24 | /**
25 | * Used by {@link Rect} and {@link RectHelper} to determine if a float is close
26 | * enough to a threshold to count as within that threshold, to counter-act
27 | * floating-point imprecision. Defaults to {@code 1e-5f} .
28 | */
29 | public static float DELTA = 1e-5f;
30 |
31 | public static int sign(float x) {
32 | if (x > 0) {
33 | return 1;
34 | } else if (x < 0) {
35 | return -1;
36 | }
37 | return 0;
38 | }
39 |
40 | public static float nearest(float x, float a, float b) {
41 | if (Math.abs(a - x) < Math.abs(b - x)) {
42 | return a;
43 | }
44 | return b;
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/jbump/src/main/java/com/dongbat/jbump/Grid.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 tao.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.dongbat.jbump;
17 |
18 | import static java.lang.Math.*;
19 |
20 | /**
21 | * grid_traverse* methods are based on "A Fast Voxel Traversal Algorithm for Ray Tracing",
22 | * by John Amanides and Andrew Woo - http://www.cse.yorku.ca/~amana/research/grid.pdf
23 | * It has been modified to include both cells when the ray "touches a grid corner",
24 | * and with a different exit condition
25 | * @author tao
26 | */
27 | public class Grid {
28 |
29 | public static void grid_toWorld(float cellSize, float cx, float cy, Point point) {
30 | point.set((cx - 1) * cellSize, (cy - 1) * cellSize);
31 | }
32 |
33 | public static void grid_toCell(float cellSize, float x, float y, Point point) {
34 | point.set((float) floor(x / cellSize) + 1, (float) floor(y / cellSize) + 1);
35 | }
36 |
37 | public static int grid_traverse_initStep(float cellSize, float ct, float t1, float t2, Point point) {
38 | float v = t2 - t1;
39 | if (v > 0) {
40 | point.set(cellSize / v, ((ct + v) * cellSize - t1) / v);
41 | return 1;
42 | } else if (v < 0) {
43 | point.set(-cellSize / v, ((ct + v - 1) * cellSize - t1) / v);
44 | return -1;
45 | } else {
46 | point.set(Float.MAX_VALUE, Float.MAX_VALUE);
47 | return 0;
48 | }
49 | }
50 |
51 | public interface TraverseCallback {
52 |
53 | boolean onTraverse(float cx, float cy, int stepX, int stepY);
54 | }
55 |
56 | private final Point grid_traverse_c1 = new Point();
57 | private final Point grid_traverse_c2 = new Point();
58 | private final Point grid_traverse_initStepX = new Point();
59 | private final Point grid_traverse_initStepY = new Point();
60 |
61 | public void grid_traverse(float cellSize, float x1, float y1, float x2, float y2, TraverseCallback f) {
62 | grid_toCell(cellSize, x1, y1, grid_traverse_c1);
63 | float cx1 = grid_traverse_c1.x;
64 | float cy1 = grid_traverse_c1.y;
65 | grid_toCell(cellSize, x2, y2, grid_traverse_c2);
66 | float cx2 = grid_traverse_c2.x;
67 | float cy2 = grid_traverse_c2.y;
68 | int stepX = grid_traverse_initStep(cellSize, cx1, x1, x2, grid_traverse_initStepX);
69 | int stepY = grid_traverse_initStep(cellSize, cy1, y1, y2, grid_traverse_initStepY);
70 | float dx = grid_traverse_initStepX.x;
71 | float tx = grid_traverse_initStepX.y;
72 | float dy = grid_traverse_initStepY.x;
73 | float ty = grid_traverse_initStepY.y;
74 | float cx = cx1, cy = cy1;
75 |
76 | f.onTraverse(cx, cy, stepX, stepY);
77 |
78 | /*The default implementation had an infinite loop problem when
79 | approaching the last cell in some occasions. We finish iterating
80 | when we are *next* to the last cell*/
81 | boolean cont = true; //stop iterating if TraverseCallback reports that cell coordinates are outside of the world.
82 | while (abs(cx - cx2) + abs(cy - cy2) > 1 && cont) {
83 | if (tx < ty) {
84 | tx = tx + dx;
85 | cx = cx + stepX;
86 | cont = f.onTraverse(cx, cy, stepX, stepY);
87 | } else {
88 | //Addition: include both cells when going through corners
89 | if (tx == ty) {
90 | f.onTraverse(cx + stepX, cy, stepX, stepY);
91 | }
92 | ty = ty + dy;
93 | cy = cy + stepY;
94 | cont = f.onTraverse(cx, cy, stepX, stepY);
95 | }
96 | }
97 |
98 | //If we have not arrived to the last cell, use it
99 | if (cx != cx2 || cy != cy2) {
100 | f.onTraverse(cx2, cy2, stepX, stepY);
101 | }
102 | }
103 |
104 | public void grid_traverseRay(float cellSize, float x1, float y1, float dirX, float dirY, TraverseCallback f) {
105 | grid_toCell(cellSize, x1, y1, grid_traverse_c1);
106 | float cx1 = grid_traverse_c1.x;
107 | float cy1 = grid_traverse_c1.y;
108 | int stepX = grid_traverse_initStep(cellSize, cx1, x1, x1 + dirX, grid_traverse_initStepX);
109 | int stepY = grid_traverse_initStep(cellSize, cy1, y1, y1 + dirY, grid_traverse_initStepY);
110 | float dx = grid_traverse_initStepX.x;
111 | float tx = grid_traverse_initStepX.y;
112 | float dy = grid_traverse_initStepY.x;
113 | float ty = grid_traverse_initStepY.y;
114 | float cx = cx1, cy = cy1;
115 |
116 | f.onTraverse(cx, cy, stepX, stepY);
117 |
118 | boolean cont = true; //stop iterating if TraverseCallback reports that cell coordinates are outside of the world.
119 | while (cont) {
120 | if (tx < ty) {
121 | cx = cx + stepX;
122 | cont = f.onTraverse(cx, cy, stepX, stepY);
123 | tx = tx + dx;
124 | } else {
125 | //Addition: include both cells when going through corners
126 | if (tx == ty) {
127 | f.onTraverse(cx + stepX, cy, stepX, stepY);
128 | }
129 | cy = cy + stepY;
130 | cont = f.onTraverse(cx, cy, stepX, stepY);
131 | ty = ty + dy;
132 | }
133 | }
134 | }
135 |
136 | private final Point grid_toCellRect_cxy = new Point();
137 |
138 | public Rect grid_toCellRect(float cellSize, float x, float y, float w, float h, Rect rect) {
139 | grid_toCell(cellSize, x, y, grid_toCellRect_cxy);
140 | float cx = grid_toCellRect_cxy.x;
141 | float cy = grid_toCellRect_cxy.y;
142 |
143 | float cr = (float) ceil((x + w) / cellSize);
144 | float cb = (float) ceil((y + h) / cellSize);
145 |
146 | rect.set(cx, cy, cr - cx + 1, cb - cy + 1);
147 | return rect;
148 | }
149 | }
150 |
--------------------------------------------------------------------------------
/jbump/src/main/java/com/dongbat/jbump/IntPoint.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 tao.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.dongbat.jbump;
17 |
18 | /**
19 | * A 2D point with integer x and y.
20 | * @author tao
21 | */
22 | public class IntPoint {
23 | public int x, y;
24 |
25 | public IntPoint() {
26 | }
27 |
28 | public IntPoint(int x, int y) {
29 | this.x = x;
30 | this.y = y;
31 | }
32 |
33 | public void set(int x, int y) {
34 | this.x = x;
35 | this.y = y;
36 | }
37 |
38 | @Override
39 | public boolean equals(Object o) {
40 | if (this == o) return true;
41 | if (o == null || getClass() != o.getClass()) return false;
42 |
43 | IntPoint intPoint = (IntPoint) o;
44 |
45 | return (x == intPoint.x && y == intPoint.y);
46 | }
47 |
48 | @Override
49 | public int hashCode() {
50 | return x * 11 + y * 47;
51 | }
52 |
53 | @Override
54 | public String toString() {
55 | return "(" +x + ", " + y +')';
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/jbump/src/main/java/com/dongbat/jbump/Item.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 tao.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.dongbat.jbump;
17 |
18 | /**
19 | * Wraps an {@code E} value in {@link #userData}, so it is compared by the identity
20 | * of the Item, not the E value. You can freely change the E value; it is not used
21 | * for comparison with other Items. The userData can be null.
22 | * @author tao
23 | */
24 | public class Item {
25 |
26 | /**
27 | * This is not ever read by JBump, so this can be anything user code needs it to be.
28 | * It isn't considered by {@link #equals(Object)} or by {@link #hashCode()}. This
29 | * may be null.
30 | */
31 | public E userData;
32 | protected final int identityHash;
33 |
34 | /**
35 | * Constructs an Item with no userData (it will be null).
36 | *
37 | * If you subclass Item, you should call {@code super()} so the cached identity hash code is stored correctly.
38 | */
39 | public Item() {
40 | identityHash = System.identityHashCode(this);
41 | }
42 |
43 | /**
44 | * Constructs an Item with the given {@code E} userData; the userData can change after construction.
45 | *
46 | * If you subclass Item, you should call {@code super(E)} so the cached identity hash code is stored correctly.
47 | * @param userData whatever {@code E} item this should hold; may be null.
48 | */
49 | public Item(E userData) {
50 | identityHash = System.identityHashCode(this);
51 | this.userData = userData;
52 | }
53 |
54 | @Override
55 | public boolean equals(Object o) {
56 | return (this == o);
57 | }
58 |
59 | @Override
60 | public int hashCode() {
61 | return identityHash;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/jbump/src/main/java/com/dongbat/jbump/ItemInfo.java:
--------------------------------------------------------------------------------
1 | package com.dongbat.jbump;
2 |
3 | import java.util.Comparator;
4 |
5 | public class ItemInfo {
6 | public Item item;
7 |
8 | /**
9 | * The x coordinate where the line segment intersects the {@link Rect} of the {@link Item}.
10 | */
11 | public float x1;
12 |
13 | /**
14 | * The y coordinate where the line segment intersects the {@link Rect} of the {@link Item}.
15 | */
16 | public float y1;
17 |
18 | /**
19 | * The x coordinate where the line segment exits the {@link Rect} of the {@link Item}. In the case that the segment
20 | * does not exit the Rect, this simply returns the coordinate of the segment's end point.
21 | */
22 | public float x2;
23 |
24 | /**
25 | * The y coordinate where the line segment exits the {@link Rect} of the {@link Item}. In the case that the segment
26 | * does not exit the Rect, this simply returns the coordinate of the segment's end point.
27 | */
28 | public float y2;
29 |
30 | /**
31 | * A value from 0 to 1 indicating how far from the starting point of the segment did the impact happen horizontally.
32 | */
33 | public float ti1;
34 |
35 | /**
36 | * A value from 0 to 1 indicating how far from the starting point of the segment did the impact happen vertically.
37 | */
38 | public float ti2;
39 | public float weight;
40 |
41 | public ItemInfo(Item item, float ti1, float ti2, float weight) {
42 | this.item = item;
43 | this.ti1 = ti1;
44 | this.ti2 = ti2;
45 | this.weight = weight;
46 | }
47 |
48 | public static final Comparator weightComparator = new Comparator() {
49 | @Override
50 | public int compare(ItemInfo o1, ItemInfo o2) {
51 | return Float.compare(o1.weight, o2.weight);
52 | }
53 | };
54 | }
55 |
--------------------------------------------------------------------------------
/jbump/src/main/java/com/dongbat/jbump/Point.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 tao.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.dongbat.jbump;
17 |
18 | /**
19 | *
20 | * @author tao
21 | */
22 | public class Point {
23 | public float x, y;
24 |
25 | public Point() {
26 | }
27 |
28 | public Point(float x, float y) {
29 | this.x = x;
30 | this.y = y;
31 | }
32 |
33 | public void set(float x, float y) {
34 | this.x = x;
35 | this.y = y;
36 | }
37 |
38 | @Override
39 | public boolean equals(Object o) {
40 | if (this == o) return true;
41 | if (o == null || getClass() != o.getClass()) return false;
42 |
43 | Point point = (Point) o;
44 |
45 | return Float.compare(point.x, x) == 0 && Float.compare(point.y, y) == 0;
46 | }
47 |
48 | @Override
49 | public int hashCode() {
50 | return (int)(Float.floatToIntBits(x) * 0xC13FA9A902A6328FL
51 | + Float.floatToIntBits(y) * 0x91E10DA5C79E7B1DL >>> 32);
52 | }
53 |
54 | @Override
55 | public String toString() {
56 | return "(" +x +", " + y +')';
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/jbump/src/main/java/com/dongbat/jbump/Rect.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 tao.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.dongbat.jbump;
17 |
18 | import static com.dongbat.jbump.Extra.*;
19 |
20 | /**
21 | *
22 | * @author tao
23 | */
24 | public class Rect {
25 |
26 | public float x, y, w, h;
27 |
28 | public Rect() {
29 | }
30 |
31 | public Rect(float x, float y, float w, float h) {
32 | this.x = x;
33 | this.y = y;
34 | this.w = w;
35 | this.h = h;
36 | }
37 |
38 | public void set(float x, float y, float w, float h) {
39 | this.x = x;
40 | this.y = y;
41 | this.w = w;
42 | this.h = h;
43 | }
44 |
45 | public static void rect_getNearestCorner(float x, float y, float w, float h, float px, float py, Point result) {
46 | result.set(nearest(px, x, x + w), nearest(py, y, y + h));
47 | }
48 |
49 | /**
50 | * This is a generalized implementation of the Liang-Barsky algorithm, which also returns
51 | * the normals of the sides where the segment intersects.
52 | * Notice that normals are only guaranteed to be accurate when initially ti1 == -Float.MAX_VALUE, ti2 == Float.MAX_VALUE
53 | * @return false if the segment never touches the rect
54 | */
55 | public static boolean rect_getSegmentIntersectionIndices(float x, float y, float w, float h, float x1, float y1, float x2, float y2, float ti1, float ti2, Point ti, IntPoint n1, IntPoint n2) {
56 | float dx = x2 - x1;
57 | float dy = y2 - y1;
58 |
59 | int nx = 0, ny = 0;
60 | int nx1 = 0, ny1 = 0, nx2 = 0, ny2 = 0;
61 | float p, q, r;
62 |
63 | for (int side = 1; side <= 4; side++) {
64 | switch (side) {
65 | case 1: //left
66 | nx = -1;
67 | ny = 0;
68 | p = -dx;
69 | q = x1 - x;
70 | break;
71 | case 2: //right
72 | nx = 1;
73 | ny = 0;
74 | p = dx;
75 | q = x + w - x1;
76 | break;
77 | case 3: //top
78 | nx = 0;
79 | ny = -1;
80 | p = -dy;
81 | q = y1 - y;
82 | break;
83 | default: //bottom
84 | nx = 0;
85 | ny = 1;
86 | p = dy;
87 | q = y + h - y1;
88 | break;
89 | }
90 |
91 | if (p == 0) {
92 | if (q <= 0) {
93 | return false;
94 | }
95 | } else {
96 | r = q / p;
97 | if (p < 0) {
98 | if (r > ti2) {
99 | return false;
100 | } else if (r > ti1) {
101 | ti1 = r;
102 | nx1 = nx;
103 | ny1 = ny;
104 | }
105 | } else {
106 | if (r < ti1) {
107 | return false;
108 | } else if (r < ti2) {
109 | ti2 = r;
110 | nx2 = nx;
111 | ny2 = ny;
112 | }
113 | }
114 | }
115 | }
116 | ti.set(ti1, ti2);
117 | n1.set(nx1, ny1);
118 | n2.set(nx2, ny2);
119 | return true;
120 | }
121 |
122 | /**
123 | * Calculates the Minkowsky difference between 2 rects, which is another rect
124 | */
125 | public static void rect_getDiff(float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2, Rect result) {
126 | result.set(x2 - x1 - w1, y2 - y1 - h1, w1 + w2, h1 + h2);
127 | }
128 |
129 | public static boolean rect_containsPoint(float x, float y, float w, float h, float px, float py) {
130 | return px - x > DELTA && py - y > DELTA
131 | && x + w - px > DELTA && y + h - py > DELTA;
132 | }
133 |
134 | public static boolean rect_isIntersecting(float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2) {
135 | return x1 < x2 + w2 && x2 < x1 + w1
136 | && y1 < y2 + h2 && y2 < y1 + h1;
137 | }
138 |
139 | public static float rect_getSquareDistance(float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2) {
140 | float dx = x1 - x2 + (w1 - w2) / 2;
141 | float dy = y1 - y2 + (h1 - h2) / 2;
142 | return dx * dx + dy * dy;
143 | }
144 |
145 | }
146 |
--------------------------------------------------------------------------------
/jbump/src/main/java/com/dongbat/jbump/RectHelper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 DongBat.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.dongbat.jbump;
17 |
18 | import static com.dongbat.jbump.Extra.DELTA;
19 | import static com.dongbat.jbump.Extra.sign;
20 | import static com.dongbat.jbump.Rect.rect_containsPoint;
21 | import static com.dongbat.jbump.Rect.rect_getDiff;
22 | import static com.dongbat.jbump.Rect.rect_getNearestCorner;
23 | import static com.dongbat.jbump.Rect.rect_getSegmentIntersectionIndices;
24 | import static java.lang.Math.abs;
25 | import static java.lang.Math.min;
26 |
27 | /**
28 | *
29 | * @author tao
30 | */
31 | public class RectHelper {
32 |
33 | private final Rect rect_detectCollision_diff = new Rect();
34 | private final Point rect_detectCollision_nearestCorner = new Point();
35 | private final Point rect_detectCollision_getSegmentIntersectionIndices_ti = new Point();
36 | private final IntPoint rect_detectCollision_getSegmentIntersectionIndices_n1 = new IntPoint();
37 | private final IntPoint rect_detectCollision_getSegmentIntersectionIndices_n2 = new IntPoint();
38 | private final Collision rect_detectCollision_getSegmentIntersectionIndices_col = new Collision();
39 |
40 | public Collision rect_detectCollision(float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2,
41 | float goalX, float goalY) {
42 | Collision col = rect_detectCollision_getSegmentIntersectionIndices_col;
43 | float dx = goalX - x1;
44 | float dy = goalY - y1;
45 |
46 | rect_getDiff(x1, y1, w1, h1, x2, y2, w2, h2, rect_detectCollision_diff);
47 | float x = rect_detectCollision_diff.x;
48 | float y = rect_detectCollision_diff.y;
49 | float w = rect_detectCollision_diff.w;
50 | float h = rect_detectCollision_diff.h;
51 |
52 | boolean overlaps = false;
53 | Float ti = null;
54 | int nx = 0, ny = 0;
55 |
56 | if (rect_containsPoint(x, y, w, h, 0, 0)) {
57 | //item was intersecting other
58 | rect_getNearestCorner(x, y, w, h, 0, 0, rect_detectCollision_nearestCorner);
59 | float px = rect_detectCollision_nearestCorner.x;
60 | float py = rect_detectCollision_nearestCorner.y;
61 |
62 | //area of intersection
63 | float wi = min(w1, abs(px));
64 | float hi = min(h1, abs(py));
65 | ti = -wi * hi; //ti is the negative area of intersection
66 | overlaps = true;
67 | } else {
68 | boolean intersect = rect_getSegmentIntersectionIndices(x, y, w, h, 0, 0, dx, dy, -Float.MAX_VALUE, Float.MAX_VALUE, rect_detectCollision_getSegmentIntersectionIndices_ti, rect_detectCollision_getSegmentIntersectionIndices_n1, rect_detectCollision_getSegmentIntersectionIndices_n2);
69 | float ti1 = rect_detectCollision_getSegmentIntersectionIndices_ti.x;
70 | float ti2 = rect_detectCollision_getSegmentIntersectionIndices_ti.y;
71 | int nx1 = rect_detectCollision_getSegmentIntersectionIndices_n1.x;
72 | int ny1 = rect_detectCollision_getSegmentIntersectionIndices_n1.y;
73 |
74 | //item tunnels into other
75 | if (intersect && ti1 < 1 && abs(ti1 - ti2) >= DELTA //special case for rect going through another rect's corner
76 | && (0 < ti1 + DELTA || 0 == ti1 && ti2 > 0)) {
77 | ti = ti1;
78 | nx = nx1;
79 | ny = ny1;
80 | overlaps = false;
81 | }
82 | }
83 | if (ti == null) {
84 | return null;
85 | }
86 | float tx, ty;
87 |
88 | if (overlaps) {
89 | if (dx == 0 && dy == 0) {
90 | //intersecting and not moving - use minimum displacement vector
91 | rect_getNearestCorner(x, y, w, h, 0, 0, rect_detectCollision_nearestCorner);
92 | float px = rect_detectCollision_nearestCorner.x;
93 | float py = rect_detectCollision_nearestCorner.y;
94 | if (abs(px) < abs(py)) {
95 | py = 0;
96 | } else {
97 | px = 0;
98 | }
99 | nx = sign(px);
100 | ny = sign(py);
101 | tx = x1 + px;
102 | ty = y1 + py;
103 | } else {
104 | //intersecting and moving - move in the opposite direction
105 | boolean intersect = rect_getSegmentIntersectionIndices(x, y, w, h, 0, 0, dx, dy, -Float.MAX_VALUE, 1, rect_detectCollision_getSegmentIntersectionIndices_ti, rect_detectCollision_getSegmentIntersectionIndices_n1, rect_detectCollision_getSegmentIntersectionIndices_n2);
106 | float ti1 = rect_detectCollision_getSegmentIntersectionIndices_ti.x;
107 | nx = rect_detectCollision_getSegmentIntersectionIndices_n1.x;
108 | ny = rect_detectCollision_getSegmentIntersectionIndices_n1.y;
109 | if (!intersect) {
110 | return null;
111 | }
112 | tx = x1 + dx * ti1;
113 | ty = y1 + dy * ti1;
114 | }
115 | } else {
116 | //tunnel
117 | tx = x1 + dx * ti;
118 | ty = y1 + dy * ti;
119 | }
120 | col.set(overlaps, ti, dx, dy, nx, ny, tx, ty, x1, y1, w1, h1, x2, y2, w2, h2);
121 | return col;
122 | }
123 |
124 | }
125 |
--------------------------------------------------------------------------------
/jbump/src/main/java/com/dongbat/jbump/Response.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 tao.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.dongbat.jbump;
17 |
18 | /**
19 | *
20 | * @author tao
21 | */
22 | public interface Response {
23 |
24 | Result response(World world, Collision collision, float x, float y, float w, float h, float goalX, float goalY, CollisionFilter filter, Result result);
25 |
26 | class Result {
27 |
28 | public float goalX;
29 | public float goalY;
30 | public Collisions projectedCollisions = new Collisions();
31 |
32 | public void set(float goalX, float goalY) {
33 | this.goalX = goalX;
34 | this.goalY = goalY;
35 | }
36 | }
37 |
38 | Response slide = new Response() {
39 | @Override
40 | public Result response(World world, Collision collision, float x, float y, float w, float h, float goalX, float goalY, CollisionFilter filter, Result result) {
41 | Point tch = collision.touch;
42 | Point move = collision.move;
43 | float sx = tch.x, sy = tch.y;
44 | if (move.x != 0 || move.y != 0) {
45 | if (collision.normal.x == 0) {
46 | sx = goalX;
47 | } else {
48 | sy = goalY;
49 | }
50 | }
51 |
52 | x = tch.x;
53 | y = tch.y;
54 | goalX = sx;
55 | goalY = sy;
56 | result.projectedCollisions.clear();
57 | world.project(collision.item, x, y, w, h, goalX, goalY, filter, result.projectedCollisions);
58 | result.set(goalX, goalY);
59 | return result;
60 | }
61 | };
62 |
63 | Response touch = new Response() {
64 | @Override
65 | public Result response(World world, Collision collision, float x, float y, float w, float h, float goalX, float goalY, CollisionFilter filter, Result result) {
66 | result.projectedCollisions.clear();
67 | result.set(collision.touch.x, collision.touch.y);
68 | return result;
69 | }
70 | };
71 |
72 | Response cross = new Response() {
73 | @Override
74 | public Result response(World world, Collision collision, float x, float y, float w, float h, float goalX, float goalY, CollisionFilter filter, Result result) {
75 | result.projectedCollisions.clear();
76 | world.project(collision.item, x, y, w, h, goalX, goalY, filter, result.projectedCollisions);
77 | result.set(goalX, goalY);
78 | return result;
79 | }
80 | };
81 |
82 | Response bounce = new Response() {
83 | @Override
84 | public Result response(World world, Collision collision, float x, float y, float w, float h, float goalX, float goalY, CollisionFilter filter, Result result) {
85 | Point tch = collision.touch;
86 | Point move = collision.move;
87 | float bx = tch.x, by = tch.y;
88 | if (move.x != 0 || move.y != 0) {
89 | float bnx = goalX - tch.x;
90 | float bny = goalY - tch.y;
91 | if (collision.normal.x == 0) {
92 | bny = -bny;
93 | } else {
94 | bnx = -bnx;
95 | }
96 | bx = tch.x + bnx;
97 | by = tch.y + bny;
98 | }
99 |
100 | x = tch.x;
101 | y = tch.y;
102 | goalX = bx;
103 | goalY = by;
104 | result.projectedCollisions.clear();
105 | world.project(collision.item, x, y, w, h, goalX, goalY, filter, result.projectedCollisions);
106 | result.set(goalX, goalY);
107 | return result;
108 | }
109 | };
110 | }
111 |
--------------------------------------------------------------------------------
/jbump/src/main/java/com/dongbat/jbump/util/BooleanArray.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 DongBat.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.dongbat.jbump.util;
17 |
18 | /**
19 | *
20 | * @author tao
21 | */
22 | public class BooleanArray {
23 | public boolean[] items;
24 | public int size;
25 | public boolean ordered;
26 |
27 | /** Creates an ordered array with a capacity of 16. */
28 | public BooleanArray () {
29 | this(true, 16);
30 | }
31 |
32 | /** Creates an ordered array with the specified capacity. */
33 | public BooleanArray (int capacity) {
34 | this(true, capacity);
35 | }
36 |
37 | /** @param ordered If false, methods that remove elements may change the order of other elements in the array, which avoids a
38 | * memory copy.
39 | * @param capacity Any elements added beyond this will cause the backing array to be grown. */
40 | public BooleanArray (boolean ordered, int capacity) {
41 | this.ordered = ordered;
42 | items = new boolean[capacity];
43 | }
44 |
45 | /** Creates a new array containing the elements in the specific array. The new array will be ordered if the specific array is
46 | * ordered. The capacity is set to the number of elements, so any subsequent elements added will cause the backing array to be
47 | * grown. */
48 | public BooleanArray (BooleanArray array) {
49 | this.ordered = array.ordered;
50 | size = array.size;
51 | items = new boolean[size];
52 | System.arraycopy(array.items, 0, items, 0, size);
53 | }
54 |
55 | /** Creates a new ordered array containing the elements in the specified array. The capacity is set to the number of elements,
56 | * so any subsequent elements added will cause the backing array to be grown. */
57 | public BooleanArray (boolean[] array) {
58 | this(true, array, 0, array.length);
59 | }
60 |
61 | /** Creates a new array containing the elements in the specified array. The capacity is set to the number of elements, so any
62 | * subsequent elements added will cause the backing array to be grown.
63 | * @param ordered If false, methods that remove elements may change the order of other elements in the array, which avoids a
64 | * memory copy. */
65 | public BooleanArray (boolean ordered, boolean[] array, int startIndex, int count) {
66 | this(ordered, count);
67 | size = count;
68 | System.arraycopy(array, startIndex, items, 0, count);
69 | }
70 |
71 | public void add (boolean value) {
72 | boolean[] items = this.items;
73 | if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f)));
74 | items[size++] = value;
75 | }
76 |
77 | public void addAll (BooleanArray array) {
78 | addAll(array, 0, array.size);
79 | }
80 |
81 | public void addAll (BooleanArray array, int offset, int length) {
82 | if (offset + length > array.size)
83 | throw new IllegalArgumentException("offset + length must be <= size: " + offset + " + " + length + " <= " + array.size);
84 | addAll(array.items, offset, length);
85 | }
86 |
87 | public void addAll (boolean... array) {
88 | addAll(array, 0, array.length);
89 | }
90 |
91 | public void addAll (boolean[] array, int offset, int length) {
92 | boolean[] items = this.items;
93 | int sizeNeeded = size + length;
94 | if (sizeNeeded > items.length) items = resize(Math.max(8, (int)(sizeNeeded * 1.75f)));
95 | System.arraycopy(array, offset, items, size, length);
96 | size += length;
97 | }
98 |
99 | public boolean get (int index) {
100 | if (index >= size) throw new IndexOutOfBoundsException("index can't be >= size: " + index + " >= " + size);
101 | return items[index];
102 | }
103 |
104 | public void set (int index, boolean value) {
105 | if (index >= size) throw new IndexOutOfBoundsException("index can't be >= size: " + index + " >= " + size);
106 | items[index] = value;
107 | }
108 |
109 | public void insert (int index, boolean value) {
110 | if (index > size) throw new IndexOutOfBoundsException("index can't be > size: " + index + " > " + size);
111 | boolean[] items = this.items;
112 | if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f)));
113 | if (ordered)
114 | System.arraycopy(items, index, items, index + 1, size - index);
115 | else
116 | items[size] = items[index];
117 | size++;
118 | items[index] = value;
119 | }
120 |
121 | public void swap (int first, int second) {
122 | if (first >= size) throw new IndexOutOfBoundsException("first can't be >= size: " + first + " >= " + size);
123 | if (second >= size) throw new IndexOutOfBoundsException("second can't be >= size: " + second + " >= " + size);
124 | boolean[] items = this.items;
125 | boolean firstValue = items[first];
126 | items[first] = items[second];
127 | items[second] = firstValue;
128 | }
129 |
130 | /** Removes and returns the item at the specified index. */
131 | public boolean removeIndex (int index) {
132 | if (index >= size) throw new IndexOutOfBoundsException("index can't be >= size: " + index + " >= " + size);
133 | boolean[] items = this.items;
134 | boolean value = items[index];
135 | size--;
136 | if (ordered)
137 | System.arraycopy(items, index + 1, items, index, size - index);
138 | else
139 | items[index] = items[size];
140 | return value;
141 | }
142 |
143 | /** Removes the items between the specified indices, inclusive. */
144 | public void removeRange (int start, int end) {
145 | if (end >= size) throw new IndexOutOfBoundsException("end can't be >= size: " + end + " >= " + size);
146 | if (start > end) throw new IndexOutOfBoundsException("start can't be > end: " + start + " > " + end);
147 | boolean[] items = this.items;
148 | int count = end - start + 1;
149 | if (ordered)
150 | System.arraycopy(items, start + count, items, start, size - (start + count));
151 | else {
152 | int lastIndex = this.size - 1;
153 | for (int i = 0; i < count; i++)
154 | items[start + i] = items[lastIndex - i];
155 | }
156 | size -= count;
157 | }
158 |
159 | /** Removes from this array all of elements contained in the specified array.
160 | * @return true if this array was modified. */
161 | public boolean removeAll (BooleanArray array) {
162 | int size = this.size;
163 | int startSize = size;
164 | boolean[] items = this.items;
165 | for (int i = 0, n = array.size; i < n; i++) {
166 | boolean item = array.get(i);
167 | for (int ii = 0; ii < size; ii++) {
168 | if (item == items[ii]) {
169 | removeIndex(ii);
170 | size--;
171 | break;
172 | }
173 | }
174 | }
175 | return size != startSize;
176 | }
177 |
178 | /** Removes and returns the last item. */
179 | public boolean pop () {
180 | return items[--size];
181 | }
182 |
183 | /** Returns the last item. */
184 | public boolean peek () {
185 | return items[size - 1];
186 | }
187 |
188 | /** Returns the first item. */
189 | public boolean first () {
190 | if (size == 0) throw new IllegalStateException("Array is empty.");
191 | return items[0];
192 | }
193 |
194 | public void clear () {
195 | size = 0;
196 | }
197 |
198 | /** Reduces the size of the backing array to the size of the actual items. This is useful to release memory when many items
199 | * have been removed, or if it is known that more items will not be added.
200 | * @return {@link #items} */
201 | public boolean[] shrink () {
202 | if (items.length != size) resize(size);
203 | return items;
204 | }
205 |
206 | /** Increases the size of the backing array to accommodate the specified number of additional items. Useful before adding many
207 | * items to avoid multiple backing array resizes.
208 | * @return {@link #items} */
209 | public boolean[] ensureCapacity (int additionalCapacity) {
210 | int sizeNeeded = size + additionalCapacity;
211 | if (sizeNeeded > items.length) resize(Math.max(8, sizeNeeded));
212 | return items;
213 | }
214 |
215 | /** Sets the array size, leaving any values beyond the current size undefined.
216 | * @return {@link #items} */
217 | public boolean[] setSize (int newSize) {
218 | if (newSize > items.length) resize(Math.max(8, newSize));
219 | size = newSize;
220 | return items;
221 | }
222 |
223 | protected boolean[] resize (int newSize) {
224 | boolean[] newItems = new boolean[newSize];
225 | boolean[] items = this.items;
226 | System.arraycopy(items, 0, newItems, 0, Math.min(size, newItems.length));
227 | this.items = newItems;
228 | return newItems;
229 | }
230 |
231 | public void reverse () {
232 | boolean[] items = this.items;
233 | for (int i = 0, lastIndex = size - 1, n = size / 2; i < n; i++) {
234 | int ii = lastIndex - i;
235 | boolean temp = items[i];
236 | items[i] = items[ii];
237 | items[ii] = temp;
238 | }
239 | }
240 |
241 | public void shuffle () {
242 | boolean[] items = this.items;
243 | for (int i = size - 1; i >= 0; i--) {
244 | int ii = MathUtils.random(i);
245 | boolean temp = items[i];
246 | items[i] = items[ii];
247 | items[ii] = temp;
248 | }
249 | }
250 |
251 | /** Reduces the size of the array to the specified size. If the array is already smaller than the specified size, no action is
252 | * taken. */
253 | public void truncate (int newSize) {
254 | if (size > newSize) size = newSize;
255 | }
256 |
257 | /** Returns a random item from the array, or false if the array is empty. */
258 | public boolean random () {
259 | if (size == 0) return false;
260 | return items[MathUtils.random(0, size - 1)];
261 | }
262 |
263 | public boolean[] toArray () {
264 | boolean[] array = new boolean[size];
265 | System.arraycopy(items, 0, array, 0, size);
266 | return array;
267 | }
268 |
269 | public int hashCode () {
270 | if (!ordered) return super.hashCode();
271 | boolean[] items = this.items;
272 | int h = 1;
273 | for (int i = 0, n = size; i < n; i++)
274 | h = h * 31 + (items[i] ? 1231 : 1237);
275 | return h;
276 | }
277 |
278 | public boolean equals (Object object) {
279 | if (object == this) return true;
280 | if (!ordered) return false;
281 | if (!(object instanceof BooleanArray)) return false;
282 | BooleanArray array = (BooleanArray)object;
283 | if (!array.ordered) return false;
284 | int n = size;
285 | if (n != array.size) return false;
286 | boolean[] items1 = this.items;
287 | boolean[] items2 = array.items;
288 | for (int i = 0; i < n; i++)
289 | if (items1[i] != items2[i]) return false;
290 | return true;
291 | }
292 |
293 | public String toString () {
294 | if (size == 0) return "[]";
295 | boolean[] items = this.items;
296 | StringBuilder buffer = new StringBuilder(32);
297 | buffer.append('[');
298 | buffer.append(items[0]);
299 | for (int i = 1; i < size; i++) {
300 | buffer.append(", ");
301 | buffer.append(items[i]);
302 | }
303 | buffer.append(']');
304 | return buffer.toString();
305 | }
306 |
307 | public String toString (String separator) {
308 | if (size == 0) return "";
309 | boolean[] items = this.items;
310 | StringBuilder buffer = new StringBuilder(32);
311 | buffer.append(items[0]);
312 | for (int i = 1; i < size; i++) {
313 | buffer.append(separator);
314 | buffer.append(items[i]);
315 | }
316 | return buffer.toString();
317 | }
318 |
319 | /** @see #BooleanArray(boolean[]) */
320 | static public BooleanArray with (boolean... array) {
321 | return new BooleanArray(array);
322 | }
323 | }
--------------------------------------------------------------------------------
/jbump/src/main/resources/com/dongbat/jbump.gwt.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/jitpack.yml:
--------------------------------------------------------------------------------
1 | jdk:
2 | - openjdk17
3 | install:
4 | - echo "Installing with Gradle"
5 | - chmod 755 gradlew
6 | - ./gradlew clean publishToMavenLocal -x signMavenPublication
7 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include 'test', 'jbump'
2 | rootProject.name = 'jbump'
3 |
--------------------------------------------------------------------------------
/test/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'application'
2 | java.targetCompatibility = JavaVersion.VERSION_1_8
3 |
4 | [compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
5 |
6 | sourceCompatibility = 1.8 // lwjgl3 needs this
7 |
8 | mainClassName = "com.dongbat.jbump.test.TestBump"
9 | def projectName = 'jbump-test'
10 |
11 | dependencies {
12 | implementation project(":jbump")
13 | implementation "com.badlogicgames.gdx:gdx:1.10.0"
14 | implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:1.10.0"
15 | implementation "com.badlogicgames.gdx:gdx-platform:1.10.0:natives-desktop"
16 | implementation "space.earlygrey:shapedrawer:2.4.0"
17 | }
18 |
19 | def os = System.properties['os.name'].toLowerCase()
20 |
21 | run {
22 | setIgnoreExitValue(true)
23 |
24 | if (os.contains('mac')) {
25 | // Required to run LWJGL3 Java apps on MacOS
26 | jvmArgs += "-XstartOnFirstThread"
27 | }
28 | }
29 |
30 | jar {
31 | archiveBaseName.set(projectName)
32 | manifest {
33 | attributes 'Main-Class': "com.dongbat.jbump.test.TestBump"
34 | }
35 | duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
36 | from { configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
37 | exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
38 | dependencies {
39 | exclude('META-INF/INDEX.LIST', 'META-INF/maven/**')
40 | }
41 | doLast {
42 | file(archiveFile).setExecutable(true, false)
43 | }
44 | }
45 |
--------------------------------------------------------------------------------