initial commit
18
.editorconfig
Normal file
@@ -0,0 +1,18 @@
|
||||
# https://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{java,scala,groovy,kt,kts}]
|
||||
indent_size = 4
|
||||
|
||||
[*.gradle]
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
* text=auto eol=lf
|
||||
*.bat text=auto eol=crlf
|
||||
165
.gitignore
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
## Gradle:
|
||||
.gradle/
|
||||
gradle-app.setting
|
||||
/build/
|
||||
/android/build/
|
||||
/core/build/
|
||||
/lwjgl2/build/
|
||||
/lwjgl3/build/
|
||||
/html/build/
|
||||
/teavm/build/
|
||||
/ios/build/
|
||||
/ios-moe/build/
|
||||
/headless/build/
|
||||
/server/build/
|
||||
/shared/build/
|
||||
/util/build/
|
||||
|
||||
## Java:
|
||||
*.class
|
||||
*.war
|
||||
*.ear
|
||||
hs_err_pid*
|
||||
.attach_pid*
|
||||
|
||||
## Android:
|
||||
/android/libs/armeabi-v7a/
|
||||
/android/libs/arm64-v8a/
|
||||
/android/libs/x86/
|
||||
/android/libs/x86_64/
|
||||
/android/gen/
|
||||
/android/out/
|
||||
local.properties
|
||||
com_crashlytics_export_strings.xml
|
||||
|
||||
## Robovm:
|
||||
/ios/robovm-build/
|
||||
|
||||
## iOS:
|
||||
/ios/xcode/*.xcodeproj/*
|
||||
!/ios/xcode/*.xcodeproj/xcshareddata
|
||||
!/ios/xcode/*.xcodeproj/project.pbxproj
|
||||
/ios/xcode/native/
|
||||
/ios/IOSLauncher.app
|
||||
/ios/IOSLauncher.app.dSYM
|
||||
|
||||
## GWT:
|
||||
/html/war/
|
||||
/html/gwt-unitCache/
|
||||
.apt_generated/
|
||||
/html/war/WEB-INF/deploy/
|
||||
/html/war/WEB-INF/classes/
|
||||
.gwt/
|
||||
gwt-unitCache/
|
||||
www-test/
|
||||
.gwt-tmp/
|
||||
|
||||
## TeaVM:
|
||||
# Not sure yet...
|
||||
|
||||
## IntelliJ, Android Studio:
|
||||
.idea/
|
||||
*.ipr
|
||||
*.iws
|
||||
*.iml
|
||||
|
||||
## Eclipse:
|
||||
.classpath
|
||||
.project
|
||||
.metadata/
|
||||
/android/bin/
|
||||
/core/bin/
|
||||
/lwjgl2/bin/
|
||||
/lwjgl3/bin/
|
||||
/html/bin/
|
||||
/teavm/bin/
|
||||
/ios/bin/
|
||||
/ios-moe/bin/
|
||||
/headless/bin/
|
||||
/server/bin/
|
||||
/shared/bin/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
.settings/
|
||||
.loadpath
|
||||
.externalToolBuilders/
|
||||
*.launch
|
||||
|
||||
|
||||
## NetBeans:
|
||||
|
||||
/nbproject/private/
|
||||
/android/nbproject/private/
|
||||
/core/nbproject/private/
|
||||
/lwjgl2/nbproject/private/
|
||||
/lwjgl3/nbproject/private/
|
||||
/html/nbproject/private/
|
||||
/teavm/nbproject/private/
|
||||
/ios/nbproject/private/
|
||||
/ios-moe/nbproject/private/
|
||||
/headless/nbproject/private/
|
||||
/server/nbproject/private/
|
||||
/shared/nbproject/private/
|
||||
|
||||
/nbbuild/
|
||||
/android/nbbuild/
|
||||
/core/nbbuild/
|
||||
/lwjgl2/nbbuild/
|
||||
/lwjgl3/nbbuild/
|
||||
/html/nbbuild/
|
||||
/teavm/nbbuild/
|
||||
/ios/nbbuild/
|
||||
/ios-moe/nbbuild/
|
||||
/headless/nbbuild/
|
||||
/server/nbbuild/
|
||||
/shared/nbbuild/
|
||||
|
||||
/dist/
|
||||
/android/dist/
|
||||
/core/dist/
|
||||
/lwjgl2/dist/
|
||||
/lwjgl3/dist/
|
||||
/html/dist/
|
||||
/teavm/dist/
|
||||
/ios/dist/
|
||||
/ios-moe/dist/
|
||||
/headless/dist/
|
||||
/server/dist/
|
||||
/shared/dist/
|
||||
|
||||
/nbdist/
|
||||
/android/nbdist/
|
||||
/core/nbdist/
|
||||
/lwjgl2/nbdist/
|
||||
/lwjgl3/nbdist/
|
||||
/html/nbdist/
|
||||
/teavm/nbdist/
|
||||
/ios/nbdist/
|
||||
/ios-moe/nbdist/
|
||||
/headless/nbdist/
|
||||
/server/nbdist/
|
||||
/shared/nbdist/
|
||||
|
||||
nbactions.xml
|
||||
nb-configuration.xml
|
||||
|
||||
## OS-Specific:
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
## Miscellaneous:
|
||||
*~
|
||||
*.*#
|
||||
*#*#
|
||||
/.kotlin/
|
||||
/assets/assets.txt
|
||||
|
||||
## Special cases:
|
||||
|
||||
## There is a resource-config.json file generated by nativeimage.gradle if you use Graal Native Image.
|
||||
## Some usage may need extra resource configuration in a different file with the same name.
|
||||
## You could also add that configuration to the text in nativeimage.gradle .
|
||||
## You should delete or comment out the next line if you have configuration in a different resource-config.json .
|
||||
**/resource-config.json
|
||||
1
README.md
Normal file
@@ -0,0 +1 @@
|
||||
https://opengameart.org/content/dungeon-crawl-32x32-tiles
|
||||
24
assets/maps/mainmap.tmx
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.11.1-99-gec89c545" orientation="orthogonal" renderorder="right-down" width="18" height="16" tilewidth="32" tileheight="32" infinite="0" nextlayerid="5" nextobjectid="1">
|
||||
<tileset firstgid="1" source="tileset.tsx"/>
|
||||
<layer id="1" name="ground" width="18" height="16">
|
||||
<data encoding="base64" compression="zlib">
|
||||
eJxdk2sOhCAMhL0CElBQdt3X/a+4NZkvmfBj0gq0005rW5YlB7owArv8NZCEIrvqvsg/Aqf8Kp/3h+wr8Axcyr+Jc1iOrrg7R9M59WTl+QbegY9ihviyajp1Rq27LL0dwiaOpBj6bbrrsvukTdU5vMR340cbfHoZVkNWrjT10ezb+cg1pvfV5kHepJgii9bF+iqmGTOm92b8zJj5NntfTGefb7P8RTUC36tNZ8z+fv8LPITLZsAuVdOFGunptH7ZE3aFWWfrEc7d7tkZ9GW3mQ21kIfdpZZk+dkj8lTj8H8G7tUs2rs+8LRpVsdUu/+D6O4zJR/7Chd7wi6gJ5zd4nzHZi2HQE3ZfPRijvf3Hx87GuI=
|
||||
</data>
|
||||
</layer>
|
||||
<layer id="3" name="water" width="18" height="16">
|
||||
<data encoding="base64" compression="zlib">
|
||||
eJxjYBgFpABNINZFwlpkmqONxtcbROboALEGmeaoQ/VTYsYoGDkAAGtRArM=
|
||||
</data>
|
||||
</layer>
|
||||
<layer id="4" name="water2" width="18" height="16">
|
||||
<data encoding="base64" compression="zlib">
|
||||
eJxjYBgFowAV6A20A0bBiAEAc+gALw==
|
||||
</data>
|
||||
</layer>
|
||||
<layer id="2" name="props" width="18" height="16">
|
||||
<data encoding="base64" compression="zlib">
|
||||
eJyzZmBgsIRiKyQ2DFszEAcsCcjbEGmOFZQ2p9AcQu4h1l+E1FkRkIcBbO7RR8LEugebfcjmEPI3Me7BJU+sOaTIwwAtwxkELAjIk2ofuemHEY1PrXCmJP2QIo+sDlY+4GITAwB37wxQ
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
||||
14
assets/maps/mystic.tiled-project
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"automappingRulesFile": "",
|
||||
"commands": [
|
||||
],
|
||||
"compatibilityVersion": 1100,
|
||||
"extensionsPath": "extensions",
|
||||
"folders": [
|
||||
"."
|
||||
],
|
||||
"properties": [
|
||||
],
|
||||
"propertyTypes": [
|
||||
]
|
||||
}
|
||||
42
assets/maps/mystic.tiled-session
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"Map/SizeTest": {
|
||||
"height": 4300,
|
||||
"width": 2
|
||||
},
|
||||
"activeFile": "mainmap.tmx",
|
||||
"expandedProjectPaths": [
|
||||
"."
|
||||
],
|
||||
"fileStates": {
|
||||
"mainmap.tmx": {
|
||||
"scale": 1.74265625,
|
||||
"selectedLayer": 3,
|
||||
"viewCenter": {
|
||||
"x": 191.94835470277056,
|
||||
"y": 356.35255088317047
|
||||
}
|
||||
},
|
||||
"tileset.tsx": {
|
||||
"scaleInDock": 1,
|
||||
"scaleInEditor": 1
|
||||
}
|
||||
},
|
||||
"frame.defaultDuration": 250,
|
||||
"last.imagePath": "/home/gaja/IdeaProjects/mystictutorial/assets/maps",
|
||||
"map.height": 14,
|
||||
"map.lastUsedFormat": "tmx",
|
||||
"map.layerDataFormat": null,
|
||||
"map.width": 20,
|
||||
"openFiles": [
|
||||
"mainmap.tmx",
|
||||
"tileset.tsx"
|
||||
],
|
||||
"project": "mystic.tiled-project",
|
||||
"recentFiles": [
|
||||
"tileset.tsx",
|
||||
"mainmap.tmx"
|
||||
],
|
||||
"tileset.lastUsedFormat": "tsx",
|
||||
"tileset.margin": 4,
|
||||
"tileset.spacing": 8
|
||||
}
|
||||
426
assets/maps/tileset.atlas
Normal file
@@ -0,0 +1,426 @@
|
||||
|
||||
tileset.png
|
||||
size: 512, 256
|
||||
format: RGBA8888
|
||||
filter: Nearest, Nearest
|
||||
repeat: none
|
||||
boulder
|
||||
rotate: false
|
||||
xy: 2, 2
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
dirt/dirt_0_new
|
||||
rotate: false
|
||||
xy: 38, 2
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
dirt/dirt_1_new
|
||||
rotate: false
|
||||
xy: 74, 2
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
dirt/dirt_2_new
|
||||
rotate: false
|
||||
xy: 110, 2
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
dirt/dirt_east_new
|
||||
rotate: false
|
||||
xy: 146, 2
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
dirt/dirt_full_new
|
||||
rotate: false
|
||||
xy: 182, 2
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
dirt/dirt_north_new
|
||||
rotate: false
|
||||
xy: 218, 2
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
dirt/dirt_northeast_new
|
||||
rotate: false
|
||||
xy: 254, 2
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
dirt/dirt_northwest_new
|
||||
rotate: false
|
||||
xy: 290, 2
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
dirt/dirt_south_new
|
||||
rotate: false
|
||||
xy: 326, 2
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
dirt/dirt_southeast_new
|
||||
rotate: false
|
||||
xy: 362, 2
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
dirt/dirt_southwest_new
|
||||
rotate: false
|
||||
xy: 398, 2
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
dirt/dirt_west_new
|
||||
rotate: false
|
||||
xy: 434, 2
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass0-dirt-mix
|
||||
rotate: false
|
||||
xy: 470, 2
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: 1
|
||||
grass/grass0-dirt-mix
|
||||
rotate: false
|
||||
xy: 2, 38
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: 2
|
||||
grass/grass0-dirt-mix
|
||||
rotate: false
|
||||
xy: 38, 38
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: 3
|
||||
grass/grass_0_new
|
||||
rotate: false
|
||||
xy: 74, 38
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_1_new
|
||||
rotate: false
|
||||
xy: 110, 38
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_2_new
|
||||
rotate: false
|
||||
xy: 146, 38
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_east_new
|
||||
rotate: false
|
||||
xy: 182, 38
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_flowers_blue_1_new
|
||||
rotate: false
|
||||
xy: 218, 38
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_flowers_blue_2_new
|
||||
rotate: false
|
||||
xy: 254, 38
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_flowers_blue_3_new
|
||||
rotate: false
|
||||
xy: 290, 38
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_flowers_red_1_new
|
||||
rotate: false
|
||||
xy: 326, 38
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_flowers_red_2_new
|
||||
rotate: false
|
||||
xy: 362, 38
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_flowers_red_3_new
|
||||
rotate: false
|
||||
xy: 398, 38
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_flowers_yellow_1_new
|
||||
rotate: false
|
||||
xy: 434, 38
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_flowers_yellow_2_new
|
||||
rotate: false
|
||||
xy: 470, 38
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_flowers_yellow_3_new
|
||||
rotate: false
|
||||
xy: 2, 74
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_full_new
|
||||
rotate: false
|
||||
xy: 38, 74
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_north_new
|
||||
rotate: false
|
||||
xy: 74, 74
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_northeast_new
|
||||
rotate: false
|
||||
xy: 110, 74
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_northwest_new
|
||||
rotate: false
|
||||
xy: 146, 74
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_south_new
|
||||
rotate: false
|
||||
xy: 182, 74
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_southeast_new
|
||||
rotate: false
|
||||
xy: 218, 74
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_southwest_new
|
||||
rotate: false
|
||||
xy: 254, 74
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
grass/grass_west_new
|
||||
rotate: false
|
||||
xy: 290, 74
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
portal
|
||||
rotate: false
|
||||
xy: 326, 74
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
statue_cat
|
||||
rotate: false
|
||||
xy: 434, 110
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
statue_wraith
|
||||
rotate: false
|
||||
xy: 470, 110
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
tree/tree
|
||||
rotate: false
|
||||
xy: 2, 146
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: 1
|
||||
tree/tree
|
||||
rotate: false
|
||||
xy: 38, 146
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: 2
|
||||
tree/tree
|
||||
rotate: false
|
||||
xy: 74, 146
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: 3
|
||||
tree/tree
|
||||
rotate: false
|
||||
xy: 110, 146
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: 4
|
||||
water/shallow_water_wave_corner_northeast_new
|
||||
rotate: false
|
||||
xy: 362, 74
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
water/shallow_water_wave_corner_northwest_new
|
||||
rotate: false
|
||||
xy: 398, 74
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
water/shallow_water_wave_corner_southeast_new
|
||||
rotate: false
|
||||
xy: 434, 74
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
water/shallow_water_wave_corner_southwest_new
|
||||
rotate: false
|
||||
xy: 470, 74
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
water/shallow_water_wave_east_new
|
||||
rotate: false
|
||||
xy: 2, 110
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
water/shallow_water_wave_north_new
|
||||
rotate: false
|
||||
xy: 38, 110
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
water/shallow_water_wave_south_new
|
||||
rotate: false
|
||||
xy: 74, 110
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
water/shallow_water_wave_west_new
|
||||
rotate: false
|
||||
xy: 110, 110
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
water/shoals_shallow_water
|
||||
rotate: false
|
||||
xy: 146, 110
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: 0
|
||||
water/shoals_shallow_water
|
||||
rotate: false
|
||||
xy: 182, 110
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: 5
|
||||
water/shoals_shallow_water
|
||||
rotate: false
|
||||
xy: 218, 110
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: 6
|
||||
water/shoals_shallow_water
|
||||
rotate: false
|
||||
xy: 254, 110
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: 7
|
||||
water/shoals_shallow_water
|
||||
rotate: false
|
||||
xy: 290, 110
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: 8
|
||||
water/shoals_shallow_water
|
||||
rotate: false
|
||||
xy: 326, 110
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: 9
|
||||
water/shoals_shallow_water
|
||||
rotate: false
|
||||
xy: 362, 110
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: 10
|
||||
water/shoals_shallow_water
|
||||
rotate: false
|
||||
xy: 398, 110
|
||||
size: 32, 32
|
||||
orig: 32, 32
|
||||
offset: 0, 0
|
||||
index: 11
|
||||
BIN
assets/maps/tileset.png
Normal file
|
After Width: | Height: | Size: 98 KiB |
14
assets/maps/tileset.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tileset version="1.10" tiledversion="1.11.1-99-gec89c545" name="tileset" tilewidth="32" tileheight="32" spacing="4" margin="2" tilecount="98" columns="14">
|
||||
<image source="tileset.png" width="512" height="256"/>
|
||||
<tile id="46">
|
||||
<animation>
|
||||
<frame tileid="46" duration="250"/>
|
||||
<frame tileid="47" duration="250"/>
|
||||
<frame tileid="48" duration="250"/>
|
||||
<frame tileid="49" duration="250"/>
|
||||
<frame tileid="48" duration="250"/>
|
||||
<frame tileid="47" duration="250"/>
|
||||
</animation>
|
||||
</tile>
|
||||
</tileset>
|
||||
BIN
assets_raw/hero.png
Normal file
|
After Width: | Height: | Size: 141 KiB |
BIN
assets_raw/map.png
Normal file
|
After Width: | Height: | Size: 149 KiB |
BIN
assets_raw/map/boulder.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
assets_raw/map/dirt/dirt_0_new.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
assets_raw/map/dirt/dirt_1_new.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
assets_raw/map/dirt/dirt_2_new.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
assets_raw/map/dirt/dirt_east_new.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
assets_raw/map/dirt/dirt_full_new.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
assets_raw/map/dirt/dirt_north_new.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
assets_raw/map/dirt/dirt_northeast_new.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
assets_raw/map/dirt/dirt_northwest_new.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
assets_raw/map/dirt/dirt_south_new.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
assets_raw/map/dirt/dirt_southeast_new.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
assets_raw/map/dirt/dirt_southwest_new.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
assets_raw/map/dirt/dirt_west_new.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
assets_raw/map/grass/grass0-dirt-mix_1.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
assets_raw/map/grass/grass0-dirt-mix_2.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
assets_raw/map/grass/grass0-dirt-mix_3.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
assets_raw/map/grass/grass_0_new.png
Normal file
|
After Width: | Height: | Size: 849 B |
BIN
assets_raw/map/grass/grass_1_new.png
Normal file
|
After Width: | Height: | Size: 863 B |
BIN
assets_raw/map/grass/grass_2_new.png
Normal file
|
After Width: | Height: | Size: 854 B |
BIN
assets_raw/map/grass/grass_east_new.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
assets_raw/map/grass/grass_flowers_blue_1_new.png
Normal file
|
After Width: | Height: | Size: 855 B |
BIN
assets_raw/map/grass/grass_flowers_blue_2_new.png
Normal file
|
After Width: | Height: | Size: 860 B |
BIN
assets_raw/map/grass/grass_flowers_blue_3_new.png
Normal file
|
After Width: | Height: | Size: 855 B |
BIN
assets_raw/map/grass/grass_flowers_red_1_new.png
Normal file
|
After Width: | Height: | Size: 858 B |
BIN
assets_raw/map/grass/grass_flowers_red_2_new.png
Normal file
|
After Width: | Height: | Size: 859 B |
BIN
assets_raw/map/grass/grass_flowers_red_3_new.png
Normal file
|
After Width: | Height: | Size: 878 B |
BIN
assets_raw/map/grass/grass_flowers_yellow_1_new.png
Normal file
|
After Width: | Height: | Size: 869 B |
BIN
assets_raw/map/grass/grass_flowers_yellow_2_new.png
Normal file
|
After Width: | Height: | Size: 868 B |
BIN
assets_raw/map/grass/grass_flowers_yellow_3_new.png
Normal file
|
After Width: | Height: | Size: 862 B |
BIN
assets_raw/map/grass/grass_full_new.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
assets_raw/map/grass/grass_north_new.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
assets_raw/map/grass/grass_northeast_new.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
assets_raw/map/grass/grass_northwest_new.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
assets_raw/map/grass/grass_south_new.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
assets_raw/map/grass/grass_southeast_new.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
assets_raw/map/grass/grass_southwest_new.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
assets_raw/map/grass/grass_west_new.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
36
assets_raw/map/pack.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"pot": true,
|
||||
"paddingX": 4,
|
||||
"paddingY": 4,
|
||||
"bleed": true,
|
||||
"edgePadding": true,
|
||||
"duplicatePadding": true,
|
||||
"rotation": false,
|
||||
"minWidth": 16,
|
||||
"minHeight": 16,
|
||||
"maxWidth": 512,
|
||||
"maxHeight": 512,
|
||||
"square": false,
|
||||
"stripWhitespaceX": false,
|
||||
"stripWhitespaceY": false,
|
||||
"alphaThreshold": 0,
|
||||
"filterMin": "Nearest",
|
||||
"filterMag": "Nearest",
|
||||
"wrapX": "ClampToEdge",
|
||||
"wrapY": "ClampToEdge",
|
||||
"format": "RGBA8888",
|
||||
"alias": true,
|
||||
"outputFormat": "png",
|
||||
"jpegQuality": 0.9,
|
||||
"ignoreBlankImages": true,
|
||||
"fast": false,
|
||||
"debug": false,
|
||||
"combineSubdirectories": true,
|
||||
"flattenPaths": false,
|
||||
"premultiplyAlpha": false,
|
||||
"useIndexes": true,
|
||||
"limitMemory": true,
|
||||
"grid": true,
|
||||
"scale": [1],
|
||||
"scaleSuffix": [""]
|
||||
}
|
||||
BIN
assets_raw/map/portal.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
assets_raw/map/statue_cat.png
Normal file
|
After Width: | Height: | Size: 338 B |
BIN
assets_raw/map/statue_wraith.png
Normal file
|
After Width: | Height: | Size: 369 B |
BIN
assets_raw/map/tree/tree_1.png
Normal file
|
After Width: | Height: | Size: 999 B |
BIN
assets_raw/map/tree/tree_2.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
assets_raw/map/tree/tree_3.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
assets_raw/map/tree/tree_4.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
assets_raw/map/water/shallow_water_wave_corner_northeast_new.png
Normal file
|
After Width: | Height: | Size: 535 B |
BIN
assets_raw/map/water/shallow_water_wave_corner_northwest_new.png
Normal file
|
After Width: | Height: | Size: 553 B |
BIN
assets_raw/map/water/shallow_water_wave_corner_southeast_new.png
Normal file
|
After Width: | Height: | Size: 495 B |
BIN
assets_raw/map/water/shallow_water_wave_corner_southwest_new.png
Normal file
|
After Width: | Height: | Size: 569 B |
BIN
assets_raw/map/water/shallow_water_wave_east_new.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
assets_raw/map/water/shallow_water_wave_north_new.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
assets_raw/map/water/shallow_water_wave_south_new.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
assets_raw/map/water/shallow_water_wave_west_new.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
assets_raw/map/water/shoals_shallow_water_0.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
assets_raw/map/water/shoals_shallow_water_10.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
assets_raw/map/water/shoals_shallow_water_11.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
assets_raw/map/water/shoals_shallow_water_5.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
assets_raw/map/water/shoals_shallow_water_6.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
assets_raw/map/water/shoals_shallow_water_7.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
assets_raw/map/water/shoals_shallow_water_8.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
assets_raw/map/water/shoals_shallow_water_9.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
73
build.gradle
Normal file
@@ -0,0 +1,73 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://s01.oss.sonatype.org' }
|
||||
gradlePluginPortal()
|
||||
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'
|
||||
apply plugin: 'idea'
|
||||
|
||||
// This allows you to "Build and run using IntelliJ IDEA", an option in IDEA's Settings.
|
||||
idea {
|
||||
module {
|
||||
outputDir file('build/classes/java/main')
|
||||
testOutputDir file('build/classes/java/test')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configure(subprojects) {
|
||||
apply plugin: 'java-library'
|
||||
sourceCompatibility = 17
|
||||
|
||||
// From https://lyze.dev/2021/04/29/libGDX-Internal-Assets-List/
|
||||
// The article can be helpful when using assets.txt in your project.
|
||||
tasks.register('generateAssetList') {
|
||||
inputs.dir("${project.rootDir}/assets/")
|
||||
// projectFolder/assets
|
||||
File assetsFolder = new File("${project.rootDir}/assets/")
|
||||
// projectFolder/assets/assets.txt
|
||||
File assetsFile = new File(assetsFolder, "assets.txt")
|
||||
// delete that file in case we've already created it
|
||||
assetsFile.delete()
|
||||
|
||||
// iterate through all files inside that folder
|
||||
// convert it to a relative path
|
||||
// and append it to the file assets.txt
|
||||
fileTree(assetsFolder).collect { assetsFolder.relativePath(it) }.sort().each {
|
||||
assetsFile.append(it + "\n")
|
||||
}
|
||||
}
|
||||
processResources.dependsOn 'generateAssetList'
|
||||
|
||||
compileJava {
|
||||
options.incremental = true
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
version = "$projectVersion"
|
||||
ext.appName = 'mystictutorial'
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://s01.oss.sonatype.org' }
|
||||
// You may want to remove the following line if you have errors downloading dependencies.
|
||||
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 = 'mystictutorial' + '-parent'
|
||||
15
core/build.gradle
Normal file
@@ -0,0 +1,15 @@
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
eclipse.project.name = appName + '-core'
|
||||
|
||||
dependencies {
|
||||
api "com.badlogicgames.ashley:ashley:$ashleyVersion"
|
||||
api "com.badlogicgames.box2dlights:box2dlights:$box2dlightsVersion"
|
||||
api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
|
||||
api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
|
||||
api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
|
||||
api "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||
|
||||
if(enableGraalNative == 'true') {
|
||||
implementation "io.github.berstanio:gdx-svmhelper-annotations:$graalHelperVersion"
|
||||
}
|
||||
}
|
||||
40
core/src/main/java/io/github/com/quillraven/GameScreen.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package io.github.com.quillraven;
|
||||
|
||||
import com.badlogic.ashley.core.Engine;
|
||||
import com.badlogic.gdx.ScreenAdapter;
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.utils.viewport.Viewport;
|
||||
import io.github.com.quillraven.system.RenderSystem;
|
||||
|
||||
public class GameScreen extends ScreenAdapter {
|
||||
private final GdxGame game;
|
||||
|
||||
private final SpriteBatch batch;
|
||||
private final AssetManager assetManager;
|
||||
private final Viewport viewport;
|
||||
private final OrthographicCamera camera;
|
||||
|
||||
private Engine engine;
|
||||
|
||||
public GameScreen(GdxGame game) {
|
||||
this.game = game;
|
||||
this.batch = game.getBatch();
|
||||
this.assetManager = game.getAssetManager();
|
||||
this.viewport = game.getViewport();
|
||||
this.camera = game.getCamera();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
engine = new Engine();
|
||||
engine.addSystem(new RenderSystem(batch, viewport, camera, assetManager));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float delta) {
|
||||
delta = Math.min(1 / 30f, delta);
|
||||
engine.update(delta);
|
||||
}
|
||||
}
|
||||
69
core/src/main/java/io/github/com/quillraven/GdxGame.java
Normal file
@@ -0,0 +1,69 @@
|
||||
package io.github.com.quillraven;
|
||||
|
||||
import com.badlogic.gdx.Game;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.utils.viewport.FitViewport;
|
||||
import com.badlogic.gdx.utils.viewport.Viewport;
|
||||
|
||||
public class GdxGame extends Game {
|
||||
public static final float WORLD_HEIGHT = 11f;
|
||||
public static final float WORLD_WIDTH = 6f;
|
||||
|
||||
private SpriteBatch batch;
|
||||
private AssetManager assetManager;
|
||||
private OrthographicCamera camera;
|
||||
private Viewport viewport;
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
batch = new SpriteBatch();
|
||||
assetManager = new AssetManager();
|
||||
camera = new OrthographicCamera();
|
||||
viewport = new FitViewport(WORLD_WIDTH, WORLD_HEIGHT, camera);
|
||||
|
||||
setScreen(new GameScreen(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
Gdx.gl.glClearColor(0, 0, 0, 1);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
super.render();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize(int width, int height) {
|
||||
viewport.update(width, height, true);
|
||||
super.resize(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (screen != null) {
|
||||
screen.dispose();
|
||||
}
|
||||
batch.dispose();
|
||||
assetManager.dispose();
|
||||
}
|
||||
|
||||
public SpriteBatch getBatch() {
|
||||
return batch;
|
||||
}
|
||||
|
||||
public AssetManager getAssetManager() {
|
||||
return assetManager;
|
||||
}
|
||||
|
||||
public OrthographicCamera getCamera() {
|
||||
return camera;
|
||||
}
|
||||
|
||||
public Viewport getViewport() {
|
||||
return viewport;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package io.github.com.quillraven.component;
|
||||
|
||||
import com.badlogic.ashley.core.Component;
|
||||
import com.badlogic.ashley.core.ComponentMapper;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
|
||||
/**
|
||||
* Component that stores the visual representation of an entity.
|
||||
* Contains a texture region and a color for tinting.
|
||||
*/
|
||||
public class Graphic implements Component {
|
||||
public static final ComponentMapper<Graphic> MAPPER = ComponentMapper.getFor(Graphic.class);
|
||||
|
||||
public TextureRegion region;
|
||||
public final Color color = new Color(Color.WHITE);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package io.github.com.quillraven.component;
|
||||
|
||||
import com.badlogic.ashley.core.Component;
|
||||
import com.badlogic.ashley.core.ComponentMapper;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
/**
|
||||
* Component that stores the position, z-index, and size of an entity.
|
||||
* Implements Comparable to allow sorting entities by z-index and position.
|
||||
*/
|
||||
public class Transform implements Component, Comparable<Transform> {
|
||||
public static final ComponentMapper<Transform> MAPPER = ComponentMapper.getFor(Transform.class);
|
||||
|
||||
public final Vector2 position = new Vector2();
|
||||
public int z = 0;
|
||||
public final Vector2 size = new Vector2(1f, 1f);
|
||||
|
||||
@Override
|
||||
public int compareTo(Transform other) {
|
||||
if (this.z != other.z) {
|
||||
return Float.compare(this.z, other.z);
|
||||
}
|
||||
if (this.position.y != other.position.y) {
|
||||
return Float.compare(other.position.y, this.position.y);
|
||||
}
|
||||
return Float.compare(this.position.x, other.position.x);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.github.com.quillraven.system;
|
||||
|
||||
import com.badlogic.ashley.core.Entity;
|
||||
import com.badlogic.ashley.core.Family;
|
||||
import com.badlogic.ashley.systems.SortedIteratingSystem;
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.maps.tiled.TiledMap;
|
||||
import com.badlogic.gdx.maps.tiled.TiledMapRenderer;
|
||||
import com.badlogic.gdx.maps.tiled.TmxMapLoader;
|
||||
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
|
||||
import com.badlogic.gdx.utils.Disposable;
|
||||
import com.badlogic.gdx.utils.viewport.Viewport;
|
||||
import io.github.com.quillraven.component.Graphic;
|
||||
import io.github.com.quillraven.component.Transform;
|
||||
|
||||
/**
|
||||
* System responsible for rendering entities with Transform and Graphic components.
|
||||
* Also handles rendering the tiled map.
|
||||
*/
|
||||
public class RenderSystem extends SortedIteratingSystem implements Disposable {
|
||||
private static final String MAP_PATH = "maps/mainmap.tmx";
|
||||
|
||||
private final SpriteBatch batch;
|
||||
private final OrthographicCamera camera;
|
||||
private final Viewport viewport;
|
||||
private final AssetManager assetManager;
|
||||
|
||||
private TiledMapRenderer mapRenderer;
|
||||
private TiledMap map;
|
||||
|
||||
public RenderSystem(SpriteBatch batch, Viewport viewport, OrthographicCamera camera, AssetManager assetManager) {
|
||||
super(
|
||||
Family.all(Transform.class, Graphic.class).get(),
|
||||
(entity1, entity2) -> {
|
||||
Transform transform1 = Transform.MAPPER.get(entity1);
|
||||
Transform transform2 = Transform.MAPPER.get(entity2);
|
||||
return transform1.compareTo(transform2);
|
||||
}
|
||||
);
|
||||
|
||||
this.batch = batch;
|
||||
this.viewport = viewport;
|
||||
this.camera = camera;
|
||||
this.assetManager = assetManager;
|
||||
|
||||
loadMap();
|
||||
}
|
||||
|
||||
private void loadMap() {
|
||||
if (!assetManager.isLoaded(MAP_PATH)) {
|
||||
assetManager.setLoader(TiledMap.class, new TmxMapLoader());
|
||||
assetManager.load(MAP_PATH, TiledMap.class);
|
||||
assetManager.finishLoading(); // Block until loaded
|
||||
}
|
||||
|
||||
map = assetManager.get(MAP_PATH, TiledMap.class);
|
||||
mapRenderer = new OrthogonalTiledMapRenderer(map, 1f / 32f, batch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(float deltaTime) {
|
||||
viewport.apply();
|
||||
mapRenderer.setView(camera);
|
||||
mapRenderer.render();
|
||||
|
||||
batch.begin();
|
||||
super.update(deltaTime);
|
||||
batch.end();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processEntity(Entity entity, float deltaTime) {
|
||||
Transform transform = Transform.MAPPER.get(entity);
|
||||
Graphic graphic = Graphic.MAPPER.get(entity);
|
||||
if (graphic.region == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
batch.setColor(graphic.color);
|
||||
batch.draw(
|
||||
graphic.region,
|
||||
transform.position.x, transform.position.y,
|
||||
transform.size.x / 2, transform.size.y / 2,
|
||||
transform.size.x, transform.size.y,
|
||||
1, 1,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (map != null) {
|
||||
map.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
10
gradle.properties
Normal file
@@ -0,0 +1,10 @@
|
||||
org.gradle.daemon=false
|
||||
org.gradle.jvmargs=-Xms512M -Xmx1G -Dfile.encoding=UTF-8 -Dconsole.encoding=UTF-8
|
||||
org.gradle.configureondemand=false
|
||||
aiVersion=1.8.2
|
||||
ashleyVersion=1.7.4
|
||||
box2dlightsVersion=1.5
|
||||
enableGraalNative=false
|
||||
graalHelperVersion=2.0.1
|
||||
gdxVersion=1.13.5
|
||||
projectVersion=1.0.0
|
||||
12
gradle/gradle-daemon-jvm.properties
Normal file
@@ -0,0 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/44715d7d372da8362a7c7e78c011e897/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/ce3ff383a4a3e769ac7d9ca5903aa698/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/44715d7d372da8362a7c7e78c011e897/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/ce3ff383a4a3e769ac7d9ca5903aa698/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/5956054eea3fda78f9a8d1b47e24e080/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/d73443cae2d063f4bc06ff437f9a3e6b/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/44715d7d372da8362a7c7e78c011e897/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/ce3ff383a4a3e769ac7d9ca5903aa698/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7fe1613e82362b3e87de352406cbc016/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/747369971f89e1f6bc182b737d168306/redirect
|
||||
toolchainVersion=17
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
251
gradlew
vendored
Executable file
@@ -0,0 +1,251 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# https://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.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# 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/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# 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 -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
94
gradlew.bat
vendored
Executable file
@@ -0,0 +1,94 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@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 ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
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
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
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
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
185
lwjgl3/build.gradle
Normal file
@@ -0,0 +1,185 @@
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "io.github.fourlastor:construo:1.7.1"
|
||||
if(enableGraalNative == 'true') {
|
||||
classpath "org.graalvm.buildtools.native:org.graalvm.buildtools.native.gradle.plugin:0.9.28"
|
||||
}
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
id "application"
|
||||
}
|
||||
apply plugin: 'io.github.fourlastor.construo'
|
||||
|
||||
|
||||
import io.github.fourlastor.construo.Target
|
||||
|
||||
sourceSets.main.resources.srcDirs += [ rootProject.file('assets').path ]
|
||||
mainClassName = 'io.github.com.quillraven.lwjgl3.Lwjgl3Launcher'
|
||||
application.setMainClass(mainClassName)
|
||||
eclipse.project.name = appName + '-lwjgl3'
|
||||
java.sourceCompatibility = 17
|
||||
java.targetCompatibility = 17
|
||||
if (JavaVersion.current().isJava9Compatible()) {
|
||||
compileJava.options.release.set(17)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
|
||||
implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
|
||||
implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
||||
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||
implementation project(':core')
|
||||
|
||||
if(enableGraalNative == 'true') {
|
||||
implementation "io.github.berstanio:gdx-svmhelper-backend-lwjgl3:$graalHelperVersion"
|
||||
implementation "io.github.berstanio:gdx-svmhelper-extension-box2d:$graalHelperVersion"
|
||||
implementation "io.github.berstanio:gdx-svmhelper-extension-freetype:$graalHelperVersion"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
def os = System.properties['os.name'].toLowerCase()
|
||||
|
||||
run {
|
||||
workingDir = rootProject.file('assets').path
|
||||
// You can uncomment the next line if your IDE claims a build failure even when the app closed properly.
|
||||
//setIgnoreExitValue(true)
|
||||
|
||||
if (os.contains('mac')) jvmArgs += "-XstartOnFirstThread"
|
||||
}
|
||||
|
||||
jar {
|
||||
// sets the name of the .jar file this produces to the name of the game or app, with the version after.
|
||||
archiveFileName.set("${appName}-${projectVersion}.jar")
|
||||
// the duplicatesStrategy matters starting in Gradle 7.0; this setting works.
|
||||
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
||||
dependsOn configurations.runtimeClasspath
|
||||
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
// these "exclude" lines remove some unnecessary duplicate files in the output JAR.
|
||||
exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
|
||||
dependencies {
|
||||
exclude('META-INF/INDEX.LIST', 'META-INF/maven/**')
|
||||
}
|
||||
// setting the manifest makes the JAR runnable.
|
||||
manifest {
|
||||
attributes 'Main-Class': project.mainClassName
|
||||
}
|
||||
// this last step may help on some OSes that need extra instruction to make runnable JARs.
|
||||
doLast {
|
||||
file(archiveFile).setExecutable(true, false)
|
||||
}
|
||||
}
|
||||
|
||||
// Builds a JAR that only includes the files needed to run on macOS, not Windows or Linux.
|
||||
// The file size for a Mac-only JAR is about 7MB smaller than a cross-platform JAR.
|
||||
tasks.register("jarMac") {
|
||||
dependsOn("jar")
|
||||
group("build")
|
||||
jar.archiveFileName.set("${appName}-${projectVersion}-mac.jar")
|
||||
jar.exclude("windows/x86/**", "windows/x64/**", "linux/arm32/**", "linux/arm64/**", "linux/x64/**", "**/*.dll", "**/*.so",
|
||||
'META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
|
||||
dependencies {
|
||||
jar.exclude("windows/x86/**", "windows/x64/**", "linux/arm32/**", "linux/arm64/**", "linux/x64/**",
|
||||
'META-INF/INDEX.LIST', 'META-INF/maven/**')
|
||||
}
|
||||
}
|
||||
|
||||
// Builds a JAR that only includes the files needed to run on Linux, not Windows or macOS.
|
||||
// The file size for a Linux-only JAR is about 5MB smaller than a cross-platform JAR.
|
||||
tasks.register("jarLinux") {
|
||||
dependsOn("jar")
|
||||
group("build")
|
||||
jar.archiveFileName.set("${appName}-${projectVersion}-linux.jar")
|
||||
jar.exclude("windows/x86/**", "windows/x64/**", "macos/arm64/**", "macos/x64/**", "**/*.dll", "**/*.dylib",
|
||||
'META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
|
||||
dependencies {
|
||||
jar.exclude("windows/x86/**", "windows/x64/**", "macos/arm64/**", "macos/x64/**",
|
||||
'META-INF/INDEX.LIST', 'META-INF/maven/**')
|
||||
}
|
||||
}
|
||||
|
||||
// Builds a JAR that only includes the files needed to run on Windows, not Linux or macOS.
|
||||
// The file size for a Windows-only JAR is about 6MB smaller than a cross-platform JAR.
|
||||
tasks.register("jarWin") {
|
||||
dependsOn("jar")
|
||||
group("build")
|
||||
jar.archiveFileName.set("${appName}-${projectVersion}-win.jar")
|
||||
jar.exclude("macos/arm64/**", "macos/x64/**", "linux/arm32/**", "linux/arm64/**", "linux/x64/**", "**/*.dylib", "**/*.so",
|
||||
'META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
|
||||
dependencies {
|
||||
jar.exclude("macos/arm64/**", "macos/x64/**", "linux/arm32/**", "linux/arm64/**", "linux/x64/**",
|
||||
'META-INF/INDEX.LIST', 'META-INF/maven/**')
|
||||
}
|
||||
}
|
||||
|
||||
construo {
|
||||
// name of the executable
|
||||
name.set(appName)
|
||||
// human-readable name, used for example in the `.app` name for macOS
|
||||
humanName.set(appName)
|
||||
// Optional, defaults to project version property
|
||||
version.set("$projectVersion")
|
||||
|
||||
targets.configure {
|
||||
create("linuxX64", Target.Linux) {
|
||||
architecture.set(Target.Architecture.X86_64)
|
||||
jdkUrl.set("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jdk_x64_linux_hotspot_17.0.15_6.tar.gz")
|
||||
// Linux does not currently have a way to set the icon on the executable
|
||||
}
|
||||
create("macM1", Target.MacOs) {
|
||||
architecture.set(Target.Architecture.AARCH64)
|
||||
jdkUrl.set("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jdk_aarch64_mac_hotspot_17.0.15_6.tar.gz")
|
||||
// macOS needs an identifier
|
||||
identifier.set("io.github.com.quillraven." + appName)
|
||||
// Optional: icon for macOS, as an ICNS file
|
||||
macIcon.set(project.file("icons/logo.icns"))
|
||||
}
|
||||
create("macX64", Target.MacOs) {
|
||||
architecture.set(Target.Architecture.X86_64)
|
||||
jdkUrl.set("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jdk_x64_mac_hotspot_17.0.15_6.tar.gz")
|
||||
// macOS needs an identifier
|
||||
identifier.set("io.github.com.quillraven." + appName)
|
||||
// Optional: icon for macOS, as an ICNS file
|
||||
macIcon.set(project.file("icons/logo.icns"))
|
||||
}
|
||||
create("winX64", Target.Windows) {
|
||||
architecture.set(Target.Architecture.X86_64)
|
||||
// Optional: icon for Windows, as a PNG
|
||||
icon.set(project.file("icons/logo.png"))
|
||||
jdkUrl.set("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jdk_x64_windows_hotspot_17.0.15_6.zip")
|
||||
// Uncomment the next line to show a console when the game runs, to print messages.
|
||||
//useConsole.set(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Equivalent to the jar task; here for compatibility with gdx-setup.
|
||||
tasks.register('dist') {
|
||||
dependsOn 'jar'
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
startScripts.dependsOn(':lwjgl3:jar')
|
||||
startScripts.classpath = project.tasks.jar.outputs.files
|
||||
|
||||
if(enableGraalNative == 'true') {
|
||||
apply from: file("nativeimage.gradle")
|
||||
}
|
||||
BIN
lwjgl3/icons/logo.icns
Normal file
BIN
lwjgl3/icons/logo.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
lwjgl3/icons/logo.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
54
lwjgl3/nativeimage.gradle
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
project(":lwjgl3") {
|
||||
apply plugin: "org.graalvm.buildtools.native"
|
||||
|
||||
graalvmNative {
|
||||
binaries {
|
||||
main {
|
||||
imageName = appName
|
||||
mainClass = project.mainClassName
|
||||
requiredVersion = '23.0'
|
||||
buildArgs.add("-march=compatibility")
|
||||
jvmArgs.addAll("-Dfile.encoding=UTF8")
|
||||
sharedLibrary = false
|
||||
resources.autodetect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
run {
|
||||
doNotTrackState("Running the app should not be affected by Graal.")
|
||||
}
|
||||
|
||||
// Modified from https://lyze.dev/2021/04/29/libGDX-Internal-Assets-List/ ; thanks again, Lyze!
|
||||
// This creates a resource-config.json file based on the contents of the assets folder (and the libGDX icons).
|
||||
// This file is used by Graal Native to embed those specific files.
|
||||
// This has to run before nativeCompile, so it runs at the start of an unrelated resource-handling command.
|
||||
generateResourcesConfigFile.doFirst {
|
||||
def assetsFolder = new File("${project.rootDir}/assets/")
|
||||
def lwjgl3 = project(':lwjgl3')
|
||||
def resFolder = new File("${lwjgl3.projectDir}/src/main/resources/META-INF/native-image/${lwjgl3.ext.appName}")
|
||||
resFolder.mkdirs()
|
||||
def resFile = new File(resFolder, "resource-config.json")
|
||||
resFile.delete()
|
||||
resFile.append(
|
||||
"""{
|
||||
"resources":{
|
||||
"includes":[
|
||||
{
|
||||
"pattern": ".*(""")
|
||||
// This adds every filename in the assets/ folder to a pattern that adds those files as resources.
|
||||
fileTree(assetsFolder).each {
|
||||
// The backslash-Q and backslash-E escape the start and end of a literal string, respectively.
|
||||
resFile.append("\\\\Q${it.name}\\\\E|")
|
||||
}
|
||||
// We also match all of the window icon images this way and the font files that are part of libGDX.
|
||||
resFile.append(
|
||||
"""libgdx.+\\\\.png|lsans.+)"
|
||||
}
|
||||
]},
|
||||
"bundles":[]
|
||||
}"""
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package io.github.com.quillraven.lwjgl3;
|
||||
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
|
||||
import io.github.com.quillraven.GdxGame;
|
||||
|
||||
/**
|
||||
* Launches the desktop (LWJGL3) application.
|
||||
*/
|
||||
public class Lwjgl3Launcher {
|
||||
public static void main(String[] args) {
|
||||
if (StartupHelper.startNewJvmIfRequired()) return; // This handles macOS support and helps on Windows.
|
||||
createApplication();
|
||||
}
|
||||
|
||||
private static Lwjgl3Application createApplication() {
|
||||
return new Lwjgl3Application(new GdxGame(), getDefaultConfiguration());
|
||||
}
|
||||
|
||||
private static Lwjgl3ApplicationConfiguration getDefaultConfiguration() {
|
||||
Lwjgl3ApplicationConfiguration configuration = new Lwjgl3ApplicationConfiguration();
|
||||
configuration.setTitle("mystictutorial");
|
||||
//// Vsync limits the frames per second to what your hardware can display, and helps eliminate
|
||||
//// screen tearing. This setting doesn't always work on Linux, so the line after is a safeguard.
|
||||
configuration.useVsync(true);
|
||||
//// Limits FPS to the refresh rate of the currently active monitor, plus 1 to try to match fractional
|
||||
//// refresh rates. The Vsync setting above should limit the actual FPS to match the monitor.
|
||||
configuration.setForegroundFPS(Lwjgl3ApplicationConfiguration.getDisplayMode().refreshRate + 1);
|
||||
//// If you remove the above line and set Vsync to false, you can get unlimited FPS, which can be
|
||||
//// useful for testing performance, but can also be very stressful to some hardware.
|
||||
//// You may also need to configure GPU drivers to fully disable Vsync; this can cause screen tearing.
|
||||
|
||||
configuration.setWindowedMode((int) (GdxGame.WORLD_WIDTH * 70), (int) (GdxGame.WORLD_HEIGHT * 70));
|
||||
//// You can change these files; they are in lwjgl3/src/main/resources/ .
|
||||
//// They can also be loaded from the root of assets/ .
|
||||
configuration.setWindowIcon("libgdx128.png", "libgdx64.png", "libgdx32.png", "libgdx16.png");
|
||||
return configuration;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
* Copyright 2020 damios
|
||||
*
|
||||
* 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:
|
||||
* https://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.
|
||||
*/
|
||||
//Note, the above license and copyright applies to this file only.
|
||||
|
||||
package io.github.com.quillraven.lwjgl3;
|
||||
|
||||
import com.badlogic.gdx.Version;
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3NativesLoader;
|
||||
import org.lwjgl.system.macosx.LibC;
|
||||
import org.lwjgl.system.macosx.ObjCRuntime;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.lwjgl.system.JNI.invokePPP;
|
||||
import static org.lwjgl.system.JNI.invokePPZ;
|
||||
import static org.lwjgl.system.macosx.ObjCRuntime.objc_getClass;
|
||||
import static org.lwjgl.system.macosx.ObjCRuntime.sel_getUid;
|
||||
|
||||
/**
|
||||
* Adds some utilities to ensure that the JVM was started with the
|
||||
* {@code -XstartOnFirstThread} argument, which is required on macOS for LWJGL 3
|
||||
* to function. Also helps on Windows when users have names with characters from
|
||||
* outside the Latin alphabet, a common cause of startup crashes.
|
||||
* <br>
|
||||
* <a href="https://jvm-gaming.org/t/starting-jvm-on-mac-with-xstartonfirstthread-programmatically/57547">Based on this java-gaming.org post by kappa</a>
|
||||
* @author damios
|
||||
*/
|
||||
public class StartupHelper {
|
||||
|
||||
private static final String JVM_RESTARTED_ARG = "jvmIsRestarted";
|
||||
|
||||
private StartupHelper() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a new JVM if the application was started on macOS without the
|
||||
* {@code -XstartOnFirstThread} argument. This also includes some code for
|
||||
* Windows, for the case where the user's home directory includes certain
|
||||
* non-Latin-alphabet characters (without this code, most LWJGL3 apps fail
|
||||
* immediately for those users). Returns whether a new JVM was started and
|
||||
* thus no code should be executed.
|
||||
* <p>
|
||||
* <u>Usage:</u>
|
||||
*
|
||||
* <pre><code>
|
||||
* public static void main(String... args) {
|
||||
* if (StartupHelper.startNewJvmIfRequired(true)) return; // This handles macOS support and helps on Windows.
|
||||
* // after this is the actual main method code
|
||||
* }
|
||||
* </code></pre>
|
||||
*
|
||||
* @param redirectOutput
|
||||
* whether the output of the new JVM should be rerouted to the
|
||||
* old JVM, so it can be accessed in the same place; keeps the
|
||||
* old JVM running if enabled
|
||||
* @return whether a new JVM was started and thus no code should be executed
|
||||
* in this one
|
||||
*/
|
||||
public static boolean startNewJvmIfRequired(boolean redirectOutput) {
|
||||
String osName = System.getProperty("os.name").toLowerCase();
|
||||
if (!osName.contains("mac")) {
|
||||
if (osName.contains("windows")) {
|
||||
// Here, we are trying to work around an issue with how LWJGL3 loads its extracted .dll files.
|
||||
// By default, LWJGL3 extracts to the directory specified by "java.io.tmpdir", which is usually the user's home.
|
||||
// If the user's name has non-ASCII (or some non-alphanumeric) characters in it, that would fail.
|
||||
// By extracting to the relevant "ProgramData" folder, which is usually "C:\ProgramData", we avoid this.
|
||||
// We also temporarily change the "user.name" property to one without any chars that would be invalid.
|
||||
// We revert our changes immediately after loading LWJGL3 natives.
|
||||
String programData = System.getenv("ProgramData");
|
||||
if(programData == null) programData = "C:\\Temp\\"; // if ProgramData isn't set, try some fallback.
|
||||
String prevTmpDir = System.getProperty("java.io.tmpdir", programData);
|
||||
String prevUser = System.getProperty("user.name", "libGDX_User");
|
||||
System.setProperty("java.io.tmpdir", programData + "/libGDX-temp");
|
||||
System.setProperty("user.name", ("User_" + prevUser.hashCode() + "_GDX" + Version.VERSION).replace('.', '_'));
|
||||
Lwjgl3NativesLoader.load();
|
||||
System.setProperty("java.io.tmpdir", prevTmpDir);
|
||||
System.setProperty("user.name", prevUser);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// There is no need for -XstartOnFirstThread on Graal native image
|
||||
if (!System.getProperty("org.graalvm.nativeimage.imagecode", "").isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Checks if we are already on the main thread, such as from running via Construo.
|
||||
long objc_msgSend = ObjCRuntime.getLibrary().getFunctionAddress("objc_msgSend");
|
||||
long NSThread = objc_getClass("NSThread");
|
||||
long currentThread = invokePPP(NSThread, sel_getUid("currentThread"), objc_msgSend);
|
||||
boolean isMainThread = invokePPZ(currentThread, sel_getUid("isMainThread"), objc_msgSend);
|
||||
if(isMainThread) return false;
|
||||
|
||||
long pid = LibC.getpid();
|
||||
|
||||
// check whether -XstartOnFirstThread is enabled
|
||||
if ("1".equals(System.getenv("JAVA_STARTED_ON_FIRST_THREAD_" + pid))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check whether the JVM was previously restarted
|
||||
// avoids looping, but most certainly leads to a crash
|
||||
if ("true".equals(System.getProperty(JVM_RESTARTED_ARG))) {
|
||||
System.err.println(
|
||||
"There was a problem evaluating whether the JVM was started with the -XstartOnFirstThread argument.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Restart the JVM with -XstartOnFirstThread
|
||||
ArrayList<String> jvmArgs = new ArrayList<>();
|
||||
String separator = System.getProperty("file.separator", "/");
|
||||
// The following line is used assuming you target Java 8, the minimum for LWJGL3.
|
||||
String javaExecPath = System.getProperty("java.home") + separator + "bin" + separator + "java";
|
||||
// If targeting Java 9 or higher, you could use the following instead of the above line:
|
||||
//String javaExecPath = ProcessHandle.current().info().command().orElseThrow();
|
||||
|
||||
if (!(new File(javaExecPath)).exists()) {
|
||||
System.err.println(
|
||||
"A Java installation could not be found. If you are distributing this app with a bundled JRE, be sure to set the -XstartOnFirstThread argument manually!");
|
||||
return false;
|
||||
}
|
||||
|
||||
jvmArgs.add(javaExecPath);
|
||||
jvmArgs.add("-XstartOnFirstThread");
|
||||
jvmArgs.add("-D" + JVM_RESTARTED_ARG + "=true");
|
||||
jvmArgs.addAll(ManagementFactory.getRuntimeMXBean().getInputArguments());
|
||||
jvmArgs.add("-cp");
|
||||
jvmArgs.add(System.getProperty("java.class.path"));
|
||||
String mainClass = System.getenv("JAVA_MAIN_CLASS_" + pid);
|
||||
if (mainClass == null) {
|
||||
StackTraceElement[] trace = Thread.currentThread().getStackTrace();
|
||||
if (trace.length > 0) {
|
||||
mainClass = trace[trace.length - 1].getClassName();
|
||||
} else {
|
||||
System.err.println("The main class could not be determined.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
jvmArgs.add(mainClass);
|
||||
|
||||
try {
|
||||
if (!redirectOutput) {
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(jvmArgs);
|
||||
processBuilder.start();
|
||||
} else {
|
||||
Process process = (new ProcessBuilder(jvmArgs))
|
||||
.redirectErrorStream(true).start();
|
||||
BufferedReader processOutput = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream()));
|
||||
String line;
|
||||
|
||||
while ((line = processOutput.readLine()) != null) {
|
||||
System.out.println(line);
|
||||
}
|
||||
|
||||
process.waitFor();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("There was a problem restarting the JVM");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a new JVM if the application was started on macOS without the
|
||||
* {@code -XstartOnFirstThread} argument. Returns whether a new JVM was
|
||||
* started and thus no code should be executed. Redirects the output of the
|
||||
* new JVM to the old one.
|
||||
* <p>
|
||||
* <u>Usage:</u>
|
||||
*
|
||||
* <pre>
|
||||
* public static void main(String... args) {
|
||||
* if (StartupHelper.startNewJvmIfRequired()) return; // This handles macOS support and helps on Windows.
|
||||
* // the actual main method code
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @return whether a new JVM was started and thus no code should be executed
|
||||
* in this one
|
||||
*/
|
||||
public static boolean startNewJvmIfRequired() {
|
||||
return startNewJvmIfRequired(true);
|
||||
}
|
||||
}
|
||||
BIN
lwjgl3/src/main/resources/libgdx128.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
lwjgl3/src/main/resources/libgdx16.png
Normal file
|
After Width: | Height: | Size: 806 B |
BIN
lwjgl3/src/main/resources/libgdx32.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
lwjgl3/src/main/resources/libgdx64.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
8
settings.gradle
Normal file
@@ -0,0 +1,8 @@
|
||||
plugins {
|
||||
// Applies the foojay-resolver plugin to allow automatic download of JDKs.
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0"
|
||||
}
|
||||
// A list of which subprojects to load as part of the same larger project.
|
||||
// You can remove Strings from the list and reload the Gradle project
|
||||
// if you want to temporarily disable a subproject.
|
||||
include 'core', 'lwjgl3', 'util'
|
||||
11
util/build.gradle
Normal file
@@ -0,0 +1,11 @@
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
eclipse.project.name = appName + '-util'
|
||||
|
||||
dependencies {
|
||||
api "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||
api "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
|
||||
|
||||
if(enableGraalNative == 'true') {
|
||||
implementation "io.github.berstanio:gdx-svmhelper-annotations:$graalHelperVersion"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package io.github.com.quillraven.util;
|
||||
|
||||
import com.badlogic.gdx.tools.texturepacker.TexturePacker;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Utility class to execute LibGDX's TextureAtlas packer tool.
|
||||
* This tool packs multiple images into a single texture atlas.
|
||||
*/
|
||||
public class TexturePackerTool {
|
||||
public static void main(String[] args) {
|
||||
String inputDir = "assets_raw/map";
|
||||
String outputDir = "assets/maps";
|
||||
String packFileName = "tileset";
|
||||
|
||||
System.out.println("Packing textures from " + inputDir + " to " + outputDir + "/" + packFileName);
|
||||
TexturePacker.process(inputDir, outputDir, packFileName);
|
||||
System.out.println("Texture packing completed successfully!");
|
||||
}
|
||||
}
|
||||