commit 8bcfbf9d3f24ed3cf183ea9752b4e360a04342a5 Author: EmaMaker Date: Fri Mar 27 21:49:20 2020 +0100 Game no longer crashes when trying to restart a game after someone won diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ecc1c89 --- /dev/null +++ b/.gitignore @@ -0,0 +1,127 @@ +## Java + +*.class +*.war +*.ear +hs_err_pid* + +## Robovm +/ios/robovm-build/ + +## GWT +/html/war/ +/html/gwt-unitCache/ +.apt_generated/ +.gwt/ +gwt-unitCache/ +www-test/ +.gwt-tmp/ + +## Android Studio and Intellij and Android in general +/android/libs/armeabi/ +/android/libs/armeabi-v7a/ +/android/libs/arm64-v8a/ +/android/libs/x86/ +/android/libs/x86_64/ +/android/gen/ +.idea/ +*.ipr +*.iws +*.iml +/android/out/ +com_crashlytics_export_strings.xml + +## Eclipse + +.classpath +.project +.metadata/ +/android/bin/ +/core/bin/ +/desktop/bin/ +/html/bin/ +/ios/bin/ +/ios-moe/bin/ +*.tmp +*.bak +*.swp +*~.nib +.settings/ +.loadpath +.externalToolBuilders/ +*.launch + +## NetBeans + +/nbproject/private/ +/android/nbproject/private/ +/core/nbproject/private/ +/desktop/nbproject/private/ +/html/nbproject/private/ +/ios/nbproject/private/ +/ios-moe/nbproject/private/ + +/build/ +/android/build/ +/core/build/ +/desktop/build/ +/html/build/ +/ios/build/ +/ios-moe/build/ + +/nbbuild/ +/android/nbbuild/ +/core/nbbuild/ +/desktop/nbbuild/ +/html/nbbuild/ +/ios/nbbuild/ +/ios-moe/nbbuild/ + +/dist/ +/android/dist/ +/core/dist/ +/desktop/dist/ +/html/dist/ +/ios/dist/ +/ios-moe/dist/ + +/nbdist/ +/android/nbdist/ +/core/nbdist/ +/desktop/nbdist/ +/html/nbdist/ +/ios/nbdist/ +/ios-moe/nbdist/ + +nbactions.xml +nb-configuration.xml + +## Gradle + +/local.properties +.gradle/ +gradle-app.setting +/build/ +/android/build/ +/core/build/ +/desktop/build/ +/html/build/ +/ios/build/ +/ios-moe/build/ + +## OS Specific +.DS_Store +Thumbs.db + +## iOS +/ios/xcode/*.xcodeproj/* +!/ios/xcode/*.xcodeproj/xcshareddata +!/ios/xcode/*.xcodeproj/project.pbxproj +/ios/xcode/native/ +/ios/IOSLauncher.app +/ios/IOSLauncher.app.dSYM + +/ios-moe/xcode/*.xcodeproj/* +!/ios-moe/xcode/*.xcodeproj/xcshareddata +!/ios-moe/xcode/*.xcodeproj/project.pbxproj +/ios-moe/xcode/native/ diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml new file mode 100644 index 0000000..2a72f3c --- /dev/null +++ b/android/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + diff --git a/android/assets/data/default.fnt b/android/assets/data/default.fnt new file mode 100755 index 0000000..6152b0a --- /dev/null +++ b/android/assets/data/default.fnt @@ -0,0 +1,101 @@ +info face="Droid Sans" size=17 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 +common lineHeight=20 base=18 scaleW=256 scaleH=128 pages=1 packed=0 +page id=0 file="default.png" +chars count=96 +char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=16 xadvance=4 page=0 chnl=0 +char id=124 x=0 y=0 width=6 height=20 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=106 x=6 y=0 width=9 height=20 xoffset=-4 yoffset=3 xadvance=4 page=0 chnl=0 +char id=81 x=15 y=0 width=15 height=19 xoffset=-2 yoffset=3 xadvance=12 page=0 chnl=0 +char id=74 x=30 y=0 width=11 height=19 xoffset=-5 yoffset=3 xadvance=4 page=0 chnl=0 +char id=125 x=41 y=0 width=10 height=18 xoffset=-3 yoffset=3 xadvance=6 page=0 chnl=0 +char id=123 x=51 y=0 width=10 height=18 xoffset=-3 yoffset=3 xadvance=6 page=0 chnl=0 +char id=93 x=61 y=0 width=8 height=18 xoffset=-3 yoffset=3 xadvance=5 page=0 chnl=0 +char id=91 x=69 y=0 width=8 height=18 xoffset=-2 yoffset=3 xadvance=5 page=0 chnl=0 +char id=41 x=77 y=0 width=9 height=18 xoffset=-3 yoffset=3 xadvance=5 page=0 chnl=0 +char id=40 x=86 y=0 width=9 height=18 xoffset=-3 yoffset=3 xadvance=5 page=0 chnl=0 +char id=64 x=95 y=0 width=18 height=17 xoffset=-3 yoffset=3 xadvance=14 page=0 chnl=0 +char id=121 x=113 y=0 width=13 height=17 xoffset=-3 yoffset=6 xadvance=8 page=0 chnl=0 +char id=113 x=126 y=0 width=13 height=17 xoffset=-3 yoffset=6 xadvance=9 page=0 chnl=0 +char id=112 x=139 y=0 width=13 height=17 xoffset=-2 yoffset=6 xadvance=9 page=0 chnl=0 +char id=103 x=152 y=0 width=13 height=17 xoffset=-3 yoffset=6 xadvance=8 page=0 chnl=0 +char id=38 x=165 y=0 width=16 height=16 xoffset=-3 yoffset=3 xadvance=11 page=0 chnl=0 +char id=37 x=181 y=0 width=18 height=16 xoffset=-3 yoffset=3 xadvance=14 page=0 chnl=0 +char id=36 x=199 y=0 width=12 height=16 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0 +char id=63 x=211 y=0 width=11 height=16 xoffset=-3 yoffset=3 xadvance=7 page=0 chnl=0 +char id=33 x=222 y=0 width=7 height=16 xoffset=-2 yoffset=3 xadvance=4 page=0 chnl=0 +char id=48 x=229 y=0 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=57 x=242 y=0 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=56 x=0 y=20 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=54 x=13 y=20 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=53 x=26 y=20 width=12 height=16 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0 +char id=51 x=38 y=20 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=100 x=51 y=20 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=98 x=64 y=20 width=13 height=16 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0 +char id=85 x=77 y=20 width=14 height=16 xoffset=-2 yoffset=3 xadvance=11 page=0 chnl=0 +char id=83 x=91 y=20 width=13 height=16 xoffset=-3 yoffset=3 xadvance=8 page=0 chnl=0 +char id=79 x=104 y=20 width=15 height=16 xoffset=-2 yoffset=3 xadvance=12 page=0 chnl=0 +char id=71 x=119 y=20 width=14 height=16 xoffset=-2 yoffset=3 xadvance=11 page=0 chnl=0 +char id=67 x=133 y=20 width=13 height=16 xoffset=-2 yoffset=3 xadvance=10 page=0 chnl=0 +char id=127 x=146 y=20 width=12 height=15 xoffset=-2 yoffset=3 xadvance=10 page=0 chnl=0 +char id=35 x=158 y=20 width=15 height=15 xoffset=-3 yoffset=3 xadvance=10 page=0 chnl=0 +char id=92 x=173 y=20 width=11 height=15 xoffset=-3 yoffset=3 xadvance=6 page=0 chnl=0 +char id=47 x=184 y=20 width=11 height=15 xoffset=-3 yoffset=3 xadvance=6 page=0 chnl=0 +char id=59 x=195 y=20 width=8 height=15 xoffset=-3 yoffset=6 xadvance=4 page=0 chnl=0 +char id=55 x=203 y=20 width=13 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=52 x=216 y=20 width=14 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=50 x=230 y=20 width=13 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=49 x=243 y=20 width=9 height=15 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0 +char id=116 x=0 y=36 width=10 height=15 xoffset=-3 yoffset=4 xadvance=5 page=0 chnl=0 +char id=108 x=10 y=36 width=6 height=15 xoffset=-2 yoffset=3 xadvance=4 page=0 chnl=0 +char id=107 x=16 y=36 width=12 height=15 xoffset=-2 yoffset=3 xadvance=8 page=0 chnl=0 +char id=105 x=28 y=36 width=7 height=15 xoffset=-2 yoffset=3 xadvance=4 page=0 chnl=0 +char id=104 x=35 y=36 width=12 height=15 xoffset=-2 yoffset=3 xadvance=10 page=0 chnl=0 +char id=102 x=47 y=36 width=11 height=15 xoffset=-3 yoffset=3 xadvance=5 page=0 chnl=0 +char id=90 x=58 y=36 width=13 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=89 x=71 y=36 width=13 height=15 xoffset=-3 yoffset=3 xadvance=8 page=0 chnl=0 +char id=88 x=84 y=36 width=14 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=87 x=98 y=36 width=19 height=15 xoffset=-3 yoffset=3 xadvance=15 page=0 chnl=0 +char id=86 x=117 y=36 width=14 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=84 x=131 y=36 width=13 height=15 xoffset=-3 yoffset=3 xadvance=8 page=0 chnl=0 +char id=82 x=144 y=36 width=13 height=15 xoffset=-2 yoffset=3 xadvance=10 page=0 chnl=0 +char id=80 x=157 y=36 width=12 height=15 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0 +char id=78 x=169 y=36 width=14 height=15 xoffset=-2 yoffset=3 xadvance=12 page=0 chnl=0 +char id=77 x=183 y=36 width=17 height=15 xoffset=-2 yoffset=3 xadvance=14 page=0 chnl=0 +char id=76 x=200 y=36 width=11 height=15 xoffset=-2 yoffset=3 xadvance=8 page=0 chnl=0 +char id=75 x=211 y=36 width=13 height=15 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0 +char id=73 x=224 y=36 width=10 height=15 xoffset=-3 yoffset=3 xadvance=5 page=0 chnl=0 +char id=72 x=234 y=36 width=14 height=15 xoffset=-2 yoffset=3 xadvance=11 page=0 chnl=0 +char id=70 x=0 y=51 width=11 height=15 xoffset=-2 yoffset=3 xadvance=8 page=0 chnl=0 +char id=69 x=11 y=51 width=11 height=15 xoffset=-2 yoffset=3 xadvance=8 page=0 chnl=0 +char id=68 x=22 y=51 width=14 height=15 xoffset=-2 yoffset=3 xadvance=11 page=0 chnl=0 +char id=66 x=36 y=51 width=13 height=15 xoffset=-2 yoffset=3 xadvance=10 page=0 chnl=0 +char id=65 x=49 y=51 width=15 height=15 xoffset=-3 yoffset=3 xadvance=10 page=0 chnl=0 +char id=58 x=64 y=51 width=7 height=13 xoffset=-2 yoffset=6 xadvance=4 page=0 chnl=0 +char id=117 x=71 y=51 width=12 height=13 xoffset=-2 yoffset=6 xadvance=10 page=0 chnl=0 +char id=115 x=83 y=51 width=11 height=13 xoffset=-3 yoffset=6 xadvance=7 page=0 chnl=0 +char id=111 x=94 y=51 width=13 height=13 xoffset=-3 yoffset=6 xadvance=9 page=0 chnl=0 +char id=101 x=107 y=51 width=13 height=13 xoffset=-3 yoffset=6 xadvance=9 page=0 chnl=0 +char id=99 x=120 y=51 width=12 height=13 xoffset=-3 yoffset=6 xadvance=7 page=0 chnl=0 +char id=97 x=132 y=51 width=12 height=13 xoffset=-3 yoffset=6 xadvance=9 page=0 chnl=0 +char id=60 x=144 y=51 width=13 height=12 xoffset=-3 yoffset=5 xadvance=9 page=0 chnl=0 +char id=122 x=157 y=51 width=11 height=12 xoffset=-3 yoffset=6 xadvance=7 page=0 chnl=0 +char id=120 x=168 y=51 width=13 height=12 xoffset=-3 yoffset=6 xadvance=8 page=0 chnl=0 +char id=119 x=181 y=51 width=17 height=12 xoffset=-3 yoffset=6 xadvance=12 page=0 chnl=0 +char id=118 x=198 y=51 width=13 height=12 xoffset=-3 yoffset=6 xadvance=8 page=0 chnl=0 +char id=114 x=211 y=51 width=10 height=12 xoffset=-2 yoffset=6 xadvance=6 page=0 chnl=0 +char id=110 x=221 y=51 width=12 height=12 xoffset=-2 yoffset=6 xadvance=10 page=0 chnl=0 +char id=109 x=233 y=51 width=17 height=12 xoffset=-2 yoffset=6 xadvance=15 page=0 chnl=0 +char id=94 x=0 y=66 width=13 height=11 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=62 x=13 y=66 width=13 height=11 xoffset=-3 yoffset=5 xadvance=9 page=0 chnl=0 +char id=42 x=26 y=66 width=13 height=10 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=43 x=39 y=66 width=13 height=10 xoffset=-3 yoffset=6 xadvance=9 page=0 chnl=0 +char id=61 x=52 y=66 width=13 height=8 xoffset=-3 yoffset=7 xadvance=9 page=0 chnl=0 +char id=39 x=65 y=66 width=6 height=8 xoffset=-2 yoffset=3 xadvance=3 page=0 chnl=0 +char id=34 x=71 y=66 width=9 height=8 xoffset=-2 yoffset=3 xadvance=6 page=0 chnl=0 +char id=44 x=80 y=66 width=8 height=7 xoffset=-3 yoffset=14 xadvance=4 page=0 chnl=0 +char id=126 x=88 y=66 width=13 height=6 xoffset=-3 yoffset=8 xadvance=9 page=0 chnl=0 +char id=46 x=101 y=66 width=7 height=6 xoffset=-2 yoffset=13 xadvance=4 page=0 chnl=0 +char id=96 x=108 y=66 width=8 height=6 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 +char id=45 x=116 y=66 width=9 height=5 xoffset=-3 yoffset=10 xadvance=5 page=0 chnl=0 +char id=95 x=125 y=66 width=13 height=4 xoffset=-4 yoffset=17 xadvance=6 page=0 chnl=0 +kernings count=-1 diff --git a/android/assets/data/shaders/testshader_frag.glsl b/android/assets/data/shaders/testshader_frag.glsl new file mode 100644 index 0000000..6862ea6 --- /dev/null +++ b/android/assets/data/shaders/testshader_frag.glsl @@ -0,0 +1,10 @@ + +#ifdef GL_ES +precision mediump float; +#endif + +varying vec2 v_texCoord0; + +void main() { + gl_FragColor = vec4(v_texCoord0, 0.0, 1.0); +} \ No newline at end of file diff --git a/android/assets/data/shaders/testshader_vert.glsl b/android/assets/data/shaders/testshader_vert.glsl new file mode 100644 index 0000000..fdb4e81 --- /dev/null +++ b/android/assets/data/shaders/testshader_vert.glsl @@ -0,0 +1,13 @@ +attribute vec3 a_position; +attribute vec3 a_normal; +attribute vec2 a_texCoord0; + +uniform mat4 u_worldTrans; +uniform mat4 u_projViewTrans; + +varying vec2 v_texCoord0; + +void main() { + v_texCoord0 = a_texCoord0; + gl_Position = u_projViewTrans * u_worldTrans * vec4(a_position, 1.0); +} diff --git a/android/assets/data/textures/badlogic.jpg b/android/assets/data/textures/badlogic.jpg new file mode 100755 index 0000000..4390da6 Binary files /dev/null and b/android/assets/data/textures/badlogic.jpg differ diff --git a/android/assets/data/textures/dirt.png b/android/assets/data/textures/dirt.png new file mode 100755 index 0000000..29a20c3 Binary files /dev/null and b/android/assets/data/textures/dirt.png differ diff --git a/android/assets/data/textures/grass_side.png b/android/assets/data/textures/grass_side.png new file mode 100755 index 0000000..7df7c8f Binary files /dev/null and b/android/assets/data/textures/grass_side.png differ diff --git a/android/assets/data/textures/grass_top.png b/android/assets/data/textures/grass_top.png new file mode 100755 index 0000000..05c2f8a Binary files /dev/null and b/android/assets/data/textures/grass_top.png differ diff --git a/android/assets/data/textures/leaves.jpg b/android/assets/data/textures/leaves.jpg new file mode 100755 index 0000000..278bdc9 Binary files /dev/null and b/android/assets/data/textures/leaves.jpg differ diff --git a/android/assets/data/textures/stone.jpg b/android/assets/data/textures/stone.jpg new file mode 100755 index 0000000..91ac66a Binary files /dev/null and b/android/assets/data/textures/stone.jpg differ diff --git a/android/assets/data/textures/texture_atlas.png b/android/assets/data/textures/texture_atlas.png new file mode 100755 index 0000000..0c22621 Binary files /dev/null and b/android/assets/data/textures/texture_atlas.png differ diff --git a/android/assets/data/textures/wood_bottom_top.png b/android/assets/data/textures/wood_bottom_top.png new file mode 100755 index 0000000..c161de9 Binary files /dev/null and b/android/assets/data/textures/wood_bottom_top.png differ diff --git a/android/assets/data/textures/wood_side.png b/android/assets/data/textures/wood_side.png new file mode 100755 index 0000000..63ef62c Binary files /dev/null and b/android/assets/data/textures/wood_side.png differ diff --git a/android/assets/data/uiskin.atlas b/android/assets/data/uiskin.atlas new file mode 100755 index 0000000..d1f3db6 --- /dev/null +++ b/android/assets/data/uiskin.atlas @@ -0,0 +1,200 @@ + +uiskin.png +size: 256,128 +format: RGBA8888 +filter: Linear,Linear +repeat: none +check-off + rotate: false + xy: 11, 5 + size: 14, 14 + orig: 14, 14 + offset: 0, 0 + index: -1 +textfield + rotate: false + xy: 11, 5 + size: 14, 14 + split: 3, 3, 3, 3 + orig: 14, 14 + offset: 0, 0 + index: -1 +check-on + rotate: false + xy: 125, 35 + size: 14, 14 + orig: 14, 14 + offset: 0, 0 + index: -1 +cursor + rotate: false + xy: 23, 1 + size: 3, 3 + split: 1, 1, 1, 1 + orig: 3, 3 + offset: 0, 0 + index: -1 +default + rotate: false + xy: 1, 50 + size: 254, 77 + orig: 254, 77 + offset: 0, 0 + index: -1 +default-pane + rotate: false + xy: 11, 1 + size: 5, 3 + split: 1, 1, 1, 1 + orig: 5, 3 + offset: 0, 0 + index: -1 +default-rect-pad + rotate: false + xy: 11, 1 + size: 5, 3 + split: 1, 1, 1, 1 + orig: 5, 3 + offset: 0, 0 + index: -1 +default-pane-noborder + rotate: false + xy: 170, 44 + size: 1, 1 + split: 0, 0, 0, 0 + orig: 1, 1 + offset: 0, 0 + index: -1 +default-rect + rotate: false + xy: 38, 25 + size: 3, 3 + split: 1, 1, 1, 1 + orig: 3, 3 + offset: 0, 0 + index: -1 +default-rect-down + rotate: false + xy: 170, 46 + size: 3, 3 + split: 1, 1, 1, 1 + orig: 3, 3 + offset: 0, 0 + index: -1 +default-round + rotate: false + xy: 112, 29 + size: 12, 20 + split: 5, 5, 5, 4 + pad: 4, 4, 1, 1 + orig: 12, 20 + offset: 0, 0 + index: -1 +default-round-down + rotate: false + xy: 99, 29 + size: 12, 20 + split: 5, 5, 5, 4 + pad: 4, 4, 1, 1 + orig: 12, 20 + offset: 0, 0 + index: -1 +default-round-large + rotate: false + xy: 57, 29 + size: 20, 20 + split: 5, 5, 5, 4 + orig: 20, 20 + offset: 0, 0 + index: -1 +default-scroll + rotate: false + xy: 78, 29 + size: 20, 20 + split: 2, 2, 2, 2 + orig: 20, 20 + offset: 0, 0 + index: -1 +default-select + rotate: false + xy: 29, 29 + size: 27, 20 + split: 4, 14, 4, 4 + orig: 27, 20 + offset: 0, 0 + index: -1 +default-select-selection + rotate: false + xy: 26, 16 + size: 3, 3 + split: 1, 1, 1, 1 + orig: 3, 3 + offset: 0, 0 + index: -1 +default-slider + rotate: false + xy: 29, 20 + size: 8, 8 + split: 2, 2, 2, 2 + orig: 8, 8 + offset: 0, 0 + index: -1 +default-slider-knob + rotate: false + xy: 1, 1 + size: 9, 18 + orig: 9, 18 + offset: 0, 0 + index: -1 +default-splitpane + rotate: false + xy: 17, 1 + size: 5, 3 + split: 0, 5, 0, 0 + orig: 5, 3 + offset: 0, 0 + index: -1 +default-splitpane-vertical + rotate: false + xy: 125, 29 + size: 3, 5 + split: 0, 0, 0, 5 + orig: 3, 5 + offset: 0, 0 + index: -1 +default-window + rotate: false + xy: 1, 20 + size: 27, 29 + split: 4, 3, 20, 3 + orig: 27, 29 + offset: 0, 0 + index: -1 +selection + rotate: false + xy: 174, 48 + size: 1, 1 + orig: 1, 1 + offset: 0, 0 + index: -1 +tree-minus + rotate: false + xy: 140, 35 + size: 14, 14 + orig: 14, 14 + offset: 0, 0 + index: -1 +tree-plus + rotate: false + xy: 155, 35 + size: 14, 14 + orig: 14, 14 + offset: 0, 0 + index: -1 +white + rotate: false + xy: 129, 31 + size: 3, 3 + orig: 3, 3 + offset: 0, 0 + index: -1 diff --git a/android/assets/data/uiskin.json b/android/assets/data/uiskin.json new file mode 100755 index 0000000..9b301b0 --- /dev/null +++ b/android/assets/data/uiskin.json @@ -0,0 +1,70 @@ +{ +BitmapFont: { default-font: { file: default.fnt } }, +Color: { + green: { a: 1, b: 0, g: 1, r: 0 }, + white: { a: 1, b: 1, g: 1, r: 1 }, + red: { a: 1, b: 0, g: 0, r: 1 }, + black: { a: 1, b: 0, g: 0, r: 0 }, +}, +TintedDrawable: { + dialogDim: { name: white, color: { r: 0, g: 0, b: 0, a: 0.45 } }, +}, +ButtonStyle: { + default: { down: default-round-down, up: default-round }, + toggle: { parent: default, checked: default-round-down } +}, +TextButtonStyle: { + default: { parent: default, font: default-font, fontColor: white }, + toggle: { parent: default, checked: default-round-down, downFontColor: red } +}, +ScrollPaneStyle: { + default: { vScroll: default-scroll, hScrollKnob: default-round-large, background: default-rect, hScroll: default-scroll, vScrollKnob: default-round-large } +}, +SelectBoxStyle: { + default: { + font: default-font, fontColor: white, background: default-select, + scrollStyle: default, + listStyle: { font: default-font, selection: default-select-selection } + } +}, +SplitPaneStyle: { + default-vertical: { handle: default-splitpane-vertical }, + default-horizontal: { handle: default-splitpane } +}, +WindowStyle: { + default: { titleFont: default-font, background: default-window, titleFontColor: white }, + dialog: { parent: default, stageBackground: dialogDim } +}, +ProgressBarStyle: { + default-horizontal: { background: default-slider, knob: default-slider-knob }, + default-vertical: { background: default-slider, knob: default-round-large } +}, +SliderStyle: { + default-horizontal: { parent: default-horizontal }, + default-vertical: { parent: default-vertical } +}, +LabelStyle: { + default: { font: default-font, fontColor: white } +}, +TextFieldStyle: { + default: { selection: selection, background: textfield, font: default-font, fontColor: white, cursor: cursor } +}, +CheckBoxStyle: { + default: { checkboxOn: check-on, checkboxOff: check-off, font: default-font, fontColor: white } +}, +ListStyle: { + default: { fontColorUnselected: white, selection: selection, fontColorSelected: white, font: default-font } +}, +TouchpadStyle: { + default: { background: default-pane, knob: default-round-large } +}, +TreeStyle: { + default: { minus: tree-minus, plus: tree-plus, selection: default-select-selection } +}, +TextTooltipStyle: { + default: { + label: { font: default-font, fontColor: white }, + background: default-pane, wrapWidth: 150 + } +}, +} diff --git a/android/assets/data/uiskin.png b/android/assets/data/uiskin.png new file mode 100755 index 0000000..c1e5f1a Binary files /dev/null and b/android/assets/data/uiskin.png differ diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 0000000..b5bc6ba --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,92 @@ +android { + buildToolsVersion "29.0.2" + compileSdkVersion 29 + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src'] + aidl.srcDirs = ['src'] + renderscript.srcDirs = ['src'] + res.srcDirs = ['res'] + assets.srcDirs = ['assets'] + jniLibs.srcDirs = ['libs'] + } + + } + packagingOptions { + exclude 'META-INF/robovm/ios/robovm.xml' + } + defaultConfig { + applicationId "com.emamaker.amazeing" + minSdkVersion 14 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + + +// called every time gradle gets executed, takes the native dependencies of +// the natives configuration, and extracts them to the proper libs/ folders +// so they get packed with the APK. +task copyAndroidNatives { + doFirst { + file("libs/armeabi/").mkdirs() + file("libs/armeabi-v7a/").mkdirs() + file("libs/arm64-v8a/").mkdirs() + file("libs/x86_64/").mkdirs() + file("libs/x86/").mkdirs() + + configurations.natives.files.each { jar -> + def outputDir = null + if (jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a") + if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a") + if(jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi") + if(jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64") + if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86") + if(outputDir != null) { + copy { + from zipTree(jar) + into outputDir + include "*.so" + } + } + } + } +} + +tasks.whenTaskAdded { packageTask -> + if (packageTask.name.contains("package")) { + packageTask.dependsOn 'copyAndroidNatives' + } +} + +task run(type: Exec) { + def path + def localProperties = project.file("../local.properties") + if (localProperties.exists()) { + Properties properties = new Properties() + localProperties.withInputStream { instr -> + properties.load(instr) + } + def sdkDir = properties.getProperty('sdk.dir') + if (sdkDir) { + path = sdkDir + } else { + path = "$System.env.ANDROID_HOME" + } + } else { + path = "$System.env.ANDROID_HOME" + } + + def adb = path + "/platform-tools/adb" + commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.emamaker.amazeing/com.emamaker.amazeing.AndroidLauncher' +} + +eclipse.project.name = appName + "-android" diff --git a/android/ic_launcher-web.png b/android/ic_launcher-web.png new file mode 100644 index 0000000..8f0110d Binary files /dev/null and b/android/ic_launcher-web.png differ diff --git a/android/proguard-rules.pro b/android/proguard-rules.pro new file mode 100644 index 0000000..b166b1e --- /dev/null +++ b/android/proguard-rules.pro @@ -0,0 +1,45 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +-verbose + +-dontwarn android.support.** +-dontwarn com.badlogic.gdx.backends.android.AndroidFragmentApplication +-dontwarn com.badlogic.gdx.utils.GdxBuild +-dontwarn com.badlogic.gdx.physics.box2d.utils.Box2DBuild +-dontwarn com.badlogic.gdx.jnigen.BuildTarget* +-dontwarn com.badlogic.gdx.graphics.g2d.freetype.FreetypeBuild + +-keep class com.badlogic.gdx.controllers.android.AndroidControllers + +-keepclassmembers class com.badlogic.gdx.backends.android.AndroidInput* { + (com.badlogic.gdx.Application, android.content.Context, java.lang.Object, com.badlogic.gdx.backends.android.AndroidApplicationConfiguration); +} + +-keepclassmembers class com.badlogic.gdx.physics.box2d.World { + boolean contactFilter(long, long); + void beginContact(long); + void endContact(long); + void preSolve(long, long); + void postSolve(long, long); + boolean reportFixture(long); + float reportRayFixture(long, float, float, float, float, float); +} diff --git a/android/project.properties b/android/project.properties new file mode 100644 index 0000000..3fefa92 --- /dev/null +++ b/android/project.properties @@ -0,0 +1,9 @@ +# This file is used by the Eclipse ADT plugin. It is unnecessary for IDEA and Android Studio projects, which +# configure Proguard and the Android target via the build.gradle file. + +# To enable ProGuard to work with Eclipse ADT, uncomment this (available properties: sdk.dir, user.home) +# and ensure proguard.jar in the Android SDK is up to date (or alternately reduce the android target to 23 or lower): +# proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-rules.pro + +# Project target. +target=android-19 diff --git a/android/res/drawable-anydpi-v26/ic_launcher.xml b/android/res/drawable-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..6c7313a --- /dev/null +++ b/android/res/drawable-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/android/res/drawable-anydpi-v26/ic_launcher_foreground.xml b/android/res/drawable-anydpi-v26/ic_launcher_foreground.xml new file mode 100644 index 0000000..5916ee8 --- /dev/null +++ b/android/res/drawable-anydpi-v26/ic_launcher_foreground.xml @@ -0,0 +1,40 @@ + + + + + + + + + diff --git a/android/res/drawable-hdpi/ic_launcher.png b/android/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..91f696b Binary files /dev/null and b/android/res/drawable-hdpi/ic_launcher.png differ diff --git a/android/res/drawable-mdpi/ic_launcher.png b/android/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..c1ab239 Binary files /dev/null and b/android/res/drawable-mdpi/ic_launcher.png differ diff --git a/android/res/drawable-xhdpi/ic_launcher.png b/android/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..2011cc0 Binary files /dev/null and b/android/res/drawable-xhdpi/ic_launcher.png differ diff --git a/android/res/drawable-xxhdpi/ic_launcher.png b/android/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..25fcef0 Binary files /dev/null and b/android/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/android/res/drawable-xxxhdpi/ic_launcher.png b/android/res/drawable-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..d109946 Binary files /dev/null and b/android/res/drawable-xxxhdpi/ic_launcher.png differ diff --git a/android/res/values/color.xml b/android/res/values/color.xml new file mode 100644 index 0000000..933353e --- /dev/null +++ b/android/res/values/color.xml @@ -0,0 +1,4 @@ + + + #FFFFFFFF + diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml new file mode 100644 index 0000000..e80a425 --- /dev/null +++ b/android/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + AMazeIng + + diff --git a/android/res/values/styles.xml b/android/res/values/styles.xml new file mode 100644 index 0000000..3f00fc5 --- /dev/null +++ b/android/res/values/styles.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/android/src/com/emamaker/amazeing/AndroidLauncher.java b/android/src/com/emamaker/amazeing/AndroidLauncher.java new file mode 100644 index 0000000..4fa3293 --- /dev/null +++ b/android/src/com/emamaker/amazeing/AndroidLauncher.java @@ -0,0 +1,16 @@ +package com.emamaker.amazeing; + +import android.os.Bundle; + +import com.badlogic.gdx.backends.android.AndroidApplication; +import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; +import com.emamaker.amazeing.AMazeIng; + +public class AndroidLauncher extends AndroidApplication { + @Override + protected void onCreate (Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); + initialize(new AMazeIng(), config); + } +} diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..d746bcf --- /dev/null +++ b/build.gradle @@ -0,0 +1,123 @@ +buildscript { + + + repositories { + mavenLocal() + mavenCentral() + maven { url "https://plugins.gradle.org/m2/" } + maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } + jcenter() + google() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.4.1' + classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.8' + + + } +} + +allprojects { + apply plugin: "eclipse" + + version = '1.0' + ext { + appName = "AMazeIng" + gdxVersion = '1.9.10' + roboVMVersion = '2.3.8' + box2DLightsVersion = '1.4' + ashleyVersion = '1.7.0' + aiVersion = '1.8.0' + } + + repositories { + mavenLocal() + mavenCentral() + jcenter() + google() + maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } + maven { url "https://oss.sonatype.org/content/repositories/releases/" } + } +} + +project(":desktop") { + apply plugin: "java-library" + + + dependencies { + implementation project(":core") + api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + api "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-desktop" + api "com.badlogicgames.gdx:gdx-tools:$gdxVersion" + api "com.badlogicgames.gdx:gdx-controllers-desktop:$gdxVersion" + api "com.badlogicgames.gdx:gdx-controllers-platform:$gdxVersion:natives-desktop" + api "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" + + } +} + +project(":android") { + apply plugin: "android" + + configurations { natives } + + dependencies { + implementation project(":core") + api "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion" + natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi" + natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a" + natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a" + natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86" + natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64" + api "com.badlogicgames.gdx:gdx-bullet:$gdxVersion" + natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi" + natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi-v7a" + natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-arm64-v8a" + natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86" + natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86_64" + api "com.badlogicgames.ashley:ashley:$ashleyVersion" + api "com.badlogicgames.gdx:gdx-ai:$aiVersion" + api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" + api "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion" + api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" + natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi" + natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a" + natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a" + natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86" + natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64" + + } +} + +project(":ios") { + apply plugin: "java-library" + apply plugin: "robovm" + + + dependencies { + implementation project(":core") + api "com.mobidevelop.robovm:robovm-rt:$roboVMVersion" + api "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion" + api "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion" + api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios" + api "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-ios" + api "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios" + + } +} + +project(":core") { + apply plugin: "java-library" + + + dependencies { + api "com.badlogicgames.gdx:gdx:$gdxVersion" + api "com.badlogicgames.gdx:gdx-bullet:$gdxVersion" + api "com.badlogicgames.ashley:ashley:$ashleyVersion" + api "com.badlogicgames.gdx:gdx-ai:$aiVersion" + api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" + api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" + + } +} diff --git a/core/assets/data/default.fnt b/core/assets/data/default.fnt new file mode 100755 index 0000000..6152b0a --- /dev/null +++ b/core/assets/data/default.fnt @@ -0,0 +1,101 @@ +info face="Droid Sans" size=17 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 +common lineHeight=20 base=18 scaleW=256 scaleH=128 pages=1 packed=0 +page id=0 file="default.png" +chars count=96 +char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=16 xadvance=4 page=0 chnl=0 +char id=124 x=0 y=0 width=6 height=20 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=106 x=6 y=0 width=9 height=20 xoffset=-4 yoffset=3 xadvance=4 page=0 chnl=0 +char id=81 x=15 y=0 width=15 height=19 xoffset=-2 yoffset=3 xadvance=12 page=0 chnl=0 +char id=74 x=30 y=0 width=11 height=19 xoffset=-5 yoffset=3 xadvance=4 page=0 chnl=0 +char id=125 x=41 y=0 width=10 height=18 xoffset=-3 yoffset=3 xadvance=6 page=0 chnl=0 +char id=123 x=51 y=0 width=10 height=18 xoffset=-3 yoffset=3 xadvance=6 page=0 chnl=0 +char id=93 x=61 y=0 width=8 height=18 xoffset=-3 yoffset=3 xadvance=5 page=0 chnl=0 +char id=91 x=69 y=0 width=8 height=18 xoffset=-2 yoffset=3 xadvance=5 page=0 chnl=0 +char id=41 x=77 y=0 width=9 height=18 xoffset=-3 yoffset=3 xadvance=5 page=0 chnl=0 +char id=40 x=86 y=0 width=9 height=18 xoffset=-3 yoffset=3 xadvance=5 page=0 chnl=0 +char id=64 x=95 y=0 width=18 height=17 xoffset=-3 yoffset=3 xadvance=14 page=0 chnl=0 +char id=121 x=113 y=0 width=13 height=17 xoffset=-3 yoffset=6 xadvance=8 page=0 chnl=0 +char id=113 x=126 y=0 width=13 height=17 xoffset=-3 yoffset=6 xadvance=9 page=0 chnl=0 +char id=112 x=139 y=0 width=13 height=17 xoffset=-2 yoffset=6 xadvance=9 page=0 chnl=0 +char id=103 x=152 y=0 width=13 height=17 xoffset=-3 yoffset=6 xadvance=8 page=0 chnl=0 +char id=38 x=165 y=0 width=16 height=16 xoffset=-3 yoffset=3 xadvance=11 page=0 chnl=0 +char id=37 x=181 y=0 width=18 height=16 xoffset=-3 yoffset=3 xadvance=14 page=0 chnl=0 +char id=36 x=199 y=0 width=12 height=16 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0 +char id=63 x=211 y=0 width=11 height=16 xoffset=-3 yoffset=3 xadvance=7 page=0 chnl=0 +char id=33 x=222 y=0 width=7 height=16 xoffset=-2 yoffset=3 xadvance=4 page=0 chnl=0 +char id=48 x=229 y=0 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=57 x=242 y=0 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=56 x=0 y=20 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=54 x=13 y=20 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=53 x=26 y=20 width=12 height=16 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0 +char id=51 x=38 y=20 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=100 x=51 y=20 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=98 x=64 y=20 width=13 height=16 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0 +char id=85 x=77 y=20 width=14 height=16 xoffset=-2 yoffset=3 xadvance=11 page=0 chnl=0 +char id=83 x=91 y=20 width=13 height=16 xoffset=-3 yoffset=3 xadvance=8 page=0 chnl=0 +char id=79 x=104 y=20 width=15 height=16 xoffset=-2 yoffset=3 xadvance=12 page=0 chnl=0 +char id=71 x=119 y=20 width=14 height=16 xoffset=-2 yoffset=3 xadvance=11 page=0 chnl=0 +char id=67 x=133 y=20 width=13 height=16 xoffset=-2 yoffset=3 xadvance=10 page=0 chnl=0 +char id=127 x=146 y=20 width=12 height=15 xoffset=-2 yoffset=3 xadvance=10 page=0 chnl=0 +char id=35 x=158 y=20 width=15 height=15 xoffset=-3 yoffset=3 xadvance=10 page=0 chnl=0 +char id=92 x=173 y=20 width=11 height=15 xoffset=-3 yoffset=3 xadvance=6 page=0 chnl=0 +char id=47 x=184 y=20 width=11 height=15 xoffset=-3 yoffset=3 xadvance=6 page=0 chnl=0 +char id=59 x=195 y=20 width=8 height=15 xoffset=-3 yoffset=6 xadvance=4 page=0 chnl=0 +char id=55 x=203 y=20 width=13 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=52 x=216 y=20 width=14 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=50 x=230 y=20 width=13 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=49 x=243 y=20 width=9 height=15 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0 +char id=116 x=0 y=36 width=10 height=15 xoffset=-3 yoffset=4 xadvance=5 page=0 chnl=0 +char id=108 x=10 y=36 width=6 height=15 xoffset=-2 yoffset=3 xadvance=4 page=0 chnl=0 +char id=107 x=16 y=36 width=12 height=15 xoffset=-2 yoffset=3 xadvance=8 page=0 chnl=0 +char id=105 x=28 y=36 width=7 height=15 xoffset=-2 yoffset=3 xadvance=4 page=0 chnl=0 +char id=104 x=35 y=36 width=12 height=15 xoffset=-2 yoffset=3 xadvance=10 page=0 chnl=0 +char id=102 x=47 y=36 width=11 height=15 xoffset=-3 yoffset=3 xadvance=5 page=0 chnl=0 +char id=90 x=58 y=36 width=13 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=89 x=71 y=36 width=13 height=15 xoffset=-3 yoffset=3 xadvance=8 page=0 chnl=0 +char id=88 x=84 y=36 width=14 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=87 x=98 y=36 width=19 height=15 xoffset=-3 yoffset=3 xadvance=15 page=0 chnl=0 +char id=86 x=117 y=36 width=14 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=84 x=131 y=36 width=13 height=15 xoffset=-3 yoffset=3 xadvance=8 page=0 chnl=0 +char id=82 x=144 y=36 width=13 height=15 xoffset=-2 yoffset=3 xadvance=10 page=0 chnl=0 +char id=80 x=157 y=36 width=12 height=15 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0 +char id=78 x=169 y=36 width=14 height=15 xoffset=-2 yoffset=3 xadvance=12 page=0 chnl=0 +char id=77 x=183 y=36 width=17 height=15 xoffset=-2 yoffset=3 xadvance=14 page=0 chnl=0 +char id=76 x=200 y=36 width=11 height=15 xoffset=-2 yoffset=3 xadvance=8 page=0 chnl=0 +char id=75 x=211 y=36 width=13 height=15 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0 +char id=73 x=224 y=36 width=10 height=15 xoffset=-3 yoffset=3 xadvance=5 page=0 chnl=0 +char id=72 x=234 y=36 width=14 height=15 xoffset=-2 yoffset=3 xadvance=11 page=0 chnl=0 +char id=70 x=0 y=51 width=11 height=15 xoffset=-2 yoffset=3 xadvance=8 page=0 chnl=0 +char id=69 x=11 y=51 width=11 height=15 xoffset=-2 yoffset=3 xadvance=8 page=0 chnl=0 +char id=68 x=22 y=51 width=14 height=15 xoffset=-2 yoffset=3 xadvance=11 page=0 chnl=0 +char id=66 x=36 y=51 width=13 height=15 xoffset=-2 yoffset=3 xadvance=10 page=0 chnl=0 +char id=65 x=49 y=51 width=15 height=15 xoffset=-3 yoffset=3 xadvance=10 page=0 chnl=0 +char id=58 x=64 y=51 width=7 height=13 xoffset=-2 yoffset=6 xadvance=4 page=0 chnl=0 +char id=117 x=71 y=51 width=12 height=13 xoffset=-2 yoffset=6 xadvance=10 page=0 chnl=0 +char id=115 x=83 y=51 width=11 height=13 xoffset=-3 yoffset=6 xadvance=7 page=0 chnl=0 +char id=111 x=94 y=51 width=13 height=13 xoffset=-3 yoffset=6 xadvance=9 page=0 chnl=0 +char id=101 x=107 y=51 width=13 height=13 xoffset=-3 yoffset=6 xadvance=9 page=0 chnl=0 +char id=99 x=120 y=51 width=12 height=13 xoffset=-3 yoffset=6 xadvance=7 page=0 chnl=0 +char id=97 x=132 y=51 width=12 height=13 xoffset=-3 yoffset=6 xadvance=9 page=0 chnl=0 +char id=60 x=144 y=51 width=13 height=12 xoffset=-3 yoffset=5 xadvance=9 page=0 chnl=0 +char id=122 x=157 y=51 width=11 height=12 xoffset=-3 yoffset=6 xadvance=7 page=0 chnl=0 +char id=120 x=168 y=51 width=13 height=12 xoffset=-3 yoffset=6 xadvance=8 page=0 chnl=0 +char id=119 x=181 y=51 width=17 height=12 xoffset=-3 yoffset=6 xadvance=12 page=0 chnl=0 +char id=118 x=198 y=51 width=13 height=12 xoffset=-3 yoffset=6 xadvance=8 page=0 chnl=0 +char id=114 x=211 y=51 width=10 height=12 xoffset=-2 yoffset=6 xadvance=6 page=0 chnl=0 +char id=110 x=221 y=51 width=12 height=12 xoffset=-2 yoffset=6 xadvance=10 page=0 chnl=0 +char id=109 x=233 y=51 width=17 height=12 xoffset=-2 yoffset=6 xadvance=15 page=0 chnl=0 +char id=94 x=0 y=66 width=13 height=11 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=62 x=13 y=66 width=13 height=11 xoffset=-3 yoffset=5 xadvance=9 page=0 chnl=0 +char id=42 x=26 y=66 width=13 height=10 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=43 x=39 y=66 width=13 height=10 xoffset=-3 yoffset=6 xadvance=9 page=0 chnl=0 +char id=61 x=52 y=66 width=13 height=8 xoffset=-3 yoffset=7 xadvance=9 page=0 chnl=0 +char id=39 x=65 y=66 width=6 height=8 xoffset=-2 yoffset=3 xadvance=3 page=0 chnl=0 +char id=34 x=71 y=66 width=9 height=8 xoffset=-2 yoffset=3 xadvance=6 page=0 chnl=0 +char id=44 x=80 y=66 width=8 height=7 xoffset=-3 yoffset=14 xadvance=4 page=0 chnl=0 +char id=126 x=88 y=66 width=13 height=6 xoffset=-3 yoffset=8 xadvance=9 page=0 chnl=0 +char id=46 x=101 y=66 width=7 height=6 xoffset=-2 yoffset=13 xadvance=4 page=0 chnl=0 +char id=96 x=108 y=66 width=8 height=6 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 +char id=45 x=116 y=66 width=9 height=5 xoffset=-3 yoffset=10 xadvance=5 page=0 chnl=0 +char id=95 x=125 y=66 width=13 height=4 xoffset=-4 yoffset=17 xadvance=6 page=0 chnl=0 +kernings count=-1 diff --git a/core/assets/data/shaders/testshader_frag.glsl b/core/assets/data/shaders/testshader_frag.glsl new file mode 100644 index 0000000..6862ea6 --- /dev/null +++ b/core/assets/data/shaders/testshader_frag.glsl @@ -0,0 +1,10 @@ + +#ifdef GL_ES +precision mediump float; +#endif + +varying vec2 v_texCoord0; + +void main() { + gl_FragColor = vec4(v_texCoord0, 0.0, 1.0); +} \ No newline at end of file diff --git a/core/assets/data/shaders/testshader_vert.glsl b/core/assets/data/shaders/testshader_vert.glsl new file mode 100644 index 0000000..fdb4e81 --- /dev/null +++ b/core/assets/data/shaders/testshader_vert.glsl @@ -0,0 +1,13 @@ +attribute vec3 a_position; +attribute vec3 a_normal; +attribute vec2 a_texCoord0; + +uniform mat4 u_worldTrans; +uniform mat4 u_projViewTrans; + +varying vec2 v_texCoord0; + +void main() { + v_texCoord0 = a_texCoord0; + gl_Position = u_projViewTrans * u_worldTrans * vec4(a_position, 1.0); +} diff --git a/core/assets/data/textures/badlogic.jpg b/core/assets/data/textures/badlogic.jpg new file mode 100755 index 0000000..4390da6 Binary files /dev/null and b/core/assets/data/textures/badlogic.jpg differ diff --git a/core/assets/data/textures/dirt.png b/core/assets/data/textures/dirt.png new file mode 100755 index 0000000..29a20c3 Binary files /dev/null and b/core/assets/data/textures/dirt.png differ diff --git a/core/assets/data/textures/grass_side.png b/core/assets/data/textures/grass_side.png new file mode 100755 index 0000000..7df7c8f Binary files /dev/null and b/core/assets/data/textures/grass_side.png differ diff --git a/core/assets/data/textures/grass_top.png b/core/assets/data/textures/grass_top.png new file mode 100755 index 0000000..05c2f8a Binary files /dev/null and b/core/assets/data/textures/grass_top.png differ diff --git a/core/assets/data/textures/leaves.jpg b/core/assets/data/textures/leaves.jpg new file mode 100755 index 0000000..278bdc9 Binary files /dev/null and b/core/assets/data/textures/leaves.jpg differ diff --git a/core/assets/data/textures/stone.jpg b/core/assets/data/textures/stone.jpg new file mode 100755 index 0000000..91ac66a Binary files /dev/null and b/core/assets/data/textures/stone.jpg differ diff --git a/core/assets/data/textures/texture_atlas.png b/core/assets/data/textures/texture_atlas.png new file mode 100755 index 0000000..0c22621 Binary files /dev/null and b/core/assets/data/textures/texture_atlas.png differ diff --git a/core/assets/data/textures/wood_bottom_top.png b/core/assets/data/textures/wood_bottom_top.png new file mode 100755 index 0000000..c161de9 Binary files /dev/null and b/core/assets/data/textures/wood_bottom_top.png differ diff --git a/core/assets/data/textures/wood_side.png b/core/assets/data/textures/wood_side.png new file mode 100755 index 0000000..63ef62c Binary files /dev/null and b/core/assets/data/textures/wood_side.png differ diff --git a/core/assets/data/uiskin.atlas b/core/assets/data/uiskin.atlas new file mode 100755 index 0000000..d1f3db6 --- /dev/null +++ b/core/assets/data/uiskin.atlas @@ -0,0 +1,200 @@ + +uiskin.png +size: 256,128 +format: RGBA8888 +filter: Linear,Linear +repeat: none +check-off + rotate: false + xy: 11, 5 + size: 14, 14 + orig: 14, 14 + offset: 0, 0 + index: -1 +textfield + rotate: false + xy: 11, 5 + size: 14, 14 + split: 3, 3, 3, 3 + orig: 14, 14 + offset: 0, 0 + index: -1 +check-on + rotate: false + xy: 125, 35 + size: 14, 14 + orig: 14, 14 + offset: 0, 0 + index: -1 +cursor + rotate: false + xy: 23, 1 + size: 3, 3 + split: 1, 1, 1, 1 + orig: 3, 3 + offset: 0, 0 + index: -1 +default + rotate: false + xy: 1, 50 + size: 254, 77 + orig: 254, 77 + offset: 0, 0 + index: -1 +default-pane + rotate: false + xy: 11, 1 + size: 5, 3 + split: 1, 1, 1, 1 + orig: 5, 3 + offset: 0, 0 + index: -1 +default-rect-pad + rotate: false + xy: 11, 1 + size: 5, 3 + split: 1, 1, 1, 1 + orig: 5, 3 + offset: 0, 0 + index: -1 +default-pane-noborder + rotate: false + xy: 170, 44 + size: 1, 1 + split: 0, 0, 0, 0 + orig: 1, 1 + offset: 0, 0 + index: -1 +default-rect + rotate: false + xy: 38, 25 + size: 3, 3 + split: 1, 1, 1, 1 + orig: 3, 3 + offset: 0, 0 + index: -1 +default-rect-down + rotate: false + xy: 170, 46 + size: 3, 3 + split: 1, 1, 1, 1 + orig: 3, 3 + offset: 0, 0 + index: -1 +default-round + rotate: false + xy: 112, 29 + size: 12, 20 + split: 5, 5, 5, 4 + pad: 4, 4, 1, 1 + orig: 12, 20 + offset: 0, 0 + index: -1 +default-round-down + rotate: false + xy: 99, 29 + size: 12, 20 + split: 5, 5, 5, 4 + pad: 4, 4, 1, 1 + orig: 12, 20 + offset: 0, 0 + index: -1 +default-round-large + rotate: false + xy: 57, 29 + size: 20, 20 + split: 5, 5, 5, 4 + orig: 20, 20 + offset: 0, 0 + index: -1 +default-scroll + rotate: false + xy: 78, 29 + size: 20, 20 + split: 2, 2, 2, 2 + orig: 20, 20 + offset: 0, 0 + index: -1 +default-select + rotate: false + xy: 29, 29 + size: 27, 20 + split: 4, 14, 4, 4 + orig: 27, 20 + offset: 0, 0 + index: -1 +default-select-selection + rotate: false + xy: 26, 16 + size: 3, 3 + split: 1, 1, 1, 1 + orig: 3, 3 + offset: 0, 0 + index: -1 +default-slider + rotate: false + xy: 29, 20 + size: 8, 8 + split: 2, 2, 2, 2 + orig: 8, 8 + offset: 0, 0 + index: -1 +default-slider-knob + rotate: false + xy: 1, 1 + size: 9, 18 + orig: 9, 18 + offset: 0, 0 + index: -1 +default-splitpane + rotate: false + xy: 17, 1 + size: 5, 3 + split: 0, 5, 0, 0 + orig: 5, 3 + offset: 0, 0 + index: -1 +default-splitpane-vertical + rotate: false + xy: 125, 29 + size: 3, 5 + split: 0, 0, 0, 5 + orig: 3, 5 + offset: 0, 0 + index: -1 +default-window + rotate: false + xy: 1, 20 + size: 27, 29 + split: 4, 3, 20, 3 + orig: 27, 29 + offset: 0, 0 + index: -1 +selection + rotate: false + xy: 174, 48 + size: 1, 1 + orig: 1, 1 + offset: 0, 0 + index: -1 +tree-minus + rotate: false + xy: 140, 35 + size: 14, 14 + orig: 14, 14 + offset: 0, 0 + index: -1 +tree-plus + rotate: false + xy: 155, 35 + size: 14, 14 + orig: 14, 14 + offset: 0, 0 + index: -1 +white + rotate: false + xy: 129, 31 + size: 3, 3 + orig: 3, 3 + offset: 0, 0 + index: -1 diff --git a/core/assets/data/uiskin.json b/core/assets/data/uiskin.json new file mode 100755 index 0000000..9b301b0 --- /dev/null +++ b/core/assets/data/uiskin.json @@ -0,0 +1,70 @@ +{ +BitmapFont: { default-font: { file: default.fnt } }, +Color: { + green: { a: 1, b: 0, g: 1, r: 0 }, + white: { a: 1, b: 1, g: 1, r: 1 }, + red: { a: 1, b: 0, g: 0, r: 1 }, + black: { a: 1, b: 0, g: 0, r: 0 }, +}, +TintedDrawable: { + dialogDim: { name: white, color: { r: 0, g: 0, b: 0, a: 0.45 } }, +}, +ButtonStyle: { + default: { down: default-round-down, up: default-round }, + toggle: { parent: default, checked: default-round-down } +}, +TextButtonStyle: { + default: { parent: default, font: default-font, fontColor: white }, + toggle: { parent: default, checked: default-round-down, downFontColor: red } +}, +ScrollPaneStyle: { + default: { vScroll: default-scroll, hScrollKnob: default-round-large, background: default-rect, hScroll: default-scroll, vScrollKnob: default-round-large } +}, +SelectBoxStyle: { + default: { + font: default-font, fontColor: white, background: default-select, + scrollStyle: default, + listStyle: { font: default-font, selection: default-select-selection } + } +}, +SplitPaneStyle: { + default-vertical: { handle: default-splitpane-vertical }, + default-horizontal: { handle: default-splitpane } +}, +WindowStyle: { + default: { titleFont: default-font, background: default-window, titleFontColor: white }, + dialog: { parent: default, stageBackground: dialogDim } +}, +ProgressBarStyle: { + default-horizontal: { background: default-slider, knob: default-slider-knob }, + default-vertical: { background: default-slider, knob: default-round-large } +}, +SliderStyle: { + default-horizontal: { parent: default-horizontal }, + default-vertical: { parent: default-vertical } +}, +LabelStyle: { + default: { font: default-font, fontColor: white } +}, +TextFieldStyle: { + default: { selection: selection, background: textfield, font: default-font, fontColor: white, cursor: cursor } +}, +CheckBoxStyle: { + default: { checkboxOn: check-on, checkboxOff: check-off, font: default-font, fontColor: white } +}, +ListStyle: { + default: { fontColorUnselected: white, selection: selection, fontColorSelected: white, font: default-font } +}, +TouchpadStyle: { + default: { background: default-pane, knob: default-round-large } +}, +TreeStyle: { + default: { minus: tree-minus, plus: tree-plus, selection: default-select-selection } +}, +TextTooltipStyle: { + default: { + label: { font: default-font, fontColor: white }, + background: default-pane, wrapWidth: 150 + } +}, +} diff --git a/core/assets/data/uiskin.png b/core/assets/data/uiskin.png new file mode 100755 index 0000000..c1e5f1a Binary files /dev/null and b/core/assets/data/uiskin.png differ diff --git a/core/build.gradle b/core/build.gradle new file mode 100644 index 0000000..2abc640 --- /dev/null +++ b/core/build.gradle @@ -0,0 +1,8 @@ +apply plugin: "java" + +sourceCompatibility = 1.7 +[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' + +sourceSets.main.java.srcDirs = [ "src/" ] + +eclipse.project.name = appName + "-core" diff --git a/core/src/com/emamaker/amazeing/AMazeIng.java b/core/src/com/emamaker/amazeing/AMazeIng.java new file mode 100755 index 0000000..124fbfa --- /dev/null +++ b/core/src/com/emamaker/amazeing/AMazeIng.java @@ -0,0 +1,87 @@ +package com.emamaker.amazeing; + +import java.util.Random; + +import com.badlogic.gdx.Game; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.InputMultiplexer; +import com.badlogic.gdx.graphics.FPSLogger; +import com.badlogic.gdx.physics.bullet.Bullet; +import com.emamaker.amazeing.manager.GameManager; +import com.emamaker.amazeing.ui.UIManager; +import com.emamaker.voxelengine.VoxelWorld; + +public class AMazeIng extends Game { + + public VoxelWorld world = new VoxelWorld(); + FPSLogger fps = new FPSLogger(); + boolean generated = false; + boolean gui=false; + Random rand = new Random(); + + public UIManager uiManager; + public GameManager gameManager; + public InputMultiplexer multiplexer = new InputMultiplexer(); + + + @Override + public void create() { + //Bullet init for physics + Bullet.init(); + + //Set windowed resolution + Gdx.graphics.setWindowedMode(1280, 720); + + //Voxel engine init. Call everything after this + world.init(this); + world.worldManager.generateChunks = false; + world.worldManager.updateChunks = true; + + //Disable VoxelEngines's integrated camera input processor + Gdx.input.setInputProcessor(multiplexer); + + generated = false; + setupGUI(); + setupGameManager(); + } + + public void setupGUI() { + uiManager = new UIManager(this); + System.out.println("Setup UI Manager"); + } + + public void setupGameManager() { + gameManager = new GameManager(this); + System.out.println("Setup Game Manager"); + } + + float delta; + @Override + public void render() { + super.render(); + if(gameManager != null) gameManager.update(); + } + + @Override + public void dispose() { + world.dispose(); + gameManager.dispose(); + } + + @Override + public void resize(int width, int height) { + world.resize(width, height); + this.getScreen().resize(width, height); + } + + @Override + public void pause() { + world.pause(); + } + + @Override + public void resume() { + world.resume(); + } + +} diff --git a/core/src/com/emamaker/amazeing/manager/GameManager.java b/core/src/com/emamaker/amazeing/manager/GameManager.java new file mode 100644 index 0000000..cbbdb23 --- /dev/null +++ b/core/src/com/emamaker/amazeing/manager/GameManager.java @@ -0,0 +1,185 @@ +package com.emamaker.amazeing.manager; + +import java.util.ArrayList; +import java.util.Random; +import java.util.Set; + +import com.badlogic.gdx.Game; +import com.badlogic.gdx.math.Vector3; +import com.emamaker.amazeing.AMazeIng; +import com.emamaker.amazeing.maze.MazeGenerator; +import com.emamaker.amazeing.maze.MazeSettings; +import com.emamaker.amazeing.player.MazePlayer; +import com.emamaker.voxelengine.block.CellId; +import com.emamaker.voxelengine.player.Player; +import com.emamaker.voxelengine.utils.VoxelSettings; + +public class GameManager { + + public MazeGenerator mazeGen; + public boolean gameStarted = false; + Random rand = new Random(); + AMazeIng main; + + ArrayList players = new ArrayList(); + + public GameManager(Game main_) { + main = (AMazeIng) main_; + gameStarted = false; + + // Maze Generation + mazeGen = new MazeGenerator(main, MazeSettings.MAZEX, MazeSettings.MAZEZ); + } + + boolean anyoneWon = false; + + public void update() { + if (gameStarted) { + main.world.cam.position.set(mazeGen.w / 2, VoxelSettings.chunkSize * 1.25f, mazeGen.h / 2); + main.world.cam.lookAt(mazeGen.w / 2, 0, mazeGen.h / 2); + main.world.cam.update(); + main.world.render(); + + main.world.modelBatch.begin(main.world.cam); + for (MazePlayer p : players) { + p.render(main.world.modelBatch, main.world.environment); + anyoneWon = false; + if (checkWin(p)) { + anyoneWon = true; + gameStarted = false; + break; + } + } + + if (anyoneWon) { +// destroyPlayers(); + main.setScreen(main.uiManager.playersScreen); + } + main.world.modelBatch.end(); + } + } + + ArrayList toDelete = new ArrayList(); + public void generateMaze(Set pl) { + anyoneWon = false; + + // Only add new players and dispose the old ones + //Check if actually there are players to be deleted + for (MazePlayer p : players) + if (!pl.contains(p)) + toDelete.add(p); + + //Check if new players have to be added + for (MazePlayer p : pl) + if (!players.contains(p)) + players.add(p); + + //Fianlly delete players. A separated step is needed to remove the risk of a ConcurrentModificationException + for(MazePlayer p : toDelete) { + p.dispose(); + players.remove(p); + } + toDelete.clear(); +// destroyPlayers(); +// players.addAll(p); + + for (int i = 0; i < MazeSettings.MAZEX; i++) { + for (int j = 0; j < 2; j++) { + for (int k = 0; k < MazeSettings.MAZEZ; k++) { + main.world.worldManager.setCell(i, j, k, CellId.ID_AIR); + } + } + } + + mazeGen.setMazeSize(MazeSettings.MAZEX, MazeSettings.MAZEZ); + mazeGen.generateMaze(); + + // Set camera + main.world.cam.lookAt(mazeGen.w / 2, 0, mazeGen.h / 2); + main.world.cam.rotate(Vector3.X, 135); + main.world.cam.update(); + + // Init the player with relative movement keys +// players.add(generateNewPlayer(Keys.W, Keys.S, Keys.A, Keys.D)); +// players.add(generateNewPlayer(Keys.UP, Keys.DOWN, Keys.LEFT, Keys.RIGHT)); + spreadPlayers(); + gameStarted = true; + + } + + public void spreadPlayers() { + for (MazePlayer p : players) { + int x = 1, z = 1; + do { + x = (Math.abs(rand.nextInt() - 1) % (mazeGen.w)); + z = (Math.abs(rand.nextInt() - 1) % (mazeGen.h)); +// System.out.println(thereIsPlayerInPos(x, z) + " - " + mazeGen.occupiedSpot(x, +// z) + " --- " + x + ", " + z); + // while there's a wall in current location pick new location + } while (thereIsPlayerInPos(x, z) || mazeGen.occupiedSpot(x, z)); + p.setPlaying(); + p.setPos(x + 0.5f, 2f, z + 0.5f); + } + + } + + Player generateNewPlayer(int kup, int kdown, int ksx, int kdx) { + return generateNewPlayer(kup, kdown, ksx, kdx, ""); + } + + Player generateNewPlayer(int kup, int kdown, int ksx, int kdx, String name) { + int x, z; + do { + x = (Math.abs(rand.nextInt() - 1) % (mazeGen.w)); + z = (Math.abs(rand.nextInt() - 1) % (mazeGen.h)); + // System.out.println(thereIsPlayerInPos(x, z) + " - " + mazeGen.occupiedSpot(x, + // z) + " --- " + x + ", " + z); + // while there's a wall in current location pick new location + } while (thereIsPlayerInPos(x, z) || mazeGen.occupiedSpot(x, z)); + if (name.equalsIgnoreCase("")) + return new Player(kup, kdown, ksx, kdx, x + 0.5f, 4f, z + 0.5f); + else + return new Player(kup, kdown, ksx, kdx, x + 0.5f, 4f, z + 0.5f, name); + } + +// public void destroyPlayers() { +// for (MazePlayer p : players) +// p.dispose(); +// players.clear(); +// } + + public boolean checkWin(MazePlayer p) { + if ((int) p.getPos().x == mazeGen.WINX && (int) p.getPos().z == mazeGen.WINZ) { + System.out.println(p.getName() + " won"); + return true; + } + return false; + } + + public boolean thereIsPlayerInPos(int x, int z) { + for (MazePlayer p : players) { + if ((int) p.getPos().x == x || (int) p.getPos().z == z) + return true; + } + return false; + } + + public boolean areTherePlayersNearby(int x, int z, int range) { + int i, k; + for (MazePlayer p : players) { + i = (int) p.getPos().x; + k = (int) p.getPos().z; + + if ((x - i) * (x - i) + (k - z) * (k - z) <= range * range) + return true; + } + + return false; + } + + public void dispose() { + for (MazePlayer p : players) + p.dispose(); + } + +} diff --git a/core/src/com/emamaker/amazeing/maze/MazeGenerator.java b/core/src/com/emamaker/amazeing/maze/MazeGenerator.java new file mode 100755 index 0000000..e97a4bf --- /dev/null +++ b/core/src/com/emamaker/amazeing/maze/MazeGenerator.java @@ -0,0 +1,246 @@ +package com.emamaker.amazeing.maze; + +import java.util.ArrayList; +import java.util.Random; + +import com.emamaker.amazeing.AMazeIng; +import com.emamaker.voxelengine.block.CellId; + +public class MazeGenerator { + + AMazeIng main; + Random rand = new Random(); + + Cell currentCell; + Cell[][] cellsGrid; + ArrayList stack = new ArrayList(); + public int[][] todraw; + + public int w, h, W, H; + public int EP_DIST = 5; + public int WINX, WINZ; + + public MazeGenerator(AMazeIng game) { + this(game, 20, 20); + } + + public MazeGenerator(AMazeIng game, int dimx, int dimy) { + main = game; + setMazeSize(dimx, dimy); + } + + public void setMazeSize(int w_, int h_) { + w = w_+(1-w%2); + h = h_+(1-h%2); + W = (w-1) / 2; + H = (h-1) / 2; +// W = w_; +// H = h_; +// +// w = 2 * W + 1; +// h = 2 * H + 1; + + /* + * w-1 = 2*W + * W = w-1) + */ + + cellsGrid = new Cell[W][H]; + todraw = new int[w][h]; + System.out.println(W + "*" + H + " --- " + w + "*" + h); + } + + public void generateMaze() { + // init cells + for (int i = 0; i < W; i++) { + for (int j = 0; j < H; j++) { + cellsGrid[i][j] = new Cell(i, j, this); + } + } + + currentCell = cellsGrid[0][0]; + + // while there are unvisited cells + while (!allCellsVisited()) { + // mark current as visisted + currentCell.visited = true; + + // check for unvisited neighbours + Cell[] neighbours = currentCell.unvisitedNeighbours(); + + // if the cell has unvisited neighbours + if (neighbours.length > 0) { + // Randomly choose one + Cell n = neighbours[rand.nextInt(neighbours.length)]; + + // Push current cell to the stack + stack.add(currentCell); + + // Delete the walls + if (n.x == currentCell.x + 1) { + // right + currentCell.walls[1] = false; + n.walls[3] = false; + } + if (n.x == currentCell.x - 1) { + // left + currentCell.walls[3] = false; + n.walls[1] = false; + } + if (n.y == currentCell.y + 1) { + // up + currentCell.walls[2] = false; + n.walls[0] = false; + } + if (n.y == currentCell.y - 1) { + // down + currentCell.walls[0] = false; + n.walls[2] = false; + } + currentCell.current = false; + currentCell = n; + currentCell.current = true; + } else if (!stack.isEmpty()) { + currentCell.current = false; + // pop a cell from the custom and make it the current one + currentCell = stack.get(stack.size() - 1); + stack.remove(stack.size() - 1); + currentCell.current = true; + } + } + prepareShow(); + } + + //Setup end point in a random location. At a distance of EP_DIST from every player + void setupEndPoint(){ + //Randomly spawns all the players + //For a spawn location to be valid, it has to be free from both walls and players + int x = 0, y = 0; + + do { + x = (Math.abs(rand.nextInt()) % (w)); + y = (Math.abs(rand.nextInt()) % (h)); + //while there's a wall in current location pick new location + }while(main.gameManager.areTherePlayersNearby(x, y, EP_DIST) || occupiedSpot(x, y)); + WINX = x; + WINZ = y; + todraw[x][y] = 2; + } + + public void prepareShow() { + for (int i = 0; i < w; i++) { + for (int j = 0; j < h; j++) { + todraw[i][j] = 1; + } + } + + // constructs an array so that the walls of the cells are black tiles and the + // free cells are white tiles + for (int i = 0; i < W; i++) { + for (int j = 0; j < H; j++) { + int x = 2 * i + 1; + int y = 2 * j + 1; + + // current cell + todraw[x][y] = 0; + + // up wall + if (!cellsGrid[i][j].walls[0]) + todraw[x][y - 1] = 0; + // down wall + if (!cellsGrid[i][j].walls[2]) + todraw[x][y + 1] = 0; + // left wall + if (!cellsGrid[i][j].walls[3]) + todraw[x - 1][y] = 0; + // right all + if (!cellsGrid[i][j].walls[1]) + todraw[x + 1][y] = 0; + } + } + + setupEndPoint(); + for (int j = 0; j < h; j++) { + for (int i = 0; i < w; i++) { + main.world.worldManager.setCell(i, 0, j, CellId.ID_GRASS); + if (todraw[i][j] == 1) + main.world.worldManager.setCell(i, 1, j, CellId.ID_LEAVES); + else if (todraw[i][j] == 2) + main.world.worldManager.setCell(i, 0, j, CellId.ID_WOOD); + } + } + } + + boolean allCellsVisited() { + for (int i = 0; i < W; i++) { + for (int j = 0; j < H; j++) { + if (!cellsGrid[i][j].visited) + return false; + } + } + return true; + } + + int cellAt(int x, int y) { + return todraw[x][y]; + } + + public boolean occupiedSpot(int x, int y) { + return cellAt(x, y) != 0; + } +} + +class Cell { + + public boolean visited = false; + public boolean current = false; + public boolean[] walls = { true, true, true, true }; + + // top, right, bottom, left, + // true means wall present + + int x, y; + MazeGenerator gen; + + public Cell(int x_, int y_, MazeGenerator generator_) { + this.x = x_; + this.y = y_; + gen = generator_; + } + + // returning an array of unvisited neighbours, so that they can be easily + // choosed later on + Cell[] unvisitedNeighbours() { + int un = 0; + if (x - 1 >= 0 && !gen.cellsGrid[x - 1][y].visited) + un++; + if (x + 1 < gen.W && !gen.cellsGrid[x + 1][y].visited) + un++; + if (y - 1 >= 0 && !gen.cellsGrid[x][y - 1].visited) + un++; + if (y + 1 < gen.H && !gen.cellsGrid[x][y + 1].visited) + un++; + + Cell[] c = new Cell[un]; + + int tun = 0; + if (x - 1 >= 0 && !gen.cellsGrid[x - 1][y].visited) { + c[tun] = gen.cellsGrid[x - 1][y]; + tun++; + } + if (x + 1 < gen.W && !gen.cellsGrid[x + 1][y].visited) { + c[tun] = gen.cellsGrid[x + 1][y]; + tun++; + } + if (y - 1 >= 0 && !gen.cellsGrid[x][y - 1].visited) { + c[tun] = gen.cellsGrid[x][y - 1]; + tun++; + } + if (y + 1 < gen.H && !gen.cellsGrid[x][y + 1].visited) { + c[tun] = gen.cellsGrid[x][y + 1]; + tun++; + } + return c; + } + +} \ No newline at end of file diff --git a/core/src/com/emamaker/amazeing/maze/MazeSettings.java b/core/src/com/emamaker/amazeing/maze/MazeSettings.java new file mode 100644 index 0000000..05263d8 --- /dev/null +++ b/core/src/com/emamaker/amazeing/maze/MazeSettings.java @@ -0,0 +1,12 @@ +package com.emamaker.amazeing.maze; + +public class MazeSettings { + + public static int MAZEX = 20; + public static int MAZEZ = 20; + + public void setMazeDimensions(int x, int z) { + MAZEX = x; + MAZEZ = z; + } +} diff --git a/core/src/com/emamaker/amazeing/player/MazePlayer.java b/core/src/com/emamaker/amazeing/player/MazePlayer.java new file mode 100644 index 0000000..4445dc8 --- /dev/null +++ b/core/src/com/emamaker/amazeing/player/MazePlayer.java @@ -0,0 +1,243 @@ +package com.emamaker.amazeing.player; + +import java.util.Random; + +import com.badlogic.gdx.Game; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.controllers.Controller; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.VertexAttributes; +import com.badlogic.gdx.graphics.g3d.Environment; +import com.badlogic.gdx.graphics.g3d.Material; +import com.badlogic.gdx.graphics.g3d.Model; +import com.badlogic.gdx.graphics.g3d.ModelBatch; +import com.badlogic.gdx.graphics.g3d.ModelInstance; +import com.badlogic.gdx.graphics.g3d.model.Node; +import com.badlogic.gdx.graphics.g3d.utils.MeshPartBuilder; +import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; +import com.badlogic.gdx.math.Matrix4; +import com.badlogic.gdx.math.Vector3; +import com.badlogic.gdx.physics.bullet.collision.btBoxShape; +import com.badlogic.gdx.physics.bullet.collision.btBroadphaseProxy; +import com.badlogic.gdx.physics.bullet.collision.btCollisionObject; +import com.badlogic.gdx.physics.bullet.collision.btConvexShape; +import com.badlogic.gdx.physics.bullet.collision.btPairCachingGhostObject; +import com.badlogic.gdx.physics.bullet.dynamics.btDiscreteDynamicsWorld; +import com.badlogic.gdx.physics.bullet.dynamics.btKinematicCharacterController; +import com.emamaker.amazeing.AMazeIng; +import com.emamaker.voxelengine.physics.GameObject; + +public class MazePlayer { + + static Random rand = new Random(); + + // MazePlayer model building stuff + public Model MazePlayerModel; + public ModelInstance instance; + ModelBuilder modelBuilder = new ModelBuilder(); + MeshPartBuilder meshBuilder; + static int meshAttr = VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal; + public GameObject obj; + + btConvexShape ghostShape; + public btPairCachingGhostObject ghostObject; + public btKinematicCharacterController characterController; + Matrix4 characterTransform; + Vector3 characterDirection = new Vector3(); + Vector3 walkDirection = new Vector3(); + public Controller ctrl; + + // Physics using LibGDX's bullet wrapper + public int kup, kdown, ksx, kdx; + float startx, starty, startz; + String name; + AMazeIng main; + + boolean disposing = false; + + public MazePlayer(Game main_, int up_, int down_, int sx_, int dx_) { + this(main_, up_, down_, sx_, dx_, 0, 0, 0); + } + + public MazePlayer(Game main_, int up_, int down_, int sx_, int dx_, String name) { + this(main_, up_, down_, sx_, dx_, 0, 0, 0, name); + } + + public MazePlayer(Game main_, int up_, int down_, int sx_, int dx_, float startx, float starty, float startz) { + this(main_, up_, down_, sx_, dx_, startx, starty, startz, String.valueOf((char) (65 + rand.nextInt(26)))); + } + + public MazePlayer(Game main_, int up_, int down_, int sx_, int dx_, float startx, float starty, float startz, + String name) { + this.kup = up_; + this.kdown = down_; + this.ksx = sx_; + this.kdx = dx_; + + this.startx = startx; + this.starty = starty; + this.startz = startz; + + this.main = (AMazeIng) main_; + + setName(name); + buildModel(); + initPhysics(); + } + + public MazePlayer(Game main_, Controller ctrl_) { + this(main_, ctrl_, 0, 0, 0); + } + + public MazePlayer(Game main_, Controller ctrl_, String name) { + this(main_, ctrl_, 0, 0, 0, name); + } + + public MazePlayer(Game main_, Controller crtl_, float startx, float starty, float startz) { + this(main_, crtl_, startx, starty, startz, String.valueOf((char) (65 + rand.nextInt(26)))); + } + + public MazePlayer(Game main_, Controller ctrl_, float startx, float starty, float startz, String name) { + this.ctrl = ctrl_; + + this.startx = startx; + this.starty = starty; + this.startz = startz; + + setName(name); + buildModel(); + initPhysics(); + } + +// public void buildModel() { +// modelBuilder.begin(); +// Node n = modelBuilder.node(); +// n.id = "MazePlayer"; +// modelBuilder.part("MazePlayer", GL20.GL_TRIANGLES, meshAttr, new Material()).cone(1, 1, 1, 20); +// MazePlayerModel = modelBuilder.end(); +// } +// +// public void initPhysics() { +// GameObject.Constructor construct = new GameObject.Constructor(MazePlayerModel, "MazePlayer", new btConeShape(1,1), +// 30f); +// obj = construct.construct(); +// obj.transform.trn(VoxelSettings.chunkSize/2, VoxelSettings.chunkSize/2, VoxelSettings.chunkSize/2); +// obj.body.proceedToTransform(obj.transform); +// obj.body.setCollisionFlags( +// obj.body.getCollisionFlags() | btCollisionObject.CollisionFlags.CF_CUSTOM_MATERIAL_CALLBACK); +// VoxelSettings.voxelWorld.dynamicsWorld.addRigidBody(obj.body); +//// obj.body.setContactCallbackFlag(VoxelSettings.OBJECT_FLAG); +//// obj.body.setContactCallbackFilter(VoxelSettings.GROUND_FLAG); +// } +// +// public void render(ModelBatch b, Environment e) { +// b.render(obj, e); +// } + + public void buildModel() { + modelBuilder.begin(); + Node n = modelBuilder.node(); + n.id = "MazePlayer"; + modelBuilder.part("MazePlayer", GL20.GL_TRIANGLES, meshAttr, new Material()).box(0.6f, 0.6f, 0.6f); + MazePlayerModel = modelBuilder.end(); + instance = new ModelInstance(MazePlayerModel); + } + + public void initPhysics() { + characterTransform = instance.transform; // Set by reference + characterTransform.set(startx, starty, startz, 0, 0, 0, 0); + + // Create the physics representation of the character + ghostObject = new btPairCachingGhostObject(); + ghostObject.setWorldTransform(characterTransform); + ghostShape = new btBoxShape(new Vector3(0.3f, 0.3f, 0.3f)); + ghostObject.setCollisionShape(ghostShape); + ghostObject.setCollisionFlags(btCollisionObject.CollisionFlags.CF_CHARACTER_OBJECT); + characterController = new btKinematicCharacterController(ghostObject, ghostShape, .05f, Vector3.Y); + + // And add it to the physics world + main.world.dynamicsWorld.addCollisionObject(ghostObject, + (short) btBroadphaseProxy.CollisionFilterGroups.CharacterFilter, + (short) (btBroadphaseProxy.CollisionFilterGroups.StaticFilter + | btBroadphaseProxy.CollisionFilterGroups.DefaultFilter)); + ((btDiscreteDynamicsWorld) (main.world.dynamicsWorld)).addAction(characterController); + } + + public void render(ModelBatch b, Environment e) { + if (!disposing) { + inputs(); + b.render(instance, e); + } + } + + public void inputs() { + // If the left or right key is pressed, rotate the character and update its + // physics update accordingly. + if (Gdx.input.isKeyPressed(ksx)) { + characterTransform.rotate(0, 1, 0, 2.5f); + ghostObject.setWorldTransform(characterTransform); + } + if (Gdx.input.isKeyPressed(kdx)) { + characterTransform.rotate(0, 1, 0, -2.5f); + ghostObject.setWorldTransform(characterTransform); + } + // Fetch which direction the character is facing now + characterDirection.set(-1, 0, 0).rot(characterTransform).nor(); + // Set the walking direction accordingly (either forward or backward) + walkDirection.set(0, 0, 0); + + if (Gdx.input.isKeyPressed(kup)) + walkDirection.add(characterDirection); + if (Gdx.input.isKeyPressed(kdown)) + walkDirection.add(-characterDirection.x, -characterDirection.y, -characterDirection.z); + walkDirection.scl(3f * Gdx.graphics.getDeltaTime()); + // And update the character controller + characterController.setWalkDirection(walkDirection); + // Now we can update the world as normally + // And fetch the new transformation of the character (this will make the model + // be rendered correctly) + ghostObject.getWorldTransform(characterTransform); + } + + public Vector3 getPos() { + return instance.transform.getTranslation(new Vector3()); + } + + public void setPos(Vector3 v) { + if (!disposing) { + characterTransform.set(v.x, v.y, v.z, 0, 0, 0, 0); + ghostObject.setWorldTransform(characterTransform); + } + } + + public void setPos(float x, float y, float z) { + if (!disposing) { + characterTransform.set(x, y, z, 0, 0, 0, 0); + ghostObject.setWorldTransform(characterTransform); + } + } + + public void setName(String name_) { + this.name = name_; + } + + public String getName() { + return name; + } + + public void setPlaying() { + disposing = false; + } + + public void dispose() { + disposing = true; + main.world.dynamicsWorld.removeAction(characterController); + main.world.dynamicsWorld.removeCollisionObject(ghostObject); + characterController.dispose(); + ghostObject.dispose(); + ghostShape.dispose(); + MazePlayerModel.dispose(); + disposing = false; + } + +} diff --git a/core/src/com/emamaker/amazeing/ui/UIManager.java b/core/src/com/emamaker/amazeing/ui/UIManager.java new file mode 100644 index 0000000..2512823 --- /dev/null +++ b/core/src/com/emamaker/amazeing/ui/UIManager.java @@ -0,0 +1,33 @@ +package com.emamaker.amazeing.ui; + +import com.badlogic.gdx.Game; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; +import com.emamaker.amazeing.AMazeIng; +import com.emamaker.amazeing.ui.screens.PlayerChooseScreen; +import com.emamaker.amazeing.ui.screens.TitleScreen; + +public class UIManager { + + public Skin skin; + public AMazeIng main; + float delta; + public TitleScreen titleScreen; + public PlayerChooseScreen playersScreen; + + public UIManager(Game main_) { + main = (AMazeIng)main_; + + //Load the sinks + skin = new Skin(Gdx.files.internal("data/uiskin.json")); + //Load all the screens after loading the skin + titleScreen = new TitleScreen(this); + playersScreen = new PlayerChooseScreen(this); + main.setScreen(titleScreen); + } + + public void dispose() { + titleScreen.dispose(); + } + +} diff --git a/core/src/com/emamaker/amazeing/ui/screens/PlayerChooseScreen.java b/core/src/com/emamaker/amazeing/ui/screens/PlayerChooseScreen.java new file mode 100644 index 0000000..faca6d5 --- /dev/null +++ b/core/src/com/emamaker/amazeing/ui/screens/PlayerChooseScreen.java @@ -0,0 +1,292 @@ +package com.emamaker.amazeing.ui.screens; + +import java.util.HashMap; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input.Keys; +import com.badlogic.gdx.Screen; +import com.badlogic.gdx.controllers.Controller; +import com.badlogic.gdx.controllers.Controllers; +import com.badlogic.gdx.controllers.mappings.Xbox; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.InputListener; +import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.ui.Container; +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.utils.Align; +import com.badlogic.gdx.utils.viewport.ScreenViewport; +import com.emamaker.amazeing.player.MazePlayer; +import com.emamaker.amazeing.ui.UIManager; + +public class PlayerChooseScreen implements Screen { + + UIManager uiManager; + Stage stage; + Table table; + + Label[] labels = new Label[8]; + int currentLabel = 0; + HashMap players = new HashMap(); + + public PlayerChooseScreen(UIManager uiManager_) { + uiManager = uiManager_; +// +// stage = new Stage(new ScreenViewport()); +// +// Container tableContainer = new Container
(); +// +// float sw = Gdx.graphics.getWidth(); +// float sh = Gdx.graphics.getHeight(); +// +// float cw = sw * 0.7f; +// float ch = sh * 0.5f; +// +// tableContainer.setSize(cw, ch); +// tableContainer.setPosition((sw - cw) / 2.0f, (sh - ch) / 2.0f); +// tableContainer.fillX(); +// +// Table table = new Table(uiManager.skin); +// +// Label topLabel = new Label("A LABEL", uiManager.skin); +// topLabel.setAlignment(Align.center); +// Slider slider = new Slider(0, 100, 1, false, uiManager.skin); +// Label anotherLabel = new Label("ANOTHER LABEL", uiManager.skin); +// anotherLabel.setAlignment(Align.center); +// +// CheckBox checkBoxA = new CheckBox("Checkbox Left", uiManager.skin); +// CheckBox checkBoxB = new CheckBox("Checkbox Center", uiManager.skin); +// CheckBox checkBoxC = new CheckBox("Checkbox Right", uiManager.skin); +// +// Table buttonTable = new Table(uiManager.skin); +// +// TextButton buttonA = new TextButton("LEFT", uiManager.skin); +// TextButton buttonB = new TextButton("RIGHT", uiManager.skin); +// +// table.row().colspan(3).expandX().fillX(); +// table.add(topLabel).fillX(); +// table.row().colspan(3).expandX().fillX(); +// table.add(slider).fillX(); +// table.row().colspan(3).expandX().fillX(); +// table.add(anotherLabel).fillX(); +// table.row().expandX().fillX(); +// +// table.add(checkBoxA).expandX().fillX(); +// table.add(checkBoxB).expandX().fillX(); +// table.add(checkBoxC).expandX().fillX(); +// table.row().expandX().fillX();; +// +// table.add(buttonTable).colspan(3); +// +// buttonTable.pad(16); +// buttonTable.row().space(5); +// buttonTable.add(buttonA).width(cw/3.0f); +// buttonTable.add(buttonB).width(cw/3.0f); +// +// tableContainer.setActor(table); +// stage.addActor(tableContainer); + + float sw = Gdx.graphics.getWidth(); + float sh = Gdx.graphics.getHeight(); + + stage = new Stage(new ScreenViewport()); + Container
tableContainer = new Container
(); + Table table = new Table(); + + float cw = stage.getWidth(); + float ch = stage.getHeight(); + + tableContainer.setSize(cw, ch); + tableContainer.setPosition(0, 0); + + Label instLab = new Label("Use WASD, ARROWS, or button on controller to join the match", uiManager.skin); + TextButton backBtn = new TextButton("Back", uiManager.skin); + TextButton setBtn = new TextButton("Settings", uiManager.skin); + TextButton helpBtn = new TextButton("?", uiManager.skin); + TextButton playBtn = new TextButton("Play", uiManager.skin); + + //Labels to know if players joined + for(int i = 0; i < labels.length; i++) { + labels[i] = new Label("Not joined yet", uiManager.skin); + } + + // Add actions to the buttons + backBtn.addListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + hide(); + uiManager.main.setScreen(uiManager.titleScreen); + return true; + } + }); + // Add actions to the buttons + playBtn.addListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if(!players.isEmpty()) { + hide(); + uiManager.main.gameManager.generateMaze(players.keySet()); + } + return true; + } + }); + // Add actions to the buttons + setBtn.addListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + System.out.println("Make this appear settings screen (TODO)"); + return true; + } + }); + // Add actions to the buttons + helpBtn.addListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + System.out.println("Make this appear help dialog (TODO)"); + return true; + } + }); + + Table firstRowTable = new Table(); + + firstRowTable.add(backBtn).width(50).height(50).fillX().expandX().space(cw*0.005f); + firstRowTable.add(instLab).height(50).fillX().expandX().space(cw*0.25f); + firstRowTable.add(setBtn).height(50).fillX().expandX().space(cw*0.005f); + firstRowTable.add(helpBtn).width(50).height(50).fillX().expandX().space(cw*0.005f); + firstRowTable.setOrigin(Align.center | Align.top); + table.row().colspan(4); + + table.add(firstRowTable); + + for(int i = 0; i < labels.length; i++) { + if(i % 4 == 0) table.row().expandY().fillY(); + table.add( labels[i] ).space(1); + } + table.row().colspan(4); + table.add(playBtn).fillX().width(cw*0.06f); + + + tableContainer.setActor(table); + stage.addActor(tableContainer); + +// Table buttonTable = new Table(); +// +// table.add(buttonTable).colspan(3); +// buttonTable.pad(16); +// buttonTable.add(backBtn).width(80); +// buttonTable.add(playBtn).width(80); +// +// tableContainer.setActor(table); +// stage.addActor(tableContainer); + + } + + @Override + public void show() { + uiManager.main.multiplexer.addProcessor(stage); + } + + @Override + public void hide() { + uiManager.main.multiplexer.removeProcessor(stage); + } + + MazePlayer p; + @Override + public void render(float delta) { + Gdx.gl.glClearColor(0, 0, 0, 0); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + stage.act(); + stage.draw(); + + if(!uiManager.main.gameManager.gameStarted) { + //Consantly search for new players to be added + //First search for keyboard players (WASD and ARROWS) + if(Gdx.input.isKeyJustPressed(Keys.W) || Gdx.input.isKeyJustPressed(Keys.A) || Gdx.input.isKeyJustPressed(Keys.S) || Gdx.input.isKeyJustPressed(Keys.D)) { + p = getPlayerWithKeys(Keys.W, Keys.S, Keys.A, Keys.D); + if(p == null) p = new MazePlayer(uiManager.main, Keys.W, Keys.S, Keys.A, Keys.D); + togglePlayer(p); + } + if(Gdx.input.isKeyJustPressed(Keys.UP) || Gdx.input.isKeyJustPressed(Keys.LEFT) || Gdx.input.isKeyJustPressed(Keys.DOWN) || Gdx.input.isKeyJustPressed(Keys.RIGHT)) { + p = getPlayerWithKeys(Keys.UP, Keys.DOWN, Keys.LEFT, Keys.RIGHT); + if(p == null) p = new MazePlayer(uiManager.main, Keys.UP, Keys.DOWN, Keys.LEFT, Keys.RIGHT); + togglePlayer(p); + } + for(Controller c : Controllers.getControllers()) { + if(c.getButton(Xbox.Y)){ + p = getPlayerWithCtrl(c); + if(p == null) p = new MazePlayer(uiManager.main, c); + togglePlayer(p); + } + } + } + } + + public void togglePlayer(MazePlayer p) { + try { + if(alreadyAddedPlayer(p)) { + players.get(p).setText("Not Joined Yet"); + players.remove(p); + }else { + players.put(p, labels[players.size()]); + players.get(p).setText("Player Read"); + } + }catch(Exception e) { + System.out.println("All players already joined"); + } + } + + public boolean alreadyAddedPlayerWithKeys(int... keys) { + return getPlayerWithKeys(keys) != null; + } + + public boolean alreadyAddedPlayer(MazePlayer p) { + return players.containsKey(p); + } + + public MazePlayer getPlayerWithKeys(int... keys) { + for(MazePlayer p : players.keySet()) { + for(int k : keys) { + if(p.kup == k || p.kdown == k || p.ksx == k || p.kdx == k) return p; + } + } + return null; + } + + public boolean alreadyAddedPlayerWithCtrl(Controller ctrl) { + return getPlayerWithCtrl(ctrl) != null; + } + + public MazePlayer getPlayerWithCtrl(Controller ctrl) { + for(MazePlayer p : players.keySet()) { + if(p.ctrl == ctrl) return p; + } + return null; + } + + @Override + public void resize(int width, int height) { + stage.getViewport().update(width, height, true); + } + + @Override + public void pause() { + // TODO Auto-generated method stub + + } + + @Override + public void resume() { + // TODO Auto-generated method stub + + } + + @Override + public void dispose() { + // TODO Auto-generated method stub + + } + +} diff --git a/core/src/com/emamaker/amazeing/ui/screens/ServerLaunchScreen.java b/core/src/com/emamaker/amazeing/ui/screens/ServerLaunchScreen.java new file mode 100644 index 0000000..c4092ad --- /dev/null +++ b/core/src/com/emamaker/amazeing/ui/screens/ServerLaunchScreen.java @@ -0,0 +1,49 @@ +package com.emamaker.amazeing.ui.screens; + +import com.badlogic.gdx.Screen; + +public class ServerLaunchScreen implements Screen{ + + @Override + public void show() { + // TODO Auto-generated method stub + + } + + @Override + public void render(float delta) { + // TODO Auto-generated method stub + + } + + @Override + public void resize(int width, int height) { + // TODO Auto-generated method stub + + } + + @Override + public void pause() { + // TODO Auto-generated method stub + + } + + @Override + public void resume() { + // TODO Auto-generated method stub + + } + + @Override + public void hide() { + // TODO Auto-generated method stub + + } + + @Override + public void dispose() { + // TODO Auto-generated method stub + + } + +} diff --git a/core/src/com/emamaker/amazeing/ui/screens/SettingsScreen.java b/core/src/com/emamaker/amazeing/ui/screens/SettingsScreen.java new file mode 100644 index 0000000..1e12b12 --- /dev/null +++ b/core/src/com/emamaker/amazeing/ui/screens/SettingsScreen.java @@ -0,0 +1,49 @@ +package com.emamaker.amazeing.ui.screens; + +import com.badlogic.gdx.Screen; + +public class SettingsScreen implements Screen{ + + @Override + public void show() { + // TODO Auto-generated method stub + + } + + @Override + public void render(float delta) { + // TODO Auto-generated method stub + + } + + @Override + public void resize(int width, int height) { + // TODO Auto-generated method stub + + } + + @Override + public void pause() { + // TODO Auto-generated method stub + + } + + @Override + public void resume() { + // TODO Auto-generated method stub + + } + + @Override + public void hide() { + // TODO Auto-generated method stub + + } + + @Override + public void dispose() { + // TODO Auto-generated method stub + + } + +} diff --git a/core/src/com/emamaker/amazeing/ui/screens/TitleScreen.java b/core/src/com/emamaker/amazeing/ui/screens/TitleScreen.java new file mode 100644 index 0000000..acea5ff --- /dev/null +++ b/core/src/com/emamaker/amazeing/ui/screens/TitleScreen.java @@ -0,0 +1,120 @@ +package com.emamaker.amazeing.ui.screens; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Screen; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.InputListener; +import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup; +import com.badlogic.gdx.utils.Align; +import com.badlogic.gdx.utils.viewport.ScreenViewport; +import com.emamaker.amazeing.ui.UIManager; + +public class TitleScreen implements Screen { + + UIManager uiManager; + Stage stage; + + public TitleScreen(UIManager uiManager_) { + uiManager = uiManager_; + + stage = new Stage(new ScreenViewport()); + Table table = new Table(); + + VerticalGroup mainScreenGroup = new VerticalGroup().space(5).pad(5).fill(); + TextButton setBut = new TextButton("Customize Game Settings (TODO)", uiManager.skin); + mainScreenGroup.addActor(setBut); + TextButton servBut = new TextButton("Start Server and play online with friends (TODO)", uiManager.skin); + mainScreenGroup.addActor(servBut); + TextButton localBut = new TextButton("Start a game on the local machine", uiManager.skin); + mainScreenGroup.addActor(localBut); + TextButton quitBut = new TextButton("Quit game", uiManager.skin); + + table.setPosition(stage.getWidth() *0.5f-mainScreenGroup.getWidth(), stage.getHeight() * 0.2f, Align.center); + table.add(mainScreenGroup); + stage.addActor(table); + + //Add actions to the buttons + localBut.addListener(new InputListener(){ + @Override + public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { + hide(); +// uiManager.main.gameManager.generateMaze(); + uiManager.main.setScreen(uiManager.playersScreen); + return true; + } + }); + quitBut.addListener(new InputListener(){ + @Override + public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { + System.out.println("Bye bye!"); + Gdx.app.exit(); + return true; + } + }); + servBut.addListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + System.out.println("Make this appear server joining and setup screen (TODO)"); + return true; + } + }); + servBut.addListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + System.out.println("Make this appear settings screen (TODO)"); + return true; + } + }); + + //Add actors to the group + mainScreenGroup.addActor(setBut); + mainScreenGroup.addActor(servBut); + mainScreenGroup.addActor(localBut); + mainScreenGroup.addActor(quitBut); + } + + @Override + public void show() { + uiManager.main.multiplexer.addProcessor(stage); + } + + @Override + public void hide() { + uiManager.main.multiplexer.removeProcessor(stage); + } + + @Override + public void render(float delta) { + Gdx.gl.glClearColor(0,0,0,0); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + stage.act(); + stage.draw(); + } + + @Override + public void resize(int width, int height) { + stage.getViewport().update(width, height, true); + } + + @Override + public void pause() { + // TODO Auto-generated method stub + + } + + @Override + public void resume() { + // TODO Auto-generated method stub + + } + + @Override + public void dispose() { + stage.dispose(); + } + +} diff --git a/core/src/com/emamaker/voxelengine b/core/src/com/emamaker/voxelengine new file mode 160000 index 0000000..4a8f6a5 --- /dev/null +++ b/core/src/com/emamaker/voxelengine @@ -0,0 +1 @@ +Subproject commit 4a8f6a52c8cb62361909813042ff99d61bd98611 diff --git a/core/src/shaders/shader.txt b/core/src/shaders/shader.txt new file mode 100755 index 0000000..69870d6 --- /dev/null +++ b/core/src/shaders/shader.txt @@ -0,0 +1,8 @@ + attribute vec4 a_position; + + uniform mat4 u_projectionViewMatrix; + + void main() + { + gl_Position = u_projectionViewMatrix * a_position; + } \ No newline at end of file diff --git a/desktop/build.gradle b/desktop/build.gradle new file mode 100644 index 0000000..089359f --- /dev/null +++ b/desktop/build.gradle @@ -0,0 +1,41 @@ +apply plugin: "java" + +sourceCompatibility = 1.7 +sourceSets.main.java.srcDirs = [ "src/" ] +sourceSets.main.resources.srcDirs = ["../android/assets"] + +project.ext.mainClassName = "com.emamaker.amazeing.desktop.DesktopLauncher" +project.ext.assetsDir = new File("../android/assets") + +task run(dependsOn: classes, type: JavaExec) { + main = project.mainClassName + classpath = sourceSets.main.runtimeClasspath + standardInput = System.in + workingDir = project.assetsDir + ignoreExitValue = true +} + +task debug(dependsOn: classes, type: JavaExec) { + main = project.mainClassName + classpath = sourceSets.main.runtimeClasspath + standardInput = System.in + workingDir = project.assetsDir + ignoreExitValue = true + debug = true +} + +task dist(type: Jar) { + manifest { + attributes 'Main-Class': project.mainClassName + } + dependsOn configurations.runtimeClasspath + from { + configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } + } + with jar +} + + +dist.dependsOn classes + +eclipse.project.name = appName + "-desktop" diff --git a/desktop/src/com/emamaker/amazeing/desktop/DesktopLauncher.java b/desktop/src/com/emamaker/amazeing/desktop/DesktopLauncher.java new file mode 100644 index 0000000..b1e4d5f --- /dev/null +++ b/desktop/src/com/emamaker/amazeing/desktop/DesktopLauncher.java @@ -0,0 +1,12 @@ +package com.emamaker.amazeing.desktop; + +import com.badlogic.gdx.backends.lwjgl.LwjglApplication; +import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; +import com.emamaker.amazeing.AMazeIng; + +public class DesktopLauncher { + public static void main (String[] arg) { + LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); + new LwjglApplication(new AMazeIng(), config); + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..ff329ac --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.daemon=true +org.gradle.jvmargs=-Xms128m -Xmx1500m +org.gradle.configureondemand=false diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..f4d7b2b --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..b0d6d0a --- /dev/null +++ b/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or 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 +# +# 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. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# 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"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# 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 + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# 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" + which java >/dev/null 2>&1 || 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 + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..15e1ee3 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,100 @@ +@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 http://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 + +@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=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@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%" == "0" goto init + +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. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +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. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="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! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/ios/Info.plist.xml b/ios/Info.plist.xml new file mode 100644 index 0000000..21f75ee --- /dev/null +++ b/ios/Info.plist.xml @@ -0,0 +1,51 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${app.name} + CFBundleExecutable + ${app.executable} + CFBundleIdentifier + ${app.id} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${app.name} + CFBundlePackageType + APPL + CFBundleShortVersionString + ${app.version} + CFBundleSignature + ???? + CFBundleVersion + ${app.build} + LSRequiresIPhoneOS + + UIViewControllerBasedStatusBarAppearance + + UIStatusBarHidden + + MinimumOSVersion + 8.0 + UIDeviceFamily + + 1 + 2 + + UIRequiredDeviceCapabilities + + opengles-2 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CFBundleIconName + AppIcon + + diff --git a/ios/build.gradle b/ios/build.gradle new file mode 100644 index 0000000..5dfa23c --- /dev/null +++ b/ios/build.gradle @@ -0,0 +1,19 @@ +sourceSets.main.java.srcDirs = [ "src/" ] + +sourceCompatibility = '1.7' +[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' + +ext { + mainClassName = "com.emamaker.amazeing.IOSLauncher" +} + +launchIPhoneSimulator.dependsOn build +launchIPadSimulator.dependsOn build +launchIOSDevice.dependsOn build +createIPA.dependsOn build + +robovm { + archs = "thumbv7:arm64" +} + +eclipse.project.name = appName + "-ios" diff --git a/ios/data/Default-1024w-1366h@2x~ipad.png b/ios/data/Default-1024w-1366h@2x~ipad.png new file mode 100644 index 0000000..b175eaa Binary files /dev/null and b/ios/data/Default-1024w-1366h@2x~ipad.png differ diff --git a/ios/data/Default-375w-667h@2x.png b/ios/data/Default-375w-667h@2x.png new file mode 100644 index 0000000..f213ce6 Binary files /dev/null and b/ios/data/Default-375w-667h@2x.png differ diff --git a/ios/data/Default-414w-736h@3x.png b/ios/data/Default-414w-736h@3x.png new file mode 100644 index 0000000..685ba51 Binary files /dev/null and b/ios/data/Default-414w-736h@3x.png differ diff --git a/ios/data/Default-568h@2x.png b/ios/data/Default-568h@2x.png new file mode 100644 index 0000000..101752f Binary files /dev/null and b/ios/data/Default-568h@2x.png differ diff --git a/ios/data/Default.png b/ios/data/Default.png new file mode 100644 index 0000000..f1a5582 Binary files /dev/null and b/ios/data/Default.png differ diff --git a/ios/data/Default@2x.png b/ios/data/Default@2x.png new file mode 100644 index 0000000..ca32f62 Binary files /dev/null and b/ios/data/Default@2x.png differ diff --git a/ios/data/Default@2x~ipad.png b/ios/data/Default@2x~ipad.png new file mode 100644 index 0000000..bb77ef0 Binary files /dev/null and b/ios/data/Default@2x~ipad.png differ diff --git a/ios/data/Default~ipad.png b/ios/data/Default~ipad.png new file mode 100644 index 0000000..855e4f2 Binary files /dev/null and b/ios/data/Default~ipad.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/Contents.json b/ios/data/Media.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9ed19e1 --- /dev/null +++ b/ios/data/Media.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,116 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "iphone-notification-icon-20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "iphone-notification-icon-20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "iphone-spotlight-settings-icon-29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "iphone-spotlight-settings-icon-29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "iphone-spotlight-icon-40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "iphone-spotlight-icon-40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "iphone-app-icon-60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "iphone-app-icon-60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "ipad-notifications-icon-20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "ipad-notifications-icon-20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "ipad-settings-icon-29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "ipad-settings-icon-29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "ipad-spotlight-icon-40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "ipad-spotlight-icon-40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "ipad-app-icon-76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "ipad-app-icon-76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "ipad-pro-app-icon-83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "app-store-icon-1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/app-store-icon-1024@1x.png b/ios/data/Media.xcassets/AppIcon.appiconset/app-store-icon-1024@1x.png new file mode 100644 index 0000000..b4a987c Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/app-store-icon-1024@1x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/ipad-app-icon-76@1x.png b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-app-icon-76@1x.png new file mode 100644 index 0000000..d425b2f Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-app-icon-76@1x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/ipad-app-icon-76@2x.png b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-app-icon-76@2x.png new file mode 100644 index 0000000..192460f Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-app-icon-76@2x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/ipad-notifications-icon-20@1x.png b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-notifications-icon-20@1x.png new file mode 100644 index 0000000..3ad5eb6 Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-notifications-icon-20@1x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/ipad-notifications-icon-20@2x.png b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-notifications-icon-20@2x.png new file mode 100644 index 0000000..0dbad45 Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-notifications-icon-20@2x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/ipad-pro-app-icon-83.5@2x.png b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-pro-app-icon-83.5@2x.png new file mode 100644 index 0000000..0710fdb Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-pro-app-icon-83.5@2x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/ipad-settings-icon-29@1x.png b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-settings-icon-29@1x.png new file mode 100644 index 0000000..949fbaa Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-settings-icon-29@1x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/ipad-settings-icon-29@2x.png b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-settings-icon-29@2x.png new file mode 100644 index 0000000..0a82ae9 Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-settings-icon-29@2x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/ipad-spotlight-icon-40@1x.png b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-spotlight-icon-40@1x.png new file mode 100644 index 0000000..0dbad45 Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-spotlight-icon-40@1x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/ipad-spotlight-icon-40@2x.png b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-spotlight-icon-40@2x.png new file mode 100644 index 0000000..4fc801a Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/ipad-spotlight-icon-40@2x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/iphone-app-icon-60@2x.png b/ios/data/Media.xcassets/AppIcon.appiconset/iphone-app-icon-60@2x.png new file mode 100644 index 0000000..4ce7690 Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/iphone-app-icon-60@2x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/iphone-app-icon-60@3x.png b/ios/data/Media.xcassets/AppIcon.appiconset/iphone-app-icon-60@3x.png new file mode 100644 index 0000000..a0a4ae4 Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/iphone-app-icon-60@3x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/iphone-notification-icon-20@2x.png b/ios/data/Media.xcassets/AppIcon.appiconset/iphone-notification-icon-20@2x.png new file mode 100644 index 0000000..0dbad45 Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/iphone-notification-icon-20@2x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/iphone-notification-icon-20@3x.png b/ios/data/Media.xcassets/AppIcon.appiconset/iphone-notification-icon-20@3x.png new file mode 100644 index 0000000..b4fc090 Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/iphone-notification-icon-20@3x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/iphone-spotlight-icon-40@2x.png b/ios/data/Media.xcassets/AppIcon.appiconset/iphone-spotlight-icon-40@2x.png new file mode 100644 index 0000000..4fc801a Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/iphone-spotlight-icon-40@2x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/iphone-spotlight-icon-40@3x.png b/ios/data/Media.xcassets/AppIcon.appiconset/iphone-spotlight-icon-40@3x.png new file mode 100644 index 0000000..4ce7690 Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/iphone-spotlight-icon-40@3x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/iphone-spotlight-settings-icon-29@2x.png b/ios/data/Media.xcassets/AppIcon.appiconset/iphone-spotlight-settings-icon-29@2x.png new file mode 100644 index 0000000..0a82ae9 Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/iphone-spotlight-settings-icon-29@2x.png differ diff --git a/ios/data/Media.xcassets/AppIcon.appiconset/iphone-spotlight-settings-icon-29@3x.png b/ios/data/Media.xcassets/AppIcon.appiconset/iphone-spotlight-settings-icon-29@3x.png new file mode 100644 index 0000000..eb0446e Binary files /dev/null and b/ios/data/Media.xcassets/AppIcon.appiconset/iphone-spotlight-settings-icon-29@3x.png differ diff --git a/ios/data/Media.xcassets/Contents.json b/ios/data/Media.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/ios/data/Media.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ios/robovm.properties b/ios/robovm.properties new file mode 100644 index 0000000..57ea31c --- /dev/null +++ b/ios/robovm.properties @@ -0,0 +1,6 @@ +app.version=1.0 +app.id=com.emamaker.amazeing +app.mainclass=com.emamaker.amazeing.IOSLauncher +app.executable=IOSLauncher +app.build=1 +app.name=AMazeIng diff --git a/ios/robovm.xml b/ios/robovm.xml new file mode 100644 index 0000000..fccf328 --- /dev/null +++ b/ios/robovm.xml @@ -0,0 +1,48 @@ + + ${app.executable} + ${app.mainclass} + ios + thumbv7 + ios + Info.plist.xml + conservative + + + ../android/assets + + ** + + true + + + data + + + + com.badlogic.gdx.scenes.scene2d.ui.* + com.badlogic.gdx.graphics.g3d.particles.** + com.android.okhttp.HttpHandler + com.android.okhttp.HttpsHandler + com.android.org.conscrypt.** + com.android.org.bouncycastle.jce.provider.BouncyCastleProvider + com.android.org.bouncycastle.jcajce.provider.keystore.BC$Mappings + com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi + com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi$Std + com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi + com.android.org.bouncycastle.crypto.digests.AndroidDigestFactoryOpenSSL + org.apache.harmony.security.provider.cert.DRLCertFactory + org.apache.harmony.security.provider.crypto.CryptoProvider + + + z + + + UIKit + OpenGLES + QuartzCore + CoreGraphics + OpenAL + AudioToolbox + AVFoundation + + diff --git a/ios/src/com/emamaker/amazeing/IOSLauncher.java b/ios/src/com/emamaker/amazeing/IOSLauncher.java new file mode 100644 index 0000000..8b022b0 --- /dev/null +++ b/ios/src/com/emamaker/amazeing/IOSLauncher.java @@ -0,0 +1,22 @@ +package com.emamaker.amazeing; + +import org.robovm.apple.foundation.NSAutoreleasePool; +import org.robovm.apple.uikit.UIApplication; + +import com.badlogic.gdx.backends.iosrobovm.IOSApplication; +import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration; +import com.emamaker.amazeing.AMazeIng; + +public class IOSLauncher extends IOSApplication.Delegate { + @Override + protected IOSApplication createApplication() { + IOSApplicationConfiguration config = new IOSApplicationConfiguration(); + return new IOSApplication(new AMazeIng(), config); + } + + public static void main(String[] argv) { + NSAutoreleasePool pool = new NSAutoreleasePool(); + UIApplication.main(argv, null, IOSLauncher.class); + pool.close(); + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..61be2f7 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include 'desktop', 'android', 'ios', 'core' \ No newline at end of file