From af88f7f96b64acd013c964383028311d6d310d5e Mon Sep 17 00:00:00 2001 From: Dmitrii Morozov Date: Sat, 4 Jan 2025 12:41:47 +0100 Subject: Start from scratch --- .gitattributes | 2 + LICENSE | 201 --------------------- README.md | 14 -- assets/badlogic.jpg | Bin 68465 -> 0 bytes assets/bg.png | Bin 16109 -> 0 bytes assets/calibri.fnt | 194 -------------------- assets/calibri.png | Bin 26528 -> 0 bytes assets/crosshair.png | Bin 777 -> 0 bytes assets/face.png | Bin 29258 -> 0 bytes assets/libgdx.png | Bin 0 -> 2458 bytes assets/particle.png | Bin 1821 -> 0 bytes assets/particles.p | 160 ---------------- assets/ship.png | Bin 1410 -> 0 bytes assets/target.png | Bin 8279 -> 0 bytes build.gradle | 63 +++---- core/build.gradle | 8 +- .../java/org/snoopdesigns/endless/EndlessGame.java | 32 ++++ core/src/org/snoopdesigns/endless/EndlessGame.java | 66 ------- .../org/snoopdesigns/endless/config/Config.java | 17 -- .../org/snoopdesigns/endless/context/Context.java | 37 ---- .../org/snoopdesigns/endless/context/OnInit.java | 5 - .../endless/input/DefaultInputProcessor.java | 51 ------ .../endless/physics/Box2DDebugRenderer.java | 65 ------- .../endless/physics/Box2DLocation.java | 46 ----- .../endless/physics/Box2DRenderer.java | 22 --- .../snoopdesigns/endless/physics/PhysicalBody.java | 47 ----- .../endless/physics/SteerablePhysicalBody.java | 115 ------------ .../snoopdesigns/endless/physics/WorldContext.java | 17 -- .../endless/physics/camera/CameraContext.java | 48 ----- .../endless/physics/camera/CameraRenderer.java | 55 ------ .../endless/renderer/CursorRenderer.java | 29 --- .../endless/renderer/DebugRenderer.java | 54 ------ .../snoopdesigns/endless/renderer/Renderer.java | 11 -- .../endless/utils/ExitControllable.java | 17 -- .../snoopdesigns/endless/world/Controllable.java | 7 - .../endless/world/ObjectsRenderer.java | 42 ----- .../org/snoopdesigns/endless/world/Renderable.java | 9 - .../endless/world/bg/BackgroundRenderer.java | 35 ---- .../endless/world/effects/EngineEffect.java | 64 ------- .../endless/world/player/PlayerShip.java | 145 --------------- .../endless/world/ship/SteerableEnemyShip.java | 141 --------------- .../endless/world/steering/ChaseSteering.java | 108 ----------- .../endless/world/steering/Steering.java | 5 - .../endless/world/steering/SteeringApplicator.java | 9 - desktop/build.gradle | 94 ++++++---- .../endless/desktop/DesktopLauncher.java | 26 +++ .../org/snoopdesigns/endless/DesktopLauncher.java | 23 --- gradle.properties | 9 +- gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 7 +- gradlew.bat | 22 ++- settings.gradle | 2 +- 52 files changed, 176 insertions(+), 1950 deletions(-) create mode 100644 .gitattributes delete mode 100644 LICENSE delete mode 100644 README.md delete mode 100644 assets/badlogic.jpg delete mode 100644 assets/bg.png delete mode 100644 assets/calibri.fnt delete mode 100644 assets/calibri.png delete mode 100644 assets/crosshair.png delete mode 100644 assets/face.png create mode 100644 assets/libgdx.png delete mode 100644 assets/particle.png delete mode 100644 assets/particles.p delete mode 100644 assets/ship.png delete mode 100644 assets/target.png create mode 100644 core/src/main/java/org/snoopdesigns/endless/EndlessGame.java delete mode 100644 core/src/org/snoopdesigns/endless/EndlessGame.java delete mode 100644 core/src/org/snoopdesigns/endless/config/Config.java delete mode 100644 core/src/org/snoopdesigns/endless/context/Context.java delete mode 100644 core/src/org/snoopdesigns/endless/context/OnInit.java delete mode 100644 core/src/org/snoopdesigns/endless/input/DefaultInputProcessor.java delete mode 100644 core/src/org/snoopdesigns/endless/physics/Box2DDebugRenderer.java delete mode 100644 core/src/org/snoopdesigns/endless/physics/Box2DLocation.java delete mode 100644 core/src/org/snoopdesigns/endless/physics/Box2DRenderer.java delete mode 100644 core/src/org/snoopdesigns/endless/physics/PhysicalBody.java delete mode 100644 core/src/org/snoopdesigns/endless/physics/SteerablePhysicalBody.java delete mode 100644 core/src/org/snoopdesigns/endless/physics/WorldContext.java delete mode 100644 core/src/org/snoopdesigns/endless/physics/camera/CameraContext.java delete mode 100644 core/src/org/snoopdesigns/endless/physics/camera/CameraRenderer.java delete mode 100644 core/src/org/snoopdesigns/endless/renderer/CursorRenderer.java delete mode 100644 core/src/org/snoopdesigns/endless/renderer/DebugRenderer.java delete mode 100644 core/src/org/snoopdesigns/endless/renderer/Renderer.java delete mode 100644 core/src/org/snoopdesigns/endless/utils/ExitControllable.java delete mode 100644 core/src/org/snoopdesigns/endless/world/Controllable.java delete mode 100644 core/src/org/snoopdesigns/endless/world/ObjectsRenderer.java delete mode 100644 core/src/org/snoopdesigns/endless/world/Renderable.java delete mode 100644 core/src/org/snoopdesigns/endless/world/bg/BackgroundRenderer.java delete mode 100644 core/src/org/snoopdesigns/endless/world/effects/EngineEffect.java delete mode 100644 core/src/org/snoopdesigns/endless/world/player/PlayerShip.java delete mode 100644 core/src/org/snoopdesigns/endless/world/ship/SteerableEnemyShip.java delete mode 100644 core/src/org/snoopdesigns/endless/world/steering/ChaseSteering.java delete mode 100644 core/src/org/snoopdesigns/endless/world/steering/Steering.java delete mode 100644 core/src/org/snoopdesigns/endless/world/steering/SteeringApplicator.java create mode 100644 desktop/src/main/java/org/snoopdesigns/endless/desktop/DesktopLauncher.java delete mode 100644 desktop/src/org/snoopdesigns/endless/DesktopLauncher.java mode change 100644 => 100755 gradlew mode change 100644 => 100755 gradlew.bat diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6c84be0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +* text=auto eol=lf +*.bat text=auto eol=crlf diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/README.md b/README.md deleted file mode 100644 index f04b013..0000000 --- a/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# endless-game - -## A small LibGDX based game written in Java -A simple experiment in game development. Implemented using plain Java and [LibGDX](https://github.com/libgdx/libgdx) graphics library. - -## Requirements -1. Java >= 17 -2. Apache Maven - -## Running -Build and execute using Gradle wrapper: -``` -./gradlew clean build run -``` \ No newline at end of file diff --git a/assets/badlogic.jpg b/assets/badlogic.jpg deleted file mode 100644 index 4390da6..0000000 Binary files a/assets/badlogic.jpg and /dev/null differ diff --git a/assets/bg.png b/assets/bg.png deleted file mode 100644 index 04a2f3d..0000000 Binary files a/assets/bg.png and /dev/null differ diff --git a/assets/calibri.fnt b/assets/calibri.fnt deleted file mode 100644 index 2302da5..0000000 --- a/assets/calibri.fnt +++ /dev/null @@ -1,194 +0,0 @@ -info face="Calibri" size=32 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=0,0 -common lineHeight=40 base=28 scaleW=512 scaleH=512 pages=1 packed=0 -page id=0 file="calibri.png" -chars count=189 -char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=28 xadvance=7 page=0 chnl=0 -char id=36 x=0 y=0 width=15 height=30 xoffset=1 yoffset=3 xadvance=16 page=0 chnl=0 -char id=124 x=15 y=0 width=4 height=30 xoffset=6 yoffset=5 xadvance=15 page=0 chnl=0 -char id=41 x=19 y=0 width=8 height=30 xoffset=2 yoffset=5 xadvance=10 page=0 chnl=0 -char id=40 x=27 y=0 width=7 height=30 xoffset=2 yoffset=5 xadvance=10 page=0 chnl=0 -char id=92 x=34 y=0 width=14 height=29 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=0 -char id=47 x=48 y=0 width=14 height=29 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=0 -char id=125 x=62 y=0 width=10 height=29 xoffset=1 yoffset=5 xadvance=10 page=0 chnl=0 -char id=123 x=72 y=0 width=10 height=29 xoffset=1 yoffset=5 xadvance=10 page=0 chnl=0 -char id=93 x=82 y=0 width=7 height=29 xoffset=1 yoffset=5 xadvance=10 page=0 chnl=0 -char id=91 x=89 y=0 width=8 height=29 xoffset=2 yoffset=5 xadvance=10 page=0 chnl=0 -char id=106 x=97 y=0 width=8 height=29 xoffset=0 yoffset=6 xadvance=8 page=0 chnl=0 -char id=64 x=105 y=0 width=24 height=27 xoffset=3 yoffset=6 xadvance=29 page=0 chnl=0 -char id=81 x=129 y=0 width=22 height=25 xoffset=2 yoffset=7 xadvance=22 page=0 chnl=0 -char id=38 x=151 y=0 width=21 height=24 xoffset=1 yoffset=5 xadvance=22 page=0 chnl=0 -char id=37 x=172 y=0 width=23 height=24 xoffset=1 yoffset=6 xadvance=23 page=0 chnl=0 -char id=33 x=195 y=0 width=5 height=24 xoffset=4 yoffset=5 xadvance=10 page=0 chnl=0 -char id=108 x=200 y=0 width=5 height=24 xoffset=2 yoffset=5 xadvance=7 page=0 chnl=0 -char id=107 x=205 y=0 width=14 height=24 xoffset=2 yoffset=5 xadvance=15 page=0 chnl=0 -char id=104 x=219 y=0 width=15 height=24 xoffset=2 yoffset=5 xadvance=17 page=0 chnl=0 -char id=102 x=234 y=0 width=11 height=24 xoffset=1 yoffset=5 xadvance=10 page=0 chnl=0 -char id=100 x=245 y=0 width=15 height=24 xoffset=2 yoffset=5 xadvance=17 page=0 chnl=0 -char id=98 x=260 y=0 width=15 height=24 xoffset=2 yoffset=5 xadvance=17 page=0 chnl=0 -char id=63 x=275 y=0 width=13 height=23 xoffset=2 yoffset=6 xadvance=15 page=0 chnl=0 -char id=121 x=288 y=0 width=15 height=23 xoffset=0 yoffset=12 xadvance=14 page=0 chnl=0 -char id=113 x=303 y=0 width=15 height=23 xoffset=2 yoffset=12 xadvance=17 page=0 chnl=0 -char id=112 x=318 y=0 width=15 height=23 xoffset=2 yoffset=12 xadvance=17 page=0 chnl=0 -char id=105 x=333 y=0 width=5 height=23 xoffset=2 yoffset=6 xadvance=7 page=0 chnl=0 -char id=103 x=338 y=0 width=14 height=23 xoffset=1 yoffset=12 xadvance=15 page=0 chnl=0 -char id=127 x=352 y=0 width=17 height=22 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0 -char id=35 x=369 y=0 width=17 height=22 xoffset=0 yoffset=7 xadvance=16 page=0 chnl=0 -char id=48 x=386 y=0 width=16 height=22 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0 -char id=57 x=402 y=0 width=15 height=22 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0 -char id=56 x=417 y=0 width=16 height=22 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0 -char id=55 x=433 y=0 width=14 height=22 xoffset=2 yoffset=7 xadvance=16 page=0 chnl=0 -char id=54 x=447 y=0 width=15 height=22 xoffset=2 yoffset=7 xadvance=16 page=0 chnl=0 -char id=53 x=462 y=0 width=15 height=22 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0 -char id=52 x=477 y=0 width=16 height=22 xoffset=0 yoffset=7 xadvance=16 page=0 chnl=0 -char id=51 x=493 y=0 width=14 height=22 xoffset=2 yoffset=7 xadvance=16 page=0 chnl=0 -char id=50 x=0 y=30 width=14 height=22 xoffset=2 yoffset=7 xadvance=16 page=0 chnl=0 -char id=49 x=14 y=30 width=13 height=22 xoffset=3 yoffset=7 xadvance=16 page=0 chnl=0 -char id=90 x=27 y=30 width=16 height=22 xoffset=0 yoffset=7 xadvance=15 page=0 chnl=0 -char id=89 x=43 y=30 width=16 height=22 xoffset=0 yoffset=7 xadvance=16 page=0 chnl=0 -char id=88 x=59 y=30 width=17 height=22 xoffset=0 yoffset=7 xadvance=17 page=0 chnl=0 -char id=87 x=76 y=30 width=29 height=22 xoffset=0 yoffset=7 xadvance=28 page=0 chnl=0 -char id=86 x=105 y=30 width=19 height=22 xoffset=0 yoffset=7 xadvance=18 page=0 chnl=0 -char id=85 x=124 y=30 width=17 height=22 xoffset=3 yoffset=7 xadvance=21 page=0 chnl=0 -char id=84 x=141 y=30 width=16 height=22 xoffset=0 yoffset=7 xadvance=16 page=0 chnl=0 -char id=83 x=157 y=30 width=13 height=22 xoffset=1 yoffset=7 xadvance=15 page=0 chnl=0 -char id=82 x=170 y=30 width=15 height=22 xoffset=3 yoffset=7 xadvance=17 page=0 chnl=0 -char id=80 x=185 y=30 width=13 height=22 xoffset=3 yoffset=7 xadvance=17 page=0 chnl=0 -char id=79 x=198 y=30 width=20 height=22 xoffset=2 yoffset=7 xadvance=21 page=0 chnl=0 -char id=78 x=218 y=30 width=17 height=22 xoffset=3 yoffset=7 xadvance=21 page=0 chnl=0 -char id=77 x=235 y=30 width=24 height=22 xoffset=3 yoffset=7 xadvance=27 page=0 chnl=0 -char id=76 x=259 y=30 width=11 height=22 xoffset=3 yoffset=7 xadvance=13 page=0 chnl=0 -char id=75 x=270 y=30 width=15 height=22 xoffset=3 yoffset=7 xadvance=17 page=0 chnl=0 -char id=74 x=285 y=30 width=10 height=22 xoffset=0 yoffset=7 xadvance=10 page=0 chnl=0 -char id=73 x=295 y=30 width=5 height=22 xoffset=3 yoffset=7 xadvance=8 page=0 chnl=0 -char id=72 x=300 y=30 width=17 height=22 xoffset=3 yoffset=7 xadvance=20 page=0 chnl=0 -char id=71 x=317 y=30 width=18 height=22 xoffset=1 yoffset=7 xadvance=20 page=0 chnl=0 -char id=70 x=335 y=30 width=12 height=22 xoffset=3 yoffset=7 xadvance=15 page=0 chnl=0 -char id=69 x=347 y=30 width=12 height=22 xoffset=3 yoffset=7 xadvance=16 page=0 chnl=0 -char id=68 x=359 y=30 width=18 height=22 xoffset=3 yoffset=7 xadvance=20 page=0 chnl=0 -char id=67 x=377 y=30 width=15 height=22 xoffset=2 yoffset=7 xadvance=17 page=0 chnl=0 -char id=66 x=392 y=30 width=15 height=22 xoffset=3 yoffset=7 xadvance=17 page=0 chnl=0 -char id=65 x=407 y=30 width=19 height=22 xoffset=0 yoffset=7 xadvance=19 page=0 chnl=0 -char id=116 x=426 y=30 width=11 height=21 xoffset=1 yoffset=8 xadvance=11 page=0 chnl=0 -char id=59 x=437 y=30 width=8 height=20 xoffset=0 yoffset=13 xadvance=9 page=0 chnl=0 -char id=62 x=445 y=30 width=15 height=18 xoffset=1 yoffset=10 xadvance=16 page=0 chnl=0 -char id=60 x=460 y=30 width=15 height=18 xoffset=1 yoffset=10 xadvance=16 page=0 chnl=0 -char id=58 x=475 y=30 width=4 height=17 xoffset=3 yoffset=12 xadvance=9 page=0 chnl=0 -char id=122 x=479 y=30 width=11 height=17 xoffset=1 yoffset=12 xadvance=13 page=0 chnl=0 -char id=120 x=490 y=30 width=15 height=17 xoffset=0 yoffset=12 xadvance=14 page=0 chnl=0 -char id=119 x=0 y=52 width=23 height=17 xoffset=0 yoffset=12 xadvance=23 page=0 chnl=0 -char id=118 x=23 y=52 width=15 height=17 xoffset=0 yoffset=12 xadvance=14 page=0 chnl=0 -char id=117 x=38 y=52 width=14 height=17 xoffset=2 yoffset=12 xadvance=17 page=0 chnl=0 -char id=115 x=52 y=52 width=11 height=17 xoffset=1 yoffset=12 xadvance=13 page=0 chnl=0 -char id=114 x=63 y=52 width=10 height=17 xoffset=2 yoffset=12 xadvance=11 page=0 chnl=0 -char id=111 x=73 y=52 width=15 height=17 xoffset=1 yoffset=12 xadvance=17 page=0 chnl=0 -char id=110 x=88 y=52 width=15 height=17 xoffset=2 yoffset=12 xadvance=17 page=0 chnl=0 -char id=109 x=103 y=52 width=23 height=17 xoffset=2 yoffset=12 xadvance=26 page=0 chnl=0 -char id=101 x=126 y=52 width=15 height=17 xoffset=1 yoffset=12 xadvance=16 page=0 chnl=0 -char id=99 x=141 y=52 width=13 height=17 xoffset=1 yoffset=12 xadvance=14 page=0 chnl=0 -char id=97 x=154 y=52 width=14 height=17 xoffset=1 yoffset=12 xadvance=15 page=0 chnl=0 -char id=43 x=168 y=52 width=15 height=16 xoffset=1 yoffset=11 xadvance=16 page=0 chnl=0 -char id=42 x=183 y=52 width=13 height=14 xoffset=2 yoffset=5 xadvance=16 page=0 chnl=0 -char id=94 x=196 y=52 width=15 height=14 xoffset=1 yoffset=7 xadvance=16 page=0 chnl=0 -char id=61 x=211 y=52 width=14 height=10 xoffset=1 yoffset=14 xadvance=16 page=0 chnl=0 -char id=44 x=225 y=52 width=7 height=10 xoffset=0 yoffset=23 xadvance=8 page=0 chnl=0 -char id=39 x=232 y=52 width=4 height=10 xoffset=2 yoffset=5 xadvance=7 page=0 chnl=0 -char id=34 x=236 y=52 width=10 height=10 xoffset=2 yoffset=5 xadvance=13 page=0 chnl=0 -char id=126 x=246 y=52 width=16 height=8 xoffset=1 yoffset=9 xadvance=16 page=0 chnl=0 -char id=96 x=262 y=52 width=8 height=7 xoffset=1 yoffset=5 xadvance=9 page=0 chnl=0 -char id=46 x=270 y=52 width=5 height=5 xoffset=2 yoffset=24 xadvance=8 page=0 chnl=0 -char id=95 x=275 y=52 width=17 height=4 xoffset=0 yoffset=31 xadvance=16 page=0 chnl=0 -char id=45 x=292 y=52 width=9 height=4 xoffset=1 yoffset=18 xadvance=10 page=0 chnl=0 -char id=175 x=301 y=52 width=10 height=4 xoffset=2 yoffset=7 xadvance=13 page=0 chnl=0 -char id=168 x=311 y=52 width=11 height=5 xoffset=2 yoffset=6 xadvance=13 page=0 chnl=0 -char id=183 x=322 y=52 width=5 height=6 xoffset=2 yoffset=16 xadvance=8 page=0 chnl=0 -char id=172 x=327 y=52 width=15 height=7 xoffset=1 yoffset=17 xadvance=16 page=0 chnl=0 -char id=180 x=342 y=52 width=8 height=7 xoffset=1 yoffset=5 xadvance=9 page=0 chnl=0 -char id=184 x=350 y=52 width=7 height=8 xoffset=2 yoffset=27 xadvance=10 page=0 chnl=0 -char id=176 x=357 y=52 width=10 height=10 xoffset=2 yoffset=5 xadvance=11 page=0 chnl=0 -char id=174 x=367 y=52 width=14 height=14 xoffset=2 yoffset=5 xadvance=16 page=0 chnl=0 -char id=178 x=381 y=52 width=9 height=14 xoffset=1 yoffset=4 xadvance=11 page=0 chnl=0 -char id=179 x=390 y=52 width=10 height=14 xoffset=1 yoffset=4 xadvance=11 page=0 chnl=0 -char id=185 x=400 y=52 width=7 height=14 xoffset=1 yoffset=4 xadvance=8 page=0 chnl=0 -char id=215 x=407 y=52 width=14 height=14 xoffset=2 yoffset=12 xadvance=16 page=0 chnl=0 -char id=171 x=421 y=52 width=14 height=15 xoffset=1 yoffset=12 xadvance=16 page=0 chnl=0 -char id=187 x=435 y=52 width=14 height=15 xoffset=2 yoffset=12 xadvance=16 page=0 chnl=0 -char id=170 x=449 y=52 width=11 height=16 xoffset=1 yoffset=8 xadvance=13 page=0 chnl=0 -char id=186 x=460 y=52 width=12 height=17 xoffset=1 yoffset=7 xadvance=14 page=0 chnl=0 -char id=230 x=472 y=52 width=24 height=17 xoffset=1 yoffset=12 xadvance=25 page=0 chnl=0 -char id=247 x=496 y=52 width=15 height=18 xoffset=1 yoffset=10 xadvance=16 page=0 chnl=0 -char id=164 x=0 y=70 width=15 height=19 xoffset=1 yoffset=10 xadvance=16 page=0 chnl=0 -char id=177 x=15 y=70 width=15 height=19 xoffset=1 yoffset=10 xadvance=16 page=0 chnl=0 -char id=162 x=30 y=70 width=13 height=21 xoffset=3 yoffset=8 xadvance=16 page=0 chnl=0 -char id=163 x=43 y=70 width=16 height=21 xoffset=1 yoffset=8 xadvance=16 page=0 chnl=0 -char id=248 x=59 y=70 width=16 height=21 xoffset=1 yoffset=10 xadvance=17 page=0 chnl=0 -char id=165 x=75 y=70 width=18 height=22 xoffset=0 yoffset=7 xadvance=16 page=0 chnl=0 -char id=198 x=93 y=70 width=25 height=22 xoffset=-1 yoffset=7 xadvance=24 page=0 chnl=0 -char id=208 x=118 y=70 width=20 height=22 xoffset=0 yoffset=7 xadvance=20 page=0 chnl=0 -char id=222 x=138 y=70 width=13 height=22 xoffset=3 yoffset=7 xadvance=17 page=0 chnl=0 -char id=181 x=151 y=70 width=17 height=23 xoffset=2 yoffset=12 xadvance=18 page=0 chnl=0 -char id=227 x=168 y=70 width=14 height=23 xoffset=1 yoffset=6 xadvance=15 page=0 chnl=0 -char id=228 x=182 y=70 width=14 height=23 xoffset=1 yoffset=6 xadvance=15 page=0 chnl=0 -char id=231 x=196 y=70 width=13 height=23 xoffset=1 yoffset=12 xadvance=14 page=0 chnl=0 -char id=235 x=209 y=70 width=15 height=23 xoffset=1 yoffset=6 xadvance=16 page=0 chnl=0 -char id=239 x=224 y=70 width=10 height=23 xoffset=0 yoffset=6 xadvance=7 page=0 chnl=0 -char id=241 x=234 y=70 width=15 height=23 xoffset=2 yoffset=6 xadvance=17 page=0 chnl=0 -char id=245 x=249 y=70 width=15 height=23 xoffset=1 yoffset=6 xadvance=17 page=0 chnl=0 -char id=246 x=264 y=70 width=15 height=23 xoffset=1 yoffset=6 xadvance=17 page=0 chnl=0 -char id=252 x=279 y=70 width=14 height=23 xoffset=2 yoffset=6 xadvance=17 page=0 chnl=0 -char id=161 x=293 y=70 width=5 height=24 xoffset=2 yoffset=9 xadvance=10 page=0 chnl=0 -char id=169 x=298 y=70 width=23 height=24 xoffset=2 yoffset=5 xadvance=27 page=0 chnl=0 -char id=188 x=321 y=70 width=19 height=24 xoffset=1 yoffset=6 xadvance=20 page=0 chnl=0 -char id=189 x=340 y=70 width=20 height=24 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 -char id=190 x=360 y=70 width=20 height=24 xoffset=1 yoffset=6 xadvance=22 page=0 chnl=0 -char id=191 x=380 y=70 width=13 height=24 xoffset=1 yoffset=9 xadvance=15 page=0 chnl=0 -char id=223 x=393 y=70 width=15 height=24 xoffset=2 yoffset=5 xadvance=17 page=0 chnl=0 -char id=224 x=408 y=70 width=14 height=24 xoffset=1 yoffset=5 xadvance=15 page=0 chnl=0 -char id=225 x=422 y=70 width=14 height=24 xoffset=1 yoffset=5 xadvance=15 page=0 chnl=0 -char id=226 x=436 y=70 width=14 height=24 xoffset=1 yoffset=5 xadvance=15 page=0 chnl=0 -char id=229 x=450 y=70 width=14 height=24 xoffset=1 yoffset=5 xadvance=15 page=0 chnl=0 -char id=232 x=464 y=70 width=15 height=24 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0 -char id=233 x=479 y=70 width=15 height=24 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0 -char id=234 x=494 y=70 width=15 height=24 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0 -char id=236 x=0 y=94 width=8 height=24 xoffset=-1 yoffset=5 xadvance=7 page=0 chnl=0 -char id=237 x=8 y=94 width=8 height=24 xoffset=1 yoffset=5 xadvance=7 page=0 chnl=0 -char id=238 x=16 y=94 width=10 height=24 xoffset=-1 yoffset=5 xadvance=7 page=0 chnl=0 -char id=240 x=26 y=94 width=15 height=24 xoffset=2 yoffset=5 xadvance=17 page=0 chnl=0 -char id=242 x=41 y=94 width=15 height=24 xoffset=1 yoffset=5 xadvance=17 page=0 chnl=0 -char id=243 x=56 y=94 width=15 height=24 xoffset=1 yoffset=5 xadvance=17 page=0 chnl=0 -char id=244 x=71 y=94 width=15 height=24 xoffset=1 yoffset=5 xadvance=17 page=0 chnl=0 -char id=249 x=86 y=94 width=14 height=24 xoffset=2 yoffset=5 xadvance=17 page=0 chnl=0 -char id=250 x=100 y=94 width=14 height=24 xoffset=2 yoffset=5 xadvance=17 page=0 chnl=0 -char id=251 x=114 y=94 width=14 height=24 xoffset=2 yoffset=5 xadvance=17 page=0 chnl=0 -char id=182 x=128 y=94 width=16 height=26 xoffset=2 yoffset=7 xadvance=19 page=0 chnl=0 -char id=167 x=144 y=94 width=14 height=27 xoffset=2 yoffset=5 xadvance=16 page=0 chnl=0 -char id=196 x=158 y=94 width=19 height=27 xoffset=0 yoffset=2 xadvance=19 page=0 chnl=0 -char id=203 x=177 y=94 width=12 height=27 xoffset=3 yoffset=2 xadvance=16 page=0 chnl=0 -char id=207 x=189 y=94 width=11 height=27 xoffset=-1 yoffset=2 xadvance=8 page=0 chnl=0 -char id=214 x=200 y=94 width=20 height=27 xoffset=2 yoffset=2 xadvance=21 page=0 chnl=0 -char id=220 x=220 y=94 width=17 height=27 xoffset=3 yoffset=2 xadvance=21 page=0 chnl=0 -char id=195 x=237 y=94 width=19 height=28 xoffset=0 yoffset=1 xadvance=19 page=0 chnl=0 -char id=197 x=256 y=94 width=19 height=28 xoffset=0 yoffset=1 xadvance=19 page=0 chnl=0 -char id=199 x=275 y=94 width=16 height=28 xoffset=2 yoffset=7 xadvance=17 page=0 chnl=0 -char id=209 x=291 y=94 width=17 height=28 xoffset=3 yoffset=1 xadvance=21 page=0 chnl=0 -char id=213 x=308 y=94 width=20 height=28 xoffset=2 yoffset=1 xadvance=21 page=0 chnl=0 -char id=216 x=328 y=94 width=20 height=28 xoffset=1 yoffset=4 xadvance=21 page=0 chnl=0 -char id=192 x=348 y=94 width=19 height=29 xoffset=0 yoffset=0 xadvance=19 page=0 chnl=0 -char id=193 x=367 y=94 width=19 height=29 xoffset=0 yoffset=0 xadvance=19 page=0 chnl=0 -char id=194 x=386 y=94 width=19 height=29 xoffset=0 yoffset=0 xadvance=19 page=0 chnl=0 -char id=200 x=405 y=94 width=13 height=29 xoffset=2 yoffset=0 xadvance=16 page=0 chnl=0 -char id=201 x=418 y=94 width=12 height=29 xoffset=3 yoffset=0 xadvance=16 page=0 chnl=0 -char id=202 x=430 y=94 width=12 height=29 xoffset=3 yoffset=0 xadvance=16 page=0 chnl=0 -char id=204 x=442 y=94 width=10 height=29 xoffset=-2 yoffset=0 xadvance=8 page=0 chnl=0 -char id=205 x=452 y=94 width=10 height=29 xoffset=2 yoffset=0 xadvance=8 page=0 chnl=0 -char id=206 x=462 y=94 width=13 height=29 xoffset=-1 yoffset=0 xadvance=8 page=0 chnl=0 -char id=210 x=475 y=94 width=20 height=29 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=0 -char id=211 x=0 y=123 width=20 height=29 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=0 -char id=212 x=20 y=123 width=20 height=29 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=0 -char id=217 x=40 y=123 width=17 height=29 xoffset=3 yoffset=0 xadvance=21 page=0 chnl=0 -char id=218 x=57 y=123 width=17 height=29 xoffset=3 yoffset=0 xadvance=21 page=0 chnl=0 -char id=219 x=74 y=123 width=17 height=29 xoffset=3 yoffset=0 xadvance=21 page=0 chnl=0 -char id=221 x=91 y=123 width=16 height=29 xoffset=0 yoffset=0 xadvance=16 page=0 chnl=0 -char id=255 x=107 y=123 width=15 height=29 xoffset=0 yoffset=6 xadvance=14 page=0 chnl=0 -char id=253 x=122 y=123 width=15 height=30 xoffset=0 yoffset=5 xadvance=14 page=0 chnl=0 -char id=254 x=137 y=123 width=15 height=30 xoffset=2 yoffset=5 xadvance=17 page=0 chnl=0 -char id=166 x=152 y=123 width=5 height=31 xoffset=6 yoffset=4 xadvance=16 page=0 chnl=0 diff --git a/assets/calibri.png b/assets/calibri.png deleted file mode 100644 index 63deb95..0000000 Binary files a/assets/calibri.png and /dev/null differ diff --git a/assets/crosshair.png b/assets/crosshair.png deleted file mode 100644 index cbb5af8..0000000 Binary files a/assets/crosshair.png and /dev/null differ diff --git a/assets/face.png b/assets/face.png deleted file mode 100644 index 80006f9..0000000 Binary files a/assets/face.png and /dev/null differ diff --git a/assets/libgdx.png b/assets/libgdx.png new file mode 100644 index 0000000..6c7bfca Binary files /dev/null and b/assets/libgdx.png differ diff --git a/assets/particle.png b/assets/particle.png deleted file mode 100644 index 632fcc1..0000000 Binary files a/assets/particle.png and /dev/null differ diff --git a/assets/particles.p b/assets/particles.p deleted file mode 100644 index ad82dfc..0000000 --- a/assets/particles.p +++ /dev/null @@ -1,160 +0,0 @@ -Untitled -- Delay - -active: false -- Duration - -lowMin: 100.0 -lowMax: 100.0 -- Count - -min: 0 -max: 200 -- Emission - -lowMin: 200.0 -lowMax: 200.0 -highMin: 200.0 -highMax: 200.0 -relative: false -scalingCount: 1 -scaling0: 1.0 -timelineCount: 1 -timeline0: 0.0 -- Life - -lowMin: 0.0 -lowMax: 0.0 -highMin: 1000.0 -highMax: 1000.0 -relative: false -scalingCount: 3 -scaling0: 1.0 -scaling1: 1.0 -scaling2: 1.0 -timelineCount: 3 -timeline0: 0.0 -timeline1: 0.66 -timeline2: 1.0 -independent: false -- Life Offset - -active: false -independent: false -- X Offset - -active: false -- Y Offset - -active: false -- Spawn Shape - -shape: point -- Spawn Width - -lowMin: 0.0 -lowMax: 0.0 -highMin: 0.0 -highMax: 0.0 -relative: false -scalingCount: 1 -scaling0: 1.0 -timelineCount: 1 -timeline0: 0.0 -- Spawn Height - -lowMin: 0.0 -lowMax: 0.0 -highMin: 0.0 -highMax: 0.0 -relative: false -scalingCount: 1 -scaling0: 1.0 -timelineCount: 1 -timeline0: 0.0 -- X Scale - -lowMin: 1.0 -lowMax: 1.0 -highMin: 2.0 -highMax: 4.0 -relative: false -scalingCount: 1 -scaling0: 1.0 -timelineCount: 1 -timeline0: 0.0 -- Y Scale - -active: false -- Velocity - -active: true -lowMin: 0.0 -lowMax: 0.0 -highMin: 10.0 -highMax: 20.0 -relative: false -scalingCount: 1 -scaling0: 1.0 -timelineCount: 1 -timeline0: 0.0 -- Angle - -active: true -lowMin: -90.0 -lowMax: -90.0 -highMin: -90.0 -highMax: -90.0 -relative: false -scalingCount: 3 -scaling0: 1.0 -scaling1: 1.0 -scaling2: 1.0 -timelineCount: 3 -timeline0: 0.0 -timeline1: 0.6369863 -timeline2: 1.0 -- Rotation - -active: false -- Wind - -active: false -- Gravity - -active: true -lowMin: 0.0 -lowMax: 0.0 -highMin: 0.0 -highMax: 0.0 -relative: false -scalingCount: 1 -scaling0: 1.0 -timelineCount: 1 -timeline0: 0.0 -- Tint - -colorsCount: 9 -colors0: 1.0 -colors1: 1.0 -colors2: 1.0 -colors3: 1.0 -colors4: 1.0 -colors5: 1.0 -colors6: 0.0 -colors7: 1.0 -colors8: 0.9764706 -timelineCount: 3 -timeline0: 0.0 -timeline1: 0.097770154 -timeline2: 1.0 -- Transparency - -lowMin: 0.0 -lowMax: 0.0 -highMin: 1.0 -highMax: 1.0 -relative: false -scalingCount: 5 -scaling0: 0.0 -scaling1: 1.0 -scaling2: 0.8245614 -scaling3: 0.47368422 -scaling4: 0.0 -timelineCount: 5 -timeline0: 0.0 -timeline1: 0.001 -timeline2: 0.46575344 -timeline3: 0.7876712 -timeline4: 1.0 -- Options - -attached: false -continuous: true -aligned: false -additive: true -behind: false -premultipliedAlpha: false -spriteMode: single -- Image Paths - -particle.png - diff --git a/assets/ship.png b/assets/ship.png deleted file mode 100644 index 1833839..0000000 Binary files a/assets/ship.png and /dev/null differ diff --git a/assets/target.png b/assets/target.png deleted file mode 100644 index ed80e94..0000000 Binary files a/assets/target.png and /dev/null differ diff --git a/build.gradle b/build.gradle index 82f04a8..3e5b1e3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,55 +1,48 @@ buildscript { repositories { - mavenLocal() mavenCentral() + maven { url 'https://s01.oss.sonatype.org' } gradlePluginPortal() - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } + mavenLocal() google() + maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } + maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' } } dependencies { } } allprojects { - apply plugin: "eclipse" - version = '1.0' - ext { - appName = "Endless" - gdxVersion = '1.12.1' - gdxAiVersion = '1.8.2' - roboVMVersion = '2.3.20' - box2DLightsVersion = '1.5' - ashleyVersion = '1.7.4' - aiVersion = '1.8.2' - gdxControllersVersion = '2.2.1' - } + apply plugin: 'eclipse' + apply plugin: 'idea' - repositories { - mavenLocal() - mavenCentral() - google() - gradlePluginPortal() - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } - maven { url "https://oss.sonatype.org/content/repositories/releases/" } - maven { url "https://jitpack.io" } + idea { + module { + outputDir file('build/classes/java/main') + testOutputDir file('build/classes/java/test') + } } } -project(":desktop") { - apply plugin: "java-library" - dependencies { - implementation project(":core") - api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion" - api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" +configure(subprojects) { + apply plugin: 'java-library' + sourceCompatibility = 21 + compileJava { + options.incremental = true } } -project(":core") { - apply plugin: "java-library" - dependencies { - api "com.badlogicgames.gdx:gdx:$gdxVersion" - api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" - api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" - api "com.badlogicgames.gdx:gdx-ai:$gdxAiVersion" +subprojects { + version = '$projectVersion' + ext.appName = 'endless-game' + repositories { + mavenCentral() + maven { url 'https://s01.oss.sonatype.org' } + mavenLocal() + maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } + maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' } + maven { url 'https://jitpack.io' } } } + +eclipse.project.name = 'endless-game' + '-parent' diff --git a/core/build.gradle b/core/build.gradle index 01ed732..4f3bae1 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,6 +1,6 @@ -sourceCompatibility = 17 [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' +eclipse.project.name = appName + '-core' -sourceSets.main.java.srcDirs = [ "src/" ] - -eclipse.project.name = appName + "-core" +dependencies { + api "com.badlogicgames.gdx:gdx:$gdxVersion" +} diff --git a/core/src/main/java/org/snoopdesigns/endless/EndlessGame.java b/core/src/main/java/org/snoopdesigns/endless/EndlessGame.java new file mode 100644 index 0000000..53884dd --- /dev/null +++ b/core/src/main/java/org/snoopdesigns/endless/EndlessGame.java @@ -0,0 +1,32 @@ +package org.snoopdesigns.endless; + +import com.badlogic.gdx.ApplicationAdapter; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.utils.ScreenUtils; + +public class EndlessGame extends ApplicationAdapter { + + private SpriteBatch batch; + private Texture image; + + @Override + public void create() { + batch = new SpriteBatch(); + image = new Texture("libgdx.png"); + } + + @Override + public void render() { + ScreenUtils.clear(0.15f, 0.15f, 0.2f, 1f); + batch.begin(); + batch.draw(image, 140, 210); + batch.end(); + } + + @Override + public void dispose() { + batch.dispose(); + image.dispose(); + } +} diff --git a/core/src/org/snoopdesigns/endless/EndlessGame.java b/core/src/org/snoopdesigns/endless/EndlessGame.java deleted file mode 100644 index fc72c66..0000000 --- a/core/src/org/snoopdesigns/endless/EndlessGame.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.snoopdesigns.endless; - -import java.util.List; - -import com.badlogic.gdx.ApplicationAdapter; -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.InputMultiplexer; -import com.badlogic.gdx.utils.ScreenUtils; -import org.snoopdesigns.endless.context.Context; -import org.snoopdesigns.endless.context.OnInit; -import org.snoopdesigns.endless.physics.Box2DDebugRenderer; -import org.snoopdesigns.endless.physics.Box2DRenderer; -import org.snoopdesigns.endless.physics.camera.CameraRenderer; -import org.snoopdesigns.endless.renderer.CursorRenderer; -import org.snoopdesigns.endless.renderer.DebugRenderer; -import org.snoopdesigns.endless.renderer.Renderer; -import org.snoopdesigns.endless.utils.ExitControllable; -import org.snoopdesigns.endless.world.ObjectsRenderer; -import org.snoopdesigns.endless.world.bg.BackgroundRenderer; - -public class EndlessGame extends ApplicationAdapter { - - private final List renderers = List.of( - new BackgroundRenderer(), - new Box2DRenderer(), - new CameraRenderer(), - new Box2DDebugRenderer(), - new ObjectsRenderer(), - new CursorRenderer(), - new DebugRenderer() - ); - - private final List intializers = List.of( - new Context() - ); - - @Override - public void create () { - intializers.forEach(OnInit::create); - - final InputMultiplexer inputMultiplexer = new InputMultiplexer(); - renderers.forEach(inputMultiplexer::addProcessor); - inputMultiplexer.addProcessor(Context.getInstance().getPlayerShip()); - inputMultiplexer.addProcessor(new ExitControllable()); - Gdx.input.setInputProcessor(inputMultiplexer); - - renderers.forEach(Renderer::create); - } - - @Override - public void render () { - ScreenUtils.clear(0, 0, 0, 1); - renderers.forEach(Renderer::render); - } - - @Override - public void resize(int width, int height) { - renderers.forEach(renderer -> - renderer.resize(width, height)); - } - - @Override - public void dispose() { - renderers.forEach(Renderer::dispose); - } -} diff --git a/core/src/org/snoopdesigns/endless/config/Config.java b/core/src/org/snoopdesigns/endless/config/Config.java deleted file mode 100644 index 31b9d0e..0000000 --- a/core/src/org/snoopdesigns/endless/config/Config.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.snoopdesigns.endless.config; - -public final class Config { - private static int screenWidth = 1900; - private static int screenHeight = 1200; - - private Config() { - } - - public static int getScreenWidth() { - return screenWidth; - } - - public static int getScreenHeight() { - return screenHeight; - } -} diff --git a/core/src/org/snoopdesigns/endless/context/Context.java b/core/src/org/snoopdesigns/endless/context/Context.java deleted file mode 100644 index 4081c87..0000000 --- a/core/src/org/snoopdesigns/endless/context/Context.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.snoopdesigns.endless.context; - -import org.snoopdesigns.endless.physics.WorldContext; -import org.snoopdesigns.endless.physics.camera.CameraContext; -import org.snoopdesigns.endless.world.player.PlayerShip; - -public final class Context implements OnInit { - private static Context INSTANCE; - - private CameraContext cameraContext; - private WorldContext worldContext; - private PlayerShip playerShip; - - @Override - public void create() { - INSTANCE = new Context(); - INSTANCE.cameraContext = new CameraContext(); - INSTANCE.worldContext = new WorldContext(); - INSTANCE.playerShip = new PlayerShip(); - } - - public static Context getInstance() { - return INSTANCE; - } - - public CameraContext getCameraContext() { - return cameraContext; - } - - public WorldContext getWorldContext() { - return worldContext; - } - - public PlayerShip getPlayerShip() { - return playerShip; - } -} diff --git a/core/src/org/snoopdesigns/endless/context/OnInit.java b/core/src/org/snoopdesigns/endless/context/OnInit.java deleted file mode 100644 index 7b5678a..0000000 --- a/core/src/org/snoopdesigns/endless/context/OnInit.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.snoopdesigns.endless.context; - -public interface OnInit { - void create(); -} diff --git a/core/src/org/snoopdesigns/endless/input/DefaultInputProcessor.java b/core/src/org/snoopdesigns/endless/input/DefaultInputProcessor.java deleted file mode 100644 index ca3f301..0000000 --- a/core/src/org/snoopdesigns/endless/input/DefaultInputProcessor.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.snoopdesigns.endless.input; - -import com.badlogic.gdx.InputProcessor; - -public interface DefaultInputProcessor extends InputProcessor { - - @Override - default boolean keyDown(int keycode) { - return false; - } - - @Override - default boolean keyUp(int keycode) { - return false; - } - - @Override - default boolean keyTyped(char character) { - return false; - } - - @Override - default boolean touchDown(int screenX, int screenY, int pointer, int button) { - return false; - } - - @Override - default boolean touchUp(int screenX, int screenY, int pointer, int button) { - return false; - } - - @Override - default boolean touchCancelled(int screenX, int screenY, int pointer, int button) { - return false; - } - - @Override - default boolean touchDragged(int screenX, int screenY, int pointer) { - return false; - } - - @Override - default boolean mouseMoved(int screenX, int screenY) { - return false; - } - - @Override - default boolean scrolled(float amountX, float amountY) { - return false; - } -} diff --git a/core/src/org/snoopdesigns/endless/physics/Box2DDebugRenderer.java b/core/src/org/snoopdesigns/endless/physics/Box2DDebugRenderer.java deleted file mode 100644 index 9d7d4dd..0000000 --- a/core/src/org/snoopdesigns/endless/physics/Box2DDebugRenderer.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.snoopdesigns.endless.physics; - -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.graphics.Color; -import com.badlogic.gdx.graphics.g2d.BitmapFont; -import com.badlogic.gdx.graphics.g2d.SpriteBatch; -import com.badlogic.gdx.physics.box2d.Body; -import com.badlogic.gdx.utils.Array; -import org.snoopdesigns.endless.context.Context; -import org.snoopdesigns.endless.renderer.Renderer; - -public class Box2DDebugRenderer implements Renderer { - - private com.badlogic.gdx.physics.box2d.Box2DDebugRenderer debugRenderer; - private BitmapFont font; - private SpriteBatch batch; - - @Override - public void create() { - debugRenderer = new com.badlogic.gdx.physics.box2d.Box2DDebugRenderer(); - debugRenderer.setDrawBodies(true); - debugRenderer.setDrawVelocities(true); - debugRenderer.setDrawAABBs(true); - - font = new BitmapFont(Gdx.files.internal("calibri.fnt"), false); - font.setColor(Color.CYAN); - font.getData().setScale(0.15f); - - batch = new SpriteBatch(); - } - - @Override - public void render() { - debugRenderer.render( - Context.getInstance().getWorldContext().getWorld(), - Context.getInstance().getCameraContext().getCameraProjection()); - - final Array bodies = new Array<>(); - Context.getInstance().getWorldContext().getWorld().getBodies(bodies); - - batch.setProjectionMatrix(Context.getInstance().getCameraContext().getCameraProjection()); - batch.begin(); - bodies.forEach(body -> { - final String debugText = String.format(""" - p %.1f %.1f - a %.1f - s %.1f m/s - v %.1f %.1f - """, - body.getPosition().x, - body.getPosition().y, - body.getAngle(), - body.getLinearVelocity().len(), - body.getLinearVelocity().x, - body.getLinearVelocity().y); - font.draw(batch, debugText, body.getPosition().x + 5f, body.getPosition().y - 5f); - }); - batch.end(); - } - - @Override - public void dispose() { - batch.dispose(); - } -} diff --git a/core/src/org/snoopdesigns/endless/physics/Box2DLocation.java b/core/src/org/snoopdesigns/endless/physics/Box2DLocation.java deleted file mode 100644 index 338b595..0000000 --- a/core/src/org/snoopdesigns/endless/physics/Box2DLocation.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.snoopdesigns.endless.physics; - -import com.badlogic.gdx.ai.utils.Location; -import com.badlogic.gdx.math.Vector2; - -public class Box2DLocation implements Location { - Vector2 position; - float orientation; - - public Box2DLocation () { - this.position = new Vector2(); - this.orientation = 0; - } - - @Override - public Vector2 getPosition () { - return position; - } - - @Override - public float getOrientation () { - return orientation; - } - - @Override - public void setOrientation (float orientation) { - this.orientation = orientation; - } - - @Override - public Location newLocation () { - return new Box2DLocation(); - } - - @Override - public float vectorToAngle (Vector2 vector) { - return (float)Math.atan2(-vector.x, vector.y); - } - - @Override - public Vector2 angleToVector (Vector2 outVector, float angle) { - outVector.x = -(float)Math.sin(angle); - outVector.y = (float)Math.cos(angle); - return outVector; - } -} diff --git a/core/src/org/snoopdesigns/endless/physics/Box2DRenderer.java b/core/src/org/snoopdesigns/endless/physics/Box2DRenderer.java deleted file mode 100644 index 641e397..0000000 --- a/core/src/org/snoopdesigns/endless/physics/Box2DRenderer.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.snoopdesigns.endless.physics; - -import com.badlogic.gdx.physics.box2d.Box2D; -import org.snoopdesigns.endless.context.Context; -import org.snoopdesigns.endless.renderer.Renderer; - -public class Box2DRenderer implements Renderer { - - @Override - public void create() { - Box2D.init(); - } - - @Override - public void render() { - Context.getInstance().getWorldContext().getWorld().step(1/60f, 6, 2); - } - - @Override - public void dispose() { - } -} diff --git a/core/src/org/snoopdesigns/endless/physics/PhysicalBody.java b/core/src/org/snoopdesigns/endless/physics/PhysicalBody.java deleted file mode 100644 index 31204a9..0000000 --- a/core/src/org/snoopdesigns/endless/physics/PhysicalBody.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.snoopdesigns.endless.physics; - -import com.badlogic.gdx.math.Vector2; -import com.badlogic.gdx.physics.box2d.Body; -import com.badlogic.gdx.physics.box2d.BodyDef; -import com.badlogic.gdx.physics.box2d.BodyDef.BodyType; -import com.badlogic.gdx.physics.box2d.FixtureDef; -import com.badlogic.gdx.physics.box2d.MassData; -import org.snoopdesigns.endless.context.Context; - -public abstract class PhysicalBody { - - Body body; - - public abstract BodyType getBodyType(); - public abstract FixtureDef getFixture(); - public abstract float getMass(); - public abstract float getLinearDamping(); - public abstract float getMaxVelocity(); - public Vector2 getInitialPosition() { - return new Vector2(0, 0); - } - - public void initBody() { - final BodyDef bodyDef = new BodyDef(); - bodyDef.type = getBodyType(); - bodyDef.position.set(getInitialPosition()); - body = Context.getInstance().getWorldContext().getWorld().createBody(bodyDef); - body.createFixture(getFixture()); - - final MassData massData = new MassData(); - massData.mass = getMass(); - getBody().setMassData(massData); - - getBody().setLinearDamping(getLinearDamping()); - } - - public void limitVelocity() { - if (getBody().getLinearVelocity().len() > getMaxVelocity()) { - getBody().setLinearVelocity(getBody().getLinearVelocity().limit(getMaxVelocity())); - } - } - - public Body getBody() { - return body; - } -} diff --git a/core/src/org/snoopdesigns/endless/physics/SteerablePhysicalBody.java b/core/src/org/snoopdesigns/endless/physics/SteerablePhysicalBody.java deleted file mode 100644 index 9e9a85c..0000000 --- a/core/src/org/snoopdesigns/endless/physics/SteerablePhysicalBody.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.snoopdesigns.endless.physics; - -import com.badlogic.gdx.ai.steer.Steerable; -import com.badlogic.gdx.ai.utils.Location; -import com.badlogic.gdx.math.Vector2; - -public abstract class SteerablePhysicalBody extends PhysicalBody implements Steerable { - - public abstract float getMaxSpeed(); - public abstract float getMaxAcceleration(); - public abstract float getMaxRotationSpeed(); - public abstract float getMaxRotationAcceleration(); - - @Override - public Vector2 getLinearVelocity() { - return getBody().getLinearVelocity(); - } - - @Override - public float getAngularVelocity() { - return getBody().getAngularVelocity(); - } - - @Override - public float getBoundingRadius() { - return 0.001f; - } - - @Override - public boolean isTagged() { - return false; - } - - @Override - public void setTagged(boolean tagged) { - } - - @Override - public float getZeroLinearSpeedThreshold() { - return 0.1f; - } - - @Override - public void setZeroLinearSpeedThreshold(float value) { - } - - @Override - public float getMaxLinearSpeed() { - return getMaxSpeed(); - } - - @Override - public void setMaxLinearSpeed(float maxLinearSpeed) { - } - - @Override - public float getMaxLinearAcceleration() { - return getMaxAcceleration(); - } - - @Override - public void setMaxLinearAcceleration(float maxLinearAcceleration) { - } - - @Override - public float getMaxAngularSpeed() { - return getMaxRotationSpeed(); - } - - @Override - public void setMaxAngularSpeed(float maxAngularSpeed) { - } - - @Override - public float getMaxAngularAcceleration() { - return getMaxRotationAcceleration(); - } - - @Override - public void setMaxAngularAcceleration(float maxAngularAcceleration) { - } - - @Override - public Vector2 getPosition() { - return getBody().getPosition(); - } - - @Override - public float getOrientation() { - return getBody().getAngle(); - } - - @Override - public void setOrientation(float orientation) { - getBody().setTransform(getPosition(), orientation); - } - - @Override - public float vectorToAngle(Vector2 vector) { - return vector.angleRad(); - } - - @Override - public Vector2 angleToVector(Vector2 outVector, float angle) { - final var tmpVector = new Vector2(1, 0).rotateRad(angle); - outVector.x = tmpVector.x; - outVector.y = tmpVector.y; - return outVector; - } - - @Override - public Location newLocation() { - return new Box2DLocation(); - } -} diff --git a/core/src/org/snoopdesigns/endless/physics/WorldContext.java b/core/src/org/snoopdesigns/endless/physics/WorldContext.java deleted file mode 100644 index 5f10ba8..0000000 --- a/core/src/org/snoopdesigns/endless/physics/WorldContext.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.snoopdesigns.endless.physics; - -import com.badlogic.gdx.math.Vector2; -import com.badlogic.gdx.physics.box2d.World; - -public class WorldContext { - - private final World world; - - public WorldContext() { - this.world = new World(new Vector2(0, 0), true); - } - - public World getWorld() { - return world; - } -} diff --git a/core/src/org/snoopdesigns/endless/physics/camera/CameraContext.java b/core/src/org/snoopdesigns/endless/physics/camera/CameraContext.java deleted file mode 100644 index 635813c..0000000 --- a/core/src/org/snoopdesigns/endless/physics/camera/CameraContext.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.snoopdesigns.endless.physics.camera; - -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.math.Matrix4; -import com.badlogic.gdx.math.Vector2; - -public final class CameraContext { - - private static final float DEFAULT_WORLD_WIDTH = 300.0f; - - private final Vector2 position; - private final Vector2 viewport; - private float zoom; - private Matrix4 cameraProjection; - - public CameraContext() { - final float w = Gdx.graphics.getWidth(); - final float h = Gdx.graphics.getHeight(); - - this.position = new Vector2(0, 0); - this.zoom = 1.0f; - this.viewport = new Vector2(DEFAULT_WORLD_WIDTH, DEFAULT_WORLD_WIDTH * (h / w)); - } - - public Matrix4 getCameraProjection() { - return cameraProjection; - } - - public void setCameraProjection(Matrix4 cameraProjection) { - this.cameraProjection = cameraProjection; - } - - public Vector2 getPosition() { - return position; - } - - public float getZoom() { - return zoom; - } - - public void setZoom(float zoom) { - this.zoom = zoom; - } - - public Vector2 getViewport() { - return viewport; - } -} diff --git a/core/src/org/snoopdesigns/endless/physics/camera/CameraRenderer.java b/core/src/org/snoopdesigns/endless/physics/camera/CameraRenderer.java deleted file mode 100644 index 165240a..0000000 --- a/core/src/org/snoopdesigns/endless/physics/camera/CameraRenderer.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.snoopdesigns.endless.physics.camera; - -import com.badlogic.gdx.graphics.OrthographicCamera; -import com.badlogic.gdx.math.Vector2; -import com.badlogic.gdx.utils.viewport.ExtendViewport; -import com.badlogic.gdx.utils.viewport.Viewport; -import org.snoopdesigns.endless.context.Context; -import org.snoopdesigns.endless.renderer.Renderer; - -public class CameraRenderer implements Renderer { - - private static final float DEFAULT_WORLD_WIDTH = 300.0f; - private static final float DEFAULT_WORLD_HEIGHT = 300.0f; - - private OrthographicCamera camera; - private Viewport viewport; - - @Override - public void create() { - camera = new OrthographicCamera(); - camera.zoom = Context.getInstance().getCameraContext().getZoom(); - viewport = new ExtendViewport( - Context.getInstance().getCameraContext().getViewport().x, - Context.getInstance().getCameraContext().getViewport().y, - camera); - camera.update(); - Context.getInstance().getCameraContext().setCameraProjection(camera.combined); - } - - @Override - public void render() { - final Vector2 cameraPosition = Context.getInstance().getCameraContext().getPosition(); - camera.position.set(cameraPosition.x, cameraPosition.y, 0); - camera.update(); - } - - @Override - public void dispose() { - } - - @Override - public void resize(int width, int height) { - viewport.update(width, height); - Context.getInstance().getCameraContext().getViewport().set( - camera.viewportWidth, - camera.viewportHeight); - } - - @Override - public boolean scrolled(float amountX, float amountY) { - camera.zoom += amountY / 10f; - Context.getInstance().getCameraContext().setZoom(camera.zoom); - return true; - } -} diff --git a/core/src/org/snoopdesigns/endless/renderer/CursorRenderer.java b/core/src/org/snoopdesigns/endless/renderer/CursorRenderer.java deleted file mode 100644 index 05b12f9..0000000 --- a/core/src/org/snoopdesigns/endless/renderer/CursorRenderer.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.snoopdesigns.endless.renderer; - -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.graphics.Cursor; -import com.badlogic.gdx.graphics.Pixmap; - -public class CursorRenderer implements Renderer { - - private Pixmap crosshair; - - @Override - public void create() { - crosshair = new Pixmap(Gdx.files.internal("crosshair.png")); - final Cursor cursor = Gdx.graphics.newCursor(crosshair, - crosshair.getWidth() / 2, - crosshair.getHeight() / 2); - Gdx.graphics.setCursor(cursor); - } - - @Override - public void render() { - - } - - @Override - public void dispose() { - crosshair.dispose(); - } -} diff --git a/core/src/org/snoopdesigns/endless/renderer/DebugRenderer.java b/core/src/org/snoopdesigns/endless/renderer/DebugRenderer.java deleted file mode 100644 index cbf8a07..0000000 --- a/core/src/org/snoopdesigns/endless/renderer/DebugRenderer.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.snoopdesigns.endless.renderer; - -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.graphics.Color; -import com.badlogic.gdx.graphics.g2d.BitmapFont; -import com.badlogic.gdx.graphics.g2d.SpriteBatch; -import org.snoopdesigns.endless.context.Context; - -public class DebugRenderer implements Renderer { - - private BitmapFont font; - private SpriteBatch batch; - - @Override - public void create() { - font = new BitmapFont(Gdx.files.internal("calibri.fnt"), false); - font.setColor(Color.GREEN); - font.getData().setScale(0.7f); - batch = new SpriteBatch(); - } - - @Override - public void render() { - batch.begin(); - final String debugText = String.format(""" - window size %d x %d - viewport %.1f %.1f - zoom %.1f - position %.1f %.1f - angle %.1f - speed %.1f m/s - velocity %.1f %.1f - """, - Gdx.graphics.getWidth(), - Gdx.graphics.getHeight(), - Context.getInstance().getCameraContext().getViewport().x, - Context.getInstance().getCameraContext().getViewport().y, - Context.getInstance().getCameraContext().getZoom(), - Context.getInstance().getCameraContext().getPosition().x, - Context.getInstance().getCameraContext().getPosition().y, - Context.getInstance().getPlayerShip().getBody().getAngle(), - Context.getInstance().getPlayerShip().getBody().getLinearVelocity().len(), - Context.getInstance().getPlayerShip().getBody().getLinearVelocity().x, - Context.getInstance().getPlayerShip().getBody().getLinearVelocity().y); - font.draw(batch, debugText, 10f, 190f); - batch.end(); - } - - @Override - public void dispose() { - font.dispose(); - batch.dispose(); - } -} diff --git a/core/src/org/snoopdesigns/endless/renderer/Renderer.java b/core/src/org/snoopdesigns/endless/renderer/Renderer.java deleted file mode 100644 index a98e36a..0000000 --- a/core/src/org/snoopdesigns/endless/renderer/Renderer.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.snoopdesigns.endless.renderer; - -import org.snoopdesigns.endless.input.DefaultInputProcessor; - -public interface Renderer extends DefaultInputProcessor { - void create(); - void render(); - void dispose(); - default void resize(int width, int height) { - } -} diff --git a/core/src/org/snoopdesigns/endless/utils/ExitControllable.java b/core/src/org/snoopdesigns/endless/utils/ExitControllable.java deleted file mode 100644 index 12469a6..0000000 --- a/core/src/org/snoopdesigns/endless/utils/ExitControllable.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.snoopdesigns.endless.utils; - -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.Input.Keys; -import org.snoopdesigns.endless.world.Controllable; - -public class ExitControllable implements Controllable { - - @Override - public boolean keyDown(int keycode) { - if (keycode == Keys.ESCAPE) { - Gdx.app.exit(); - System.exit(1); - } - return true; - } -} diff --git a/core/src/org/snoopdesigns/endless/world/Controllable.java b/core/src/org/snoopdesigns/endless/world/Controllable.java deleted file mode 100644 index 77f1181..0000000 --- a/core/src/org/snoopdesigns/endless/world/Controllable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.snoopdesigns.endless.world; - -import org.snoopdesigns.endless.input.DefaultInputProcessor; - -public interface Controllable extends DefaultInputProcessor { - -} diff --git a/core/src/org/snoopdesigns/endless/world/ObjectsRenderer.java b/core/src/org/snoopdesigns/endless/world/ObjectsRenderer.java deleted file mode 100644 index 3055532..0000000 --- a/core/src/org/snoopdesigns/endless/world/ObjectsRenderer.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.snoopdesigns.endless.world; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.IntStream; - -import com.badlogic.gdx.graphics.g2d.SpriteBatch; -import org.snoopdesigns.endless.context.Context; -import org.snoopdesigns.endless.renderer.Renderer; -import org.snoopdesigns.endless.world.ship.SteerableEnemyShip; - -public class ObjectsRenderer implements Renderer { - - private final List renderables = new ArrayList<>(); - - private SpriteBatch batch; - - @Override - public void create() { - batch = new SpriteBatch(); - renderables.add(Context.getInstance().getPlayerShip()); - - IntStream.range(0, 3).forEach(i -> - renderables.add(new SteerableEnemyShip())); - - renderables.forEach(Renderable::create); - } - - @Override - public void render() { - batch.setProjectionMatrix(Context.getInstance().getCameraContext().getCameraProjection()); - batch.begin(); - renderables.forEach(renderable -> renderable.render(batch)); - batch.end(); - } - - @Override - public void dispose() { - batch.dispose(); - renderables.forEach(Renderable::dispose); - } -} diff --git a/core/src/org/snoopdesigns/endless/world/Renderable.java b/core/src/org/snoopdesigns/endless/world/Renderable.java deleted file mode 100644 index e5ba159..0000000 --- a/core/src/org/snoopdesigns/endless/world/Renderable.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.snoopdesigns.endless.world; - -import com.badlogic.gdx.graphics.g2d.SpriteBatch; - -public interface Renderable { - void create(); - void render(final SpriteBatch batch); - void dispose(); -} diff --git a/core/src/org/snoopdesigns/endless/world/bg/BackgroundRenderer.java b/core/src/org/snoopdesigns/endless/world/bg/BackgroundRenderer.java deleted file mode 100644 index 094a827..0000000 --- a/core/src/org/snoopdesigns/endless/world/bg/BackgroundRenderer.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.snoopdesigns.endless.world.bg; - -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.Sprite; -import com.badlogic.gdx.graphics.g2d.SpriteBatch; -import org.snoopdesigns.endless.context.Context; -import org.snoopdesigns.endless.renderer.Renderer; - -public class BackgroundRenderer implements Renderer { - - private SpriteBatch batch; - private Sprite bgSprite; - - @Override - public void create() { - batch = new SpriteBatch(); - bgSprite = new Sprite(new Texture(Gdx.files.internal("bg.png"))); - bgSprite.setCenter(0, 0); - bgSprite.setSize(1000, 1000); - } - - @Override - public void render() { - batch.setProjectionMatrix(Context.getInstance().getCameraContext().getCameraProjection()); - batch.begin(); - bgSprite.draw(batch); - batch.end(); - } - - @Override - public void dispose() { - batch.dispose(); - } -} diff --git a/core/src/org/snoopdesigns/endless/world/effects/EngineEffect.java b/core/src/org/snoopdesigns/endless/world/effects/EngineEffect.java deleted file mode 100644 index d6301db..0000000 --- a/core/src/org/snoopdesigns/endless/world/effects/EngineEffect.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.snoopdesigns.endless.world.effects; - -import java.util.LinkedList; -import java.util.Queue; - -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.graphics.g2d.ParticleEffect; -import com.badlogic.gdx.graphics.g2d.SpriteBatch; -import com.badlogic.gdx.math.MathUtils; -import com.badlogic.gdx.math.Vector2; -import org.snoopdesigns.endless.physics.PhysicalBody; -import org.snoopdesigns.endless.world.Renderable; - -public class EngineEffect implements Renderable { - private final Queue effects = new LinkedList<>(); - private final PhysicalBody body; - - public EngineEffect(PhysicalBody body) { - this.body = body; - } - - public void start() { - final ParticleEffect effect = new ParticleEffect(); - effect.load(Gdx.files.internal("particles.p"), Gdx.files.internal("")); - effect.setPosition( - body.getBody().getPosition().x, - body.getBody().getPosition().y); - effect.start(); - effects.add(effect); - } - - public void stop() { - effects.forEach(ParticleEffect::allowCompletion); - } - - @Override - public void create() { - } - - @Override - public void render(SpriteBatch batch) { - final float x = body.getBody().getPosition().x; - final float y = body.getBody().getPosition().y; - - effects.removeIf(ParticleEffect::isComplete); - effects.forEach(effect -> { - final Vector2 effectOffset = new Vector2(-5f, 0f).rotateRad(body.getBody().getAngle()); - effect.setPosition(x + effectOffset.x, y + effectOffset.y); - effect.getEmitters().forEach(emitter -> { - final float effectRotation = MathUtils.radDeg * body.getBody().getAngle(); - emitter.getAngle().setLow(effectRotation); - emitter.getAngle().setHigh(effectRotation); - }); - }); - - effects.forEach(effect -> - effect.draw(batch, Gdx.graphics.getDeltaTime())); - } - - @Override - public void dispose() { - - } -} diff --git a/core/src/org/snoopdesigns/endless/world/player/PlayerShip.java b/core/src/org/snoopdesigns/endless/world/player/PlayerShip.java deleted file mode 100644 index c844c24..0000000 --- a/core/src/org/snoopdesigns/endless/world/player/PlayerShip.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.snoopdesigns.endless.world.player; - -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.Input.Keys; -import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.Sprite; -import com.badlogic.gdx.graphics.g2d.SpriteBatch; -import com.badlogic.gdx.math.MathUtils; -import com.badlogic.gdx.math.Vector2; -import com.badlogic.gdx.physics.box2d.BodyDef.BodyType; -import com.badlogic.gdx.physics.box2d.CircleShape; -import com.badlogic.gdx.physics.box2d.FixtureDef; -import org.snoopdesigns.endless.context.Context; -import org.snoopdesigns.endless.physics.PhysicalBody; -import org.snoopdesigns.endless.world.Controllable; -import org.snoopdesigns.endless.world.Renderable; -import org.snoopdesigns.endless.world.effects.EngineEffect; - -public final class PlayerShip extends PhysicalBody implements Controllable, Renderable { - private Sprite sprite; - private EngineEffect effect; - - @Override - public BodyType getBodyType() { - return BodyType.DynamicBody; - } - - @Override - public FixtureDef getFixture() { - final CircleShape circle = new CircleShape(); - circle.setRadius(5f); - final FixtureDef fixtureDef = new FixtureDef(); - fixtureDef.shape = circle; - return fixtureDef; - } - - @Override - public float getMass() { - return 10000; // 10 tons - } - - @Override - public float getLinearDamping() { - return 1.5f; - } - - @Override - public float getMaxVelocity() { - return 100f; // meters per second - } - - @Override - public void create() { - initBody(); - - final Texture texture = new Texture(Gdx.files.internal("ship.png")); - sprite = new Sprite(texture); - - final float expectedSizeInMeters = 15f; - final Vector2 scale = new Vector2( - expectedSizeInMeters / sprite.getHeight(), - expectedSizeInMeters / sprite.getWidth()); - - sprite.setScale(scale.x, scale.y); - - effect = new EngineEffect(this); - } - - @Override - public void render(SpriteBatch batch) { - handleInput(); - handleMousePosition(); - - final float x = getBody().getPosition().x; - final float y = getBody().getPosition().y; - Context.getInstance().getCameraContext().getPosition().set(x, y); - - sprite.setCenter(x, y); - sprite.setRotation(MathUtils.radDeg * getBody().getAngle()); - - sprite.draw(batch); - effect.render(batch); - - limitVelocity(); - } - - @Override - public void dispose() { - } - - @Override - public boolean keyDown(int keycode) { - if (keycode == Keys.SPACE) { - effect.start(); - return true; - } - return false; - } - - @Override - public boolean keyUp(int keycode) { - if (keycode == Keys.SPACE) { - effect.stop(); - return true; - } - return false; - } - - private void speedUp() { - final float force = getBody().getMass() * 200; // force 200x times more than self mass - final Vector2 impulse = new Vector2(force, 0).rotateRad(getBody().getAngle()); - getBody().applyForceToCenter(impulse, true); - } - - private void handleInput() { - if (Gdx.input.isKeyPressed(Keys.SPACE)) { - speedUp(); - } - } - - private void handleMousePosition() { - final float screenX = Gdx.input.getX(); - final float screenY = Gdx.input.getY(); - final float screenCenterX = (float) Gdx.graphics.getWidth() / 2; - final float screenCenterY = (float) Gdx.graphics.getHeight() / 2; - final float effectiveViewportWidth = Context.getInstance().getCameraContext().getViewport().x * - Context.getInstance().getCameraContext().getZoom(); - final float effectiveViewportHeight = Context.getInstance().getCameraContext().getViewport().y * - Context.getInstance().getCameraContext().getZoom(); - - final float directionX = (screenX - screenCenterX) * (effectiveViewportWidth / Gdx.graphics.getWidth()); - final float directionY = ((Gdx.graphics.getHeight() - screenY) - screenCenterY) * (effectiveViewportHeight / Gdx.graphics.getHeight()); - - final Vector2 direction = new Vector2(directionX, directionY); - float rotationRad = direction.angleRad(); - - float c = 10; //speed of rotation - getBody().setAngularVelocity(c * (angleDifference(rotationRad, getBody().getAngle()))); - } - - public static float angleDifference(float angle1, float angle2) { - float diff = (angle1 - angle2) % (MathUtils.PI * 2); - return diff < -1 * MathUtils.PI ? diff + 2 * MathUtils.PI : diff; - } -} diff --git a/core/src/org/snoopdesigns/endless/world/ship/SteerableEnemyShip.java b/core/src/org/snoopdesigns/endless/world/ship/SteerableEnemyShip.java deleted file mode 100644 index e8d429c..0000000 --- a/core/src/org/snoopdesigns/endless/world/ship/SteerableEnemyShip.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.snoopdesigns.endless.world.ship; - -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.Sprite; -import com.badlogic.gdx.graphics.g2d.SpriteBatch; -import com.badlogic.gdx.math.MathUtils; -import com.badlogic.gdx.math.Vector2; -import com.badlogic.gdx.physics.box2d.BodyDef.BodyType; -import com.badlogic.gdx.physics.box2d.CircleShape; -import com.badlogic.gdx.physics.box2d.FixtureDef; -import org.snoopdesigns.endless.physics.SteerablePhysicalBody; -import org.snoopdesigns.endless.world.Renderable; -import org.snoopdesigns.endless.world.effects.EngineEffect; -import org.snoopdesigns.endless.world.steering.ChaseSteering; -import org.snoopdesigns.endless.world.steering.Steering; -import org.snoopdesigns.endless.world.steering.SteeringApplicator; - -public class SteerableEnemyShip extends SteerablePhysicalBody implements Renderable { - - private Sprite sprite; - private EngineEffect engineEffect; - private Steering steering; - - @Override - public BodyType getBodyType() { - return BodyType.DynamicBody; - } - - @Override - public FixtureDef getFixture() { - final CircleShape circle = new CircleShape(); - circle.setRadius(7f); - final FixtureDef fixtureDef = new FixtureDef(); - fixtureDef.shape = circle; - return fixtureDef; - } - - @Override - public Vector2 getInitialPosition() { - return new Vector2(MathUtils.random(150), MathUtils.random(150)); - } - - @Override - public void create() { - initBody(); - - final Texture texture = new Texture(Gdx.files.internal("ship.png")); - sprite = new Sprite(texture); - final float expectedSizeInMeters = 15f; - final Vector2 scale = new Vector2( - expectedSizeInMeters / sprite.getHeight(), - expectedSizeInMeters / sprite.getWidth()); - sprite.setScale(scale.x, scale.y); - sprite.setRotation(MathUtils.radDeg * getBody().getAngle()); - - engineEffect = new EngineEffect(this); - steering = new ChaseSteering(this, 120f, 90f, new SteeringApplicator() { - - private boolean speedUp = false; - - @Override - public void applyAngularVelocity(float angular) { - getBody().setAngularVelocity(angular); - } - - @Override - public void applyLinearVelocity(Vector2 linear) { - speedUp(linear); - if (!speedUp) { - engineEffect.start(); - } - speedUp = true; - } - - @Override - public void stopLinearVelocity() { - engineEffect.stop(); - speedUp = false; - } - }); - } - @Override - public void render(SpriteBatch batch) { - steering.calculate(); - - sprite.setCenter(getBody().getPosition().x, getBody().getPosition().y); - sprite.setRotation(MathUtils.radDeg * getBody().getAngle()); - sprite.draw(batch); - - engineEffect.render(batch); - - // TODO - limitVelocity(); - } - - @Override - public void dispose() { - } - - private void speedUp(final Vector2 force) { - final float forceToApply = getBody().getMass() * 200; // force 200x times more than self mass - final Vector2 impulse = new Vector2(forceToApply, 0).rotateRad(getBody().getAngle()); - getBody().applyForceToCenter(impulse, true); - } - - @Override - public float getMass() { - return 10000; - } - - @Override - public float getLinearDamping() { - return 1.5f; - } - - @Override - public float getMaxVelocity() { - return getMaxSpeed(); - } - - @Override - public float getMaxSpeed() { - return 90f; - } - - @Override - public float getMaxAcceleration() { - return 50000f; - } - - @Override - public float getMaxRotationSpeed() { - return 5f; - } - - @Override - public float getMaxRotationAcceleration() { - return 5f; - } -} diff --git a/core/src/org/snoopdesigns/endless/world/steering/ChaseSteering.java b/core/src/org/snoopdesigns/endless/world/steering/ChaseSteering.java deleted file mode 100644 index 3ac3ac7..0000000 --- a/core/src/org/snoopdesigns/endless/world/steering/ChaseSteering.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.snoopdesigns.endless.world.steering; - -import java.util.List; - -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.ai.steer.SteeringAcceleration; -import com.badlogic.gdx.ai.steer.SteeringBehavior; -import com.badlogic.gdx.ai.steer.behaviors.Arrive; -import com.badlogic.gdx.ai.steer.behaviors.BlendedSteering; -import com.badlogic.gdx.ai.steer.behaviors.Face; -import com.badlogic.gdx.ai.utils.Location; -import com.badlogic.gdx.math.MathUtils; -import com.badlogic.gdx.math.Vector2; -import org.snoopdesigns.endless.context.Context; -import org.snoopdesigns.endless.physics.Box2DLocation; -import org.snoopdesigns.endless.physics.SteerablePhysicalBody; - -public class ChaseSteering implements Steering { - - private final SteeringAcceleration steeringOutput = new SteeringAcceleration<>(new Vector2()); - private final BlendedSteering steeringCombination; - private final Location positionTarget; - private final Location faceTarget; - private final SteeringApplicator steeringApplicator; - private final SteerablePhysicalBody steerablePhysicalBody; - private final Vector2 lastVelocity = new Vector2(0f, 0f); - private final float maxDistance; - private final float minDistance; - private float targetDirection; - - public ChaseSteering(final SteerablePhysicalBody steerablePhysicalBody, - final float maxDistance, - final float minDistance, - final SteeringApplicator steeringApplicator) { - this.steerablePhysicalBody = steerablePhysicalBody; - this.maxDistance = maxDistance; - this.minDistance = minDistance; - this.steeringApplicator = steeringApplicator; - - positionTarget = new Box2DLocation(); - faceTarget = new Box2DLocation(); - - steeringCombination = new BlendedSteering<>(steerablePhysicalBody); - getSteeringBehaviours().forEach(steeringBehaviour -> - steeringCombination.add(steeringBehaviour, 0.5f)); - - targetDirection = MathUtils.random(MathUtils.PI2); - } - - @Override - public void calculate() { - final Vector2 targetDisplacement = new Vector2(maxDistance, 0f).rotateRad(targetDirection); - final float distanceToPlayer = new Vector2( - steerablePhysicalBody.getBody().getPosition().x - - Context.getInstance().getPlayerShip().getBody().getPosition().x, - steerablePhysicalBody.getBody().getPosition().y - - Context.getInstance().getPlayerShip().getBody().getPosition().y) - .len(); - if (distanceToPlayer > maxDistance + 10f) { - // Rotate target rotation point only of player is far away - targetDirection += Gdx.graphics.getDeltaTime() / 1f; - } - final Vector2 displacement = targetDisplacement.limit(Math.max(0, (distanceToPlayer - minDistance))); - final Vector2 targetPos = new Vector2( - Context.getInstance().getPlayerShip().getBody().getPosition().x + displacement.x, - Context.getInstance().getPlayerShip().getBody().getPosition().y + displacement.y); - - positionTarget.getPosition().set(targetPos); - faceTarget.getPosition().set(positionTarget.getPosition()); - - steeringCombination.calculateSteering(steeringOutput); - if (distanceToPlayer <= minDistance) { // do not move, if close to player, only rotate - steeringOutput.linear.setZero(); - } - - applySteering(); - } - - private void applySteering() { - // Update position and linear velocity. - if (steeringOutput.angular != 0) { - // this method internally scales the torque by deltaTime - steeringApplicator.applyAngularVelocity(steeringOutput.angular); - } - - if (!steeringOutput.linear.isZero()) { - if (steeringOutput.linear.len() >= lastVelocity.len() - 10) { - steeringApplicator.applyLinearVelocity(steeringOutput.linear); - } else { - steeringApplicator.stopLinearVelocity(); - } - lastVelocity.x = steeringOutput.linear.x; - lastVelocity.y = steeringOutput.linear.y; - } else { - steeringApplicator.stopLinearVelocity(); - } - } - - private List> getSteeringBehaviours() { - return List.of( - new Face<>(steerablePhysicalBody, faceTarget), - new Arrive<>(steerablePhysicalBody, positionTarget) - .setTimeToTarget(0.1f) - .setArrivalTolerance(10f) - .setDecelerationRadius(100f) - ); - } -} diff --git a/core/src/org/snoopdesigns/endless/world/steering/Steering.java b/core/src/org/snoopdesigns/endless/world/steering/Steering.java deleted file mode 100644 index c13b575..0000000 --- a/core/src/org/snoopdesigns/endless/world/steering/Steering.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.snoopdesigns.endless.world.steering; - -public interface Steering { - void calculate(); -} diff --git a/core/src/org/snoopdesigns/endless/world/steering/SteeringApplicator.java b/core/src/org/snoopdesigns/endless/world/steering/SteeringApplicator.java deleted file mode 100644 index d683465..0000000 --- a/core/src/org/snoopdesigns/endless/world/steering/SteeringApplicator.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.snoopdesigns.endless.world.steering; - -import com.badlogic.gdx.math.Vector2; - -public interface SteeringApplicator { - void applyAngularVelocity(float angular); - void applyLinearVelocity(Vector2 linear); - void stopLinearVelocity(); -} diff --git a/desktop/build.gradle b/desktop/build.gradle index cd2a88a..9fc469d 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -1,49 +1,73 @@ -sourceCompatibility = 17 -sourceSets.main.java.srcDirs = [ "src/" ] -sourceSets.main.resources.srcDirs = ["../assets"] - -project.ext.mainClassName = "org.snoopdesigns.endless.DesktopLauncher" -project.ext.assetsDir = new File("../assets") - -import org.gradle.internal.os.OperatingSystem - -tasks.register('run', JavaExec) { - dependsOn classes - mainClass = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - workingDir = project.assetsDir - ignoreExitValue = true - - if (OperatingSystem.current() == OperatingSystem.MAC_OS) { - // Required to run on macOS - jvmArgs += "-XstartOnFirstThread" +buildscript { + repositories { + gradlePluginPortal() } + dependencies { + } +} + +plugins { + id "application" +} + +sourceSets.main.resources.srcDirs += [rootProject.file('assets').path] +mainClassName = 'org.snoopdesigns.endless.desktop.DesktopLauncher' +application.setMainClass(mainClassName) +eclipse.project.name = appName + '-desktop' +java.sourceCompatibility = 21 +java.targetCompatibility = 21 +if (JavaVersion.current().isJava9Compatible()) { + compileJava.options.release.set(21) +} + +dependencies { + implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion" + implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + implementation project(':core') } -tasks.register('debug', JavaExec) { - dependsOn classes - mainClass = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - workingDir = project.assetsDir - ignoreExitValue = true - debug = true +def os = System.properties['os.name'].toLowerCase() + +run { + workingDir = rootProject.file('assets').path + setIgnoreExitValue(true) } -tasks.register('dist', Jar) { +jar { + archiveFileName.set("${appName}-${projectVersion}.jar") duplicatesStrategy(DuplicatesStrategy.EXCLUDE) + dependsOn configurations.runtimeClasspath + from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } + exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA') + dependencies { + exclude('META-INF/INDEX.LIST', 'META-INF/maven/**') + } manifest { attributes 'Main-Class': project.mainClassName } - dependsOn configurations.runtimeClasspath - from { - configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } + doLast { + file(archiveFile).setExecutable(true, false) } - with jar } +// Equivalent to the jar task; here for compatibility with gdx-setup. +tasks.register('dist') { + dependsOn 'jar' +} -dist.dependsOn classes +distributions { + main { + contents { + into('libs') { + project.configurations.runtimeClasspath.files.findAll { file -> + file.getName() != project.tasks.jar.outputs.files.singleFile.name + }.each { file -> + exclude file.name + } + } + } + } +} -eclipse.project.name = appName + "-desktop" +startScripts.dependsOn(':desktop:jar') +startScripts.classpath = project.tasks.jar.outputs.files \ No newline at end of file diff --git a/desktop/src/main/java/org/snoopdesigns/endless/desktop/DesktopLauncher.java b/desktop/src/main/java/org/snoopdesigns/endless/desktop/DesktopLauncher.java new file mode 100644 index 0000000..6aaa364 --- /dev/null +++ b/desktop/src/main/java/org/snoopdesigns/endless/desktop/DesktopLauncher.java @@ -0,0 +1,26 @@ +package org.snoopdesigns.endless.desktop; + +import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application; +import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; +import org.snoopdesigns.endless.EndlessGame; + +public class DesktopLauncher { + + public static void main(String[] args) { + createApplication(); + } + + private static Lwjgl3Application createApplication() { + return new Lwjgl3Application(new EndlessGame(), + getDefaultConfiguration()); + } + + private static Lwjgl3ApplicationConfiguration getDefaultConfiguration() { + Lwjgl3ApplicationConfiguration configuration = new Lwjgl3ApplicationConfiguration(); + configuration.setTitle("endless-game"); + configuration.useVsync(true); + configuration.setForegroundFPS(Lwjgl3ApplicationConfiguration.getDisplayMode().refreshRate + 1); + configuration.setWindowedMode(640, 480); + return configuration; + } +} \ No newline at end of file diff --git a/desktop/src/org/snoopdesigns/endless/DesktopLauncher.java b/desktop/src/org/snoopdesigns/endless/DesktopLauncher.java deleted file mode 100644 index 3ece708..0000000 --- a/desktop/src/org/snoopdesigns/endless/DesktopLauncher.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.snoopdesigns.endless; - -import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application; -import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; -import org.snoopdesigns.endless.config.Config; - -public final class DesktopLauncher { - - private final static String TITLE = "Endless"; - - private DesktopLauncher() { - } - - public static void main(String[] arg) { - Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration(); - config.setForegroundFPS(60); - config.setTitle(TITLE); - config.useVsync(true); - config.setWindowedMode(Config.getScreenWidth(), Config.getScreenHeight()); - //config.setFullscreenMode(Lwjgl3ApplicationConfiguration.getDisplayMode()); - new Lwjgl3Application(new EndlessGame(), config); - } -} diff --git a/gradle.properties b/gradle.properties index c5aae14..8310d5b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,7 @@ -org.gradle.daemon=true -org.gradle.jvmargs=-Xms128m -Xmx1500m +org.gradle.daemon=false +org.gradle.jvmargs=-Xms512M -Xmx1G -Dfile.encoding=UTF-8 -Dconsole.encoding=UTF-8 org.gradle.configureondemand=false -android.enableR8.fullMode=false +gwtFrameworkVersion=2.11.0 +gwtPluginVersion=1.1.29 +gdxVersion=1.12.1 +projectVersion=1.0.0 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1af9e09..e2847c8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 index 1aa94a4..f5feea6 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat old mode 100644 new mode 100755 index 93e3f59..9d21a21 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/settings.gradle b/settings.gradle index 74fc652..92d54c1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include 'desktop', 'core' \ No newline at end of file +include 'desktop', 'core' -- cgit v1.2.3