commit fa87f5e8cfc1d0d21d22729496195bfdeafebb81 Author: Recrown Date: Tue Apr 18 18:25:45 2017 -0500 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..5814594 --- /dev/null +++ b/.gitignore @@ -0,0 +1,114 @@ +## 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 diff --git a/HEAD b/HEAD new file mode 100644 index 0000000..cb089cd --- /dev/null +++ b/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml new file mode 100755 index 0000000..8533eab --- /dev/null +++ b/android/AndroidManifest.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + diff --git a/android/assets/1280x720/PolyjetTitle.png b/android/assets/1280x720/PolyjetTitle.png new file mode 100755 index 0000000..7320f6a Binary files /dev/null and b/android/assets/1280x720/PolyjetTitle.png differ diff --git a/android/assets/1280x720/Tech-Circle1.png b/android/assets/1280x720/Tech-Circle1.png new file mode 100755 index 0000000..4229dfe Binary files /dev/null and b/android/assets/1280x720/Tech-Circle1.png differ diff --git a/android/assets/1280x720/cube.png b/android/assets/1280x720/cube.png new file mode 100755 index 0000000..a317fe3 Binary files /dev/null and b/android/assets/1280x720/cube.png differ diff --git a/android/assets/1280x720/cybercircle1.png b/android/assets/1280x720/cybercircle1.png new file mode 100755 index 0000000..c40498d Binary files /dev/null and b/android/assets/1280x720/cybercircle1.png differ diff --git a/android/assets/1280x720/cybercircle3B.png b/android/assets/1280x720/cybercircle3B.png new file mode 100755 index 0000000..a8a2dd6 Binary files /dev/null and b/android/assets/1280x720/cybercircle3B.png differ diff --git a/android/assets/1280x720/magicCircle.png b/android/assets/1280x720/magicCircle.png new file mode 100755 index 0000000..70dc26e Binary files /dev/null and b/android/assets/1280x720/magicCircle.png differ diff --git a/android/assets/1280x720/polyjet-standard.png b/android/assets/1280x720/polyjet-standard.png new file mode 100755 index 0000000..ba5561c Binary files /dev/null and b/android/assets/1280x720/polyjet-standard.png differ diff --git a/android/assets/1280x720/splashlogo.png b/android/assets/1280x720/splashlogo.png new file mode 100755 index 0000000..52e86e3 Binary files /dev/null and b/android/assets/1280x720/splashlogo.png differ diff --git a/android/assets/1280x720/square.png b/android/assets/1280x720/square.png new file mode 100755 index 0000000..ad1c849 Binary files /dev/null and b/android/assets/1280x720/square.png differ diff --git a/android/assets/1280x720/standard_thrust.p b/android/assets/1280x720/standard_thrust.p new file mode 100755 index 0000000..649229a --- /dev/null +++ b/android/assets/1280x720/standard_thrust.p @@ -0,0 +1,131 @@ +thrust +- Delay - +active: false +- Duration - +lowMin: 0.0 +lowMax: 0.0 +- Count - +min: 0 +max: 15 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 20.0 +highMax: 20.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 400.0 +highMax: 400.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life Offset - +active: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: point +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 2.0 +highMax: 2.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.29411766 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 30.0 +highMax: 30.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: true +lowMin: 110.0 +lowMax: 50.0 +highMin: 90.0 +highMax: 90.0 +relative: false +scalingCount: 2 +scaling0: 0.0 +scaling1: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 0.47260273 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 3 +colors0: 0.047058824 +colors1: 0.7647059 +colors2: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 4 +scaling0: 0.0 +scaling1: 1.0 +scaling2: 1.0 +scaling3: 0.0 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.25342464 +timeline2: 0.79452056 +timeline3: 1.0 +- Options - +attached: false +continuous: true +aligned: false +additive: false +behind: false +premultipliedAlpha: false +- Image Path - +cube.png diff --git a/android/assets/1280x800/PolyjetTitle.png b/android/assets/1280x800/PolyjetTitle.png new file mode 100755 index 0000000..2f32320 Binary files /dev/null and b/android/assets/1280x800/PolyjetTitle.png differ diff --git a/android/assets/1280x800/Tech-Circle1.png b/android/assets/1280x800/Tech-Circle1.png new file mode 100755 index 0000000..bd661d3 Binary files /dev/null and b/android/assets/1280x800/Tech-Circle1.png differ diff --git a/android/assets/1280x800/cube.png b/android/assets/1280x800/cube.png new file mode 100755 index 0000000..bf21c8f Binary files /dev/null and b/android/assets/1280x800/cube.png differ diff --git a/android/assets/1280x800/cybercircle1.png b/android/assets/1280x800/cybercircle1.png new file mode 100755 index 0000000..2edc4d1 Binary files /dev/null and b/android/assets/1280x800/cybercircle1.png differ diff --git a/android/assets/1280x800/cybercircle3B.png b/android/assets/1280x800/cybercircle3B.png new file mode 100755 index 0000000..6f5ab4e Binary files /dev/null and b/android/assets/1280x800/cybercircle3B.png differ diff --git a/android/assets/1280x800/magicCircle.png b/android/assets/1280x800/magicCircle.png new file mode 100755 index 0000000..9b60e1a Binary files /dev/null and b/android/assets/1280x800/magicCircle.png differ diff --git a/android/assets/1280x800/polyjet-standard.png b/android/assets/1280x800/polyjet-standard.png new file mode 100755 index 0000000..1e17bd6 Binary files /dev/null and b/android/assets/1280x800/polyjet-standard.png differ diff --git a/android/assets/1280x800/splashlogo.png b/android/assets/1280x800/splashlogo.png new file mode 100755 index 0000000..45390b5 Binary files /dev/null and b/android/assets/1280x800/splashlogo.png differ diff --git a/android/assets/1280x800/square.png b/android/assets/1280x800/square.png new file mode 100755 index 0000000..4759b27 Binary files /dev/null and b/android/assets/1280x800/square.png differ diff --git a/android/assets/1280x800/standard_thrust.p b/android/assets/1280x800/standard_thrust.p new file mode 100755 index 0000000..649229a --- /dev/null +++ b/android/assets/1280x800/standard_thrust.p @@ -0,0 +1,131 @@ +thrust +- Delay - +active: false +- Duration - +lowMin: 0.0 +lowMax: 0.0 +- Count - +min: 0 +max: 15 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 20.0 +highMax: 20.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 400.0 +highMax: 400.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life Offset - +active: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: point +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 2.0 +highMax: 2.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.29411766 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 30.0 +highMax: 30.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: true +lowMin: 110.0 +lowMax: 50.0 +highMin: 90.0 +highMax: 90.0 +relative: false +scalingCount: 2 +scaling0: 0.0 +scaling1: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 0.47260273 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 3 +colors0: 0.047058824 +colors1: 0.7647059 +colors2: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 4 +scaling0: 0.0 +scaling1: 1.0 +scaling2: 1.0 +scaling3: 0.0 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.25342464 +timeline2: 0.79452056 +timeline3: 1.0 +- Options - +attached: false +continuous: true +aligned: false +additive: false +behind: false +premultipliedAlpha: false +- Image Path - +cube.png diff --git a/android/assets/1366x768/PolyjetTitle.png b/android/assets/1366x768/PolyjetTitle.png new file mode 100755 index 0000000..d86c04c Binary files /dev/null and b/android/assets/1366x768/PolyjetTitle.png differ diff --git a/android/assets/1366x768/Tech-Circle1.png b/android/assets/1366x768/Tech-Circle1.png new file mode 100755 index 0000000..bb78f62 Binary files /dev/null and b/android/assets/1366x768/Tech-Circle1.png differ diff --git a/android/assets/1366x768/cube.png b/android/assets/1366x768/cube.png new file mode 100755 index 0000000..abe5b32 Binary files /dev/null and b/android/assets/1366x768/cube.png differ diff --git a/android/assets/1366x768/cybercircle1.png b/android/assets/1366x768/cybercircle1.png new file mode 100755 index 0000000..2d205ef Binary files /dev/null and b/android/assets/1366x768/cybercircle1.png differ diff --git a/android/assets/1366x768/cybercircle3B.png b/android/assets/1366x768/cybercircle3B.png new file mode 100755 index 0000000..8af9f1e Binary files /dev/null and b/android/assets/1366x768/cybercircle3B.png differ diff --git a/android/assets/1366x768/magicCircle.png b/android/assets/1366x768/magicCircle.png new file mode 100755 index 0000000..35ed09b Binary files /dev/null and b/android/assets/1366x768/magicCircle.png differ diff --git a/android/assets/1366x768/polyjet-standard.png b/android/assets/1366x768/polyjet-standard.png new file mode 100755 index 0000000..8167fce Binary files /dev/null and b/android/assets/1366x768/polyjet-standard.png differ diff --git a/android/assets/1366x768/splashlogo.png b/android/assets/1366x768/splashlogo.png new file mode 100755 index 0000000..07c1aa4 Binary files /dev/null and b/android/assets/1366x768/splashlogo.png differ diff --git a/android/assets/1366x768/square.png b/android/assets/1366x768/square.png new file mode 100755 index 0000000..d2896d5 Binary files /dev/null and b/android/assets/1366x768/square.png differ diff --git a/android/assets/1366x768/standard_thrust.p b/android/assets/1366x768/standard_thrust.p new file mode 100755 index 0000000..649229a --- /dev/null +++ b/android/assets/1366x768/standard_thrust.p @@ -0,0 +1,131 @@ +thrust +- Delay - +active: false +- Duration - +lowMin: 0.0 +lowMax: 0.0 +- Count - +min: 0 +max: 15 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 20.0 +highMax: 20.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 400.0 +highMax: 400.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life Offset - +active: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: point +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 2.0 +highMax: 2.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.29411766 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 30.0 +highMax: 30.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: true +lowMin: 110.0 +lowMax: 50.0 +highMin: 90.0 +highMax: 90.0 +relative: false +scalingCount: 2 +scaling0: 0.0 +scaling1: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 0.47260273 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 3 +colors0: 0.047058824 +colors1: 0.7647059 +colors2: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 4 +scaling0: 0.0 +scaling1: 1.0 +scaling2: 1.0 +scaling3: 0.0 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.25342464 +timeline2: 0.79452056 +timeline3: 1.0 +- Options - +attached: false +continuous: true +aligned: false +additive: false +behind: false +premultipliedAlpha: false +- Image Path - +cube.png diff --git a/android/assets/1920x1080/PolyjetTitle.png b/android/assets/1920x1080/PolyjetTitle.png new file mode 100755 index 0000000..2b66436 Binary files /dev/null and b/android/assets/1920x1080/PolyjetTitle.png differ diff --git a/android/assets/1920x1080/Tech-Circle1.png b/android/assets/1920x1080/Tech-Circle1.png new file mode 100755 index 0000000..73d6ecd Binary files /dev/null and b/android/assets/1920x1080/Tech-Circle1.png differ diff --git a/android/assets/1920x1080/cube.png b/android/assets/1920x1080/cube.png new file mode 100755 index 0000000..80afc06 Binary files /dev/null and b/android/assets/1920x1080/cube.png differ diff --git a/android/assets/1920x1080/cybercircle1.png b/android/assets/1920x1080/cybercircle1.png new file mode 100755 index 0000000..f3c7512 Binary files /dev/null and b/android/assets/1920x1080/cybercircle1.png differ diff --git a/android/assets/1920x1080/cybercircle3B.png b/android/assets/1920x1080/cybercircle3B.png new file mode 100755 index 0000000..13f13ef Binary files /dev/null and b/android/assets/1920x1080/cybercircle3B.png differ diff --git a/android/assets/1920x1080/magicCircle.png b/android/assets/1920x1080/magicCircle.png new file mode 100755 index 0000000..80303ae Binary files /dev/null and b/android/assets/1920x1080/magicCircle.png differ diff --git a/android/assets/1920x1080/polyjet-standard.png b/android/assets/1920x1080/polyjet-standard.png new file mode 100755 index 0000000..36d68b4 Binary files /dev/null and b/android/assets/1920x1080/polyjet-standard.png differ diff --git a/android/assets/1920x1080/splashlogo.png b/android/assets/1920x1080/splashlogo.png new file mode 100755 index 0000000..23efe16 Binary files /dev/null and b/android/assets/1920x1080/splashlogo.png differ diff --git a/android/assets/1920x1080/square.png b/android/assets/1920x1080/square.png new file mode 100755 index 0000000..f351e99 Binary files /dev/null and b/android/assets/1920x1080/square.png differ diff --git a/android/assets/1920x1080/standard_thrust.p b/android/assets/1920x1080/standard_thrust.p new file mode 100755 index 0000000..649229a --- /dev/null +++ b/android/assets/1920x1080/standard_thrust.p @@ -0,0 +1,131 @@ +thrust +- Delay - +active: false +- Duration - +lowMin: 0.0 +lowMax: 0.0 +- Count - +min: 0 +max: 15 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 20.0 +highMax: 20.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 400.0 +highMax: 400.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life Offset - +active: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: point +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 2.0 +highMax: 2.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.29411766 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 30.0 +highMax: 30.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: true +lowMin: 110.0 +lowMax: 50.0 +highMin: 90.0 +highMax: 90.0 +relative: false +scalingCount: 2 +scaling0: 0.0 +scaling1: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 0.47260273 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 3 +colors0: 0.047058824 +colors1: 0.7647059 +colors2: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 4 +scaling0: 0.0 +scaling1: 1.0 +scaling2: 1.0 +scaling3: 0.0 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.25342464 +timeline2: 0.79452056 +timeline3: 1.0 +- Options - +attached: false +continuous: true +aligned: false +additive: false +behind: false +premultipliedAlpha: false +- Image Path - +cube.png diff --git a/android/assets/1920x1200/PolyjetTitle.png b/android/assets/1920x1200/PolyjetTitle.png new file mode 100755 index 0000000..719af2e Binary files /dev/null and b/android/assets/1920x1200/PolyjetTitle.png differ diff --git a/android/assets/1920x1200/Tech-Circle1.png b/android/assets/1920x1200/Tech-Circle1.png new file mode 100755 index 0000000..973956b Binary files /dev/null and b/android/assets/1920x1200/Tech-Circle1.png differ diff --git a/android/assets/1920x1200/cube.png b/android/assets/1920x1200/cube.png new file mode 100755 index 0000000..2d86918 Binary files /dev/null and b/android/assets/1920x1200/cube.png differ diff --git a/android/assets/1920x1200/cybercircle1.png b/android/assets/1920x1200/cybercircle1.png new file mode 100755 index 0000000..6938404 Binary files /dev/null and b/android/assets/1920x1200/cybercircle1.png differ diff --git a/android/assets/1920x1200/cybercircle2.png b/android/assets/1920x1200/cybercircle2.png new file mode 100755 index 0000000..4b328d1 Binary files /dev/null and b/android/assets/1920x1200/cybercircle2.png differ diff --git a/android/assets/1920x1200/cybercircle3B.png b/android/assets/1920x1200/cybercircle3B.png new file mode 100755 index 0000000..de638f3 Binary files /dev/null and b/android/assets/1920x1200/cybercircle3B.png differ diff --git a/android/assets/1920x1200/magicCircle.png b/android/assets/1920x1200/magicCircle.png new file mode 100755 index 0000000..f77b304 Binary files /dev/null and b/android/assets/1920x1200/magicCircle.png differ diff --git a/android/assets/1920x1200/polyjet-standard.png b/android/assets/1920x1200/polyjet-standard.png new file mode 100755 index 0000000..47686ac Binary files /dev/null and b/android/assets/1920x1200/polyjet-standard.png differ diff --git a/android/assets/1920x1200/splashlogo.png b/android/assets/1920x1200/splashlogo.png new file mode 100755 index 0000000..f9f53dc Binary files /dev/null and b/android/assets/1920x1200/splashlogo.png differ diff --git a/android/assets/1920x1200/square.png b/android/assets/1920x1200/square.png new file mode 100755 index 0000000..12edf25 Binary files /dev/null and b/android/assets/1920x1200/square.png differ diff --git a/android/assets/1920x1200/standard_thrust.p b/android/assets/1920x1200/standard_thrust.p new file mode 100755 index 0000000..649229a --- /dev/null +++ b/android/assets/1920x1200/standard_thrust.p @@ -0,0 +1,131 @@ +thrust +- Delay - +active: false +- Duration - +lowMin: 0.0 +lowMax: 0.0 +- Count - +min: 0 +max: 15 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 20.0 +highMax: 20.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 400.0 +highMax: 400.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life Offset - +active: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: point +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 2.0 +highMax: 2.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.29411766 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 30.0 +highMax: 30.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: true +lowMin: 110.0 +lowMax: 50.0 +highMin: 90.0 +highMax: 90.0 +relative: false +scalingCount: 2 +scaling0: 0.0 +scaling1: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 0.47260273 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 3 +colors0: 0.047058824 +colors1: 0.7647059 +colors2: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 4 +scaling0: 0.0 +scaling1: 1.0 +scaling2: 1.0 +scaling3: 0.0 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.25342464 +timeline2: 0.79452056 +timeline3: 1.0 +- Options - +attached: false +continuous: true +aligned: false +additive: false +behind: false +premultipliedAlpha: false +- Image Path - +cube.png diff --git a/android/assets/2560x1440/PolyjetTitle.png b/android/assets/2560x1440/PolyjetTitle.png new file mode 100755 index 0000000..f7ee3e9 Binary files /dev/null and b/android/assets/2560x1440/PolyjetTitle.png differ diff --git a/android/assets/2560x1440/Tech-Circle1.png b/android/assets/2560x1440/Tech-Circle1.png new file mode 100755 index 0000000..076a8ca Binary files /dev/null and b/android/assets/2560x1440/Tech-Circle1.png differ diff --git a/android/assets/2560x1440/cube.png b/android/assets/2560x1440/cube.png new file mode 100755 index 0000000..ece5173 Binary files /dev/null and b/android/assets/2560x1440/cube.png differ diff --git a/android/assets/2560x1440/cybercircle1.png b/android/assets/2560x1440/cybercircle1.png new file mode 100755 index 0000000..2771c97 Binary files /dev/null and b/android/assets/2560x1440/cybercircle1.png differ diff --git a/android/assets/2560x1440/cybercircle3B.png b/android/assets/2560x1440/cybercircle3B.png new file mode 100755 index 0000000..f66907f Binary files /dev/null and b/android/assets/2560x1440/cybercircle3B.png differ diff --git a/android/assets/2560x1440/polyjet-standard.png b/android/assets/2560x1440/polyjet-standard.png new file mode 100755 index 0000000..c8a6968 Binary files /dev/null and b/android/assets/2560x1440/polyjet-standard.png differ diff --git a/android/assets/2560x1440/splashlogo.png b/android/assets/2560x1440/splashlogo.png new file mode 100755 index 0000000..f2fab6d Binary files /dev/null and b/android/assets/2560x1440/splashlogo.png differ diff --git a/android/assets/2560x1440/square.png b/android/assets/2560x1440/square.png new file mode 100755 index 0000000..70fcf91 Binary files /dev/null and b/android/assets/2560x1440/square.png differ diff --git a/android/assets/2560x1440/standard_thrust.p b/android/assets/2560x1440/standard_thrust.p new file mode 100755 index 0000000..649229a --- /dev/null +++ b/android/assets/2560x1440/standard_thrust.p @@ -0,0 +1,131 @@ +thrust +- Delay - +active: false +- Duration - +lowMin: 0.0 +lowMax: 0.0 +- Count - +min: 0 +max: 15 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 20.0 +highMax: 20.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 400.0 +highMax: 400.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life Offset - +active: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: point +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 2.0 +highMax: 2.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.29411766 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 30.0 +highMax: 30.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: true +lowMin: 110.0 +lowMax: 50.0 +highMin: 90.0 +highMax: 90.0 +relative: false +scalingCount: 2 +scaling0: 0.0 +scaling1: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 0.47260273 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 3 +colors0: 0.047058824 +colors1: 0.7647059 +colors2: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 4 +scaling0: 0.0 +scaling1: 1.0 +scaling2: 1.0 +scaling3: 0.0 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.25342464 +timeline2: 0.79452056 +timeline3: 1.0 +- Options - +attached: false +continuous: true +aligned: false +additive: false +behind: false +premultipliedAlpha: false +- Image Path - +cube.png diff --git a/android/assets/3840x2160/PolyjetTitle.png b/android/assets/3840x2160/PolyjetTitle.png new file mode 100755 index 0000000..a3cc48a Binary files /dev/null and b/android/assets/3840x2160/PolyjetTitle.png differ diff --git a/android/assets/3840x2160/Tech-Circle1.png b/android/assets/3840x2160/Tech-Circle1.png new file mode 100755 index 0000000..efad7f1 Binary files /dev/null and b/android/assets/3840x2160/Tech-Circle1.png differ diff --git a/android/assets/3840x2160/cube.png b/android/assets/3840x2160/cube.png new file mode 100755 index 0000000..7dedcbc Binary files /dev/null and b/android/assets/3840x2160/cube.png differ diff --git a/android/assets/3840x2160/cybercircle1.png b/android/assets/3840x2160/cybercircle1.png new file mode 100755 index 0000000..03c7b2c Binary files /dev/null and b/android/assets/3840x2160/cybercircle1.png differ diff --git a/android/assets/3840x2160/cybercircle3B.png b/android/assets/3840x2160/cybercircle3B.png new file mode 100755 index 0000000..8e7ef3a Binary files /dev/null and b/android/assets/3840x2160/cybercircle3B.png differ diff --git a/android/assets/3840x2160/magic-particle1.png b/android/assets/3840x2160/magic-particle1.png new file mode 100755 index 0000000..782c9b7 Binary files /dev/null and b/android/assets/3840x2160/magic-particle1.png differ diff --git a/android/assets/3840x2160/magic-tech.png b/android/assets/3840x2160/magic-tech.png new file mode 100755 index 0000000..ac4a4e1 Binary files /dev/null and b/android/assets/3840x2160/magic-tech.png differ diff --git a/android/assets/3840x2160/polyjet-standard.png b/android/assets/3840x2160/polyjet-standard.png new file mode 100755 index 0000000..75188a9 Binary files /dev/null and b/android/assets/3840x2160/polyjet-standard.png differ diff --git a/android/assets/3840x2160/splashlogo.png b/android/assets/3840x2160/splashlogo.png new file mode 100755 index 0000000..c6db1d9 Binary files /dev/null and b/android/assets/3840x2160/splashlogo.png differ diff --git a/android/assets/3840x2160/square.png b/android/assets/3840x2160/square.png new file mode 100755 index 0000000..2868dca Binary files /dev/null and b/android/assets/3840x2160/square.png differ diff --git a/android/assets/3840x2160/standard_thrust.p b/android/assets/3840x2160/standard_thrust.p new file mode 100755 index 0000000..649229a --- /dev/null +++ b/android/assets/3840x2160/standard_thrust.p @@ -0,0 +1,131 @@ +thrust +- Delay - +active: false +- Duration - +lowMin: 0.0 +lowMax: 0.0 +- Count - +min: 0 +max: 15 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 20.0 +highMax: 20.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 400.0 +highMax: 400.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life Offset - +active: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: point +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 2.0 +highMax: 2.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.29411766 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 30.0 +highMax: 30.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: true +lowMin: 110.0 +lowMax: 50.0 +highMin: 90.0 +highMax: 90.0 +relative: false +scalingCount: 2 +scaling0: 0.0 +scaling1: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 0.47260273 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 3 +colors0: 0.047058824 +colors1: 0.7647059 +colors2: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 4 +scaling0: 0.0 +scaling1: 1.0 +scaling2: 1.0 +scaling3: 0.0 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.25342464 +timeline2: 0.79452056 +timeline3: 1.0 +- Options - +attached: false +continuous: true +aligned: false +additive: false +behind: false +premultipliedAlpha: false +- Image Path - +cube.png diff --git a/android/assets/3840x2160/teleport-cloak.p b/android/assets/3840x2160/teleport-cloak.p new file mode 100755 index 0000000..4b35fe9 --- /dev/null +++ b/android/assets/3840x2160/teleport-cloak.p @@ -0,0 +1,138 @@ +hexagon +- Delay - +active: false +- Duration - +lowMin: 400.0 +lowMax: 400.0 +- Count - +min: 0 +max: 25 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 45.0 +highMax: 45.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 400.0 +highMax: 655.0 +relative: false +scalingCount: 4 +scaling0: 0.8235294 +scaling1: 0.47058824 +scaling2: 0.50980395 +scaling3: 0.7254902 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.39726028 +timeline2: 0.5684931 +timeline3: 1.0 +- Life Offset - +active: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: square +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 3.0 +highMax: 3.0 +relative: false +scalingCount: 3 +scaling0: 1.0 +scaling1: 1.0 +scaling2: 0.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.39923224 +timeline2: 0.59884834 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 3.0 +highMax: 3.0 +relative: false +scalingCount: 3 +scaling0: 1.0 +scaling1: 1.0 +scaling2: 0.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.40115163 +timeline2: 0.59692895 +- Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Velocity - +active: false +- Angle - +active: true +lowMin: 90.0 +lowMax: 90.0 +highMin: 45.0 +highMax: 135.0 +relative: false +scalingCount: 2 +scaling0: 0.0 +scaling1: 0.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 6 +colors0: 0.047058824 +colors1: 0.627451 +colors2: 1.0 +colors3: 0.078431375 +colors4: 0.047058824 +colors5: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 4 +scaling0: 0.1754386 +scaling1: 0.7719298 +scaling2: 0.4385965 +scaling3: 0.21052632 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.25342464 +timeline2: 0.82191783 +timeline3: 1.0 +- Options - +attached: true +continuous: false +aligned: false +additive: true +behind: false +premultipliedAlpha: false +- Image Path - +magic-tech.png diff --git a/android/assets/800x480/PolyjetTitle.png b/android/assets/800x480/PolyjetTitle.png new file mode 100755 index 0000000..6cf71ba Binary files /dev/null and b/android/assets/800x480/PolyjetTitle.png differ diff --git a/android/assets/800x480/Tech-Circle1.png b/android/assets/800x480/Tech-Circle1.png new file mode 100755 index 0000000..acf3162 Binary files /dev/null and b/android/assets/800x480/Tech-Circle1.png differ diff --git a/android/assets/800x480/cube.png b/android/assets/800x480/cube.png new file mode 100755 index 0000000..1bef453 Binary files /dev/null and b/android/assets/800x480/cube.png differ diff --git a/android/assets/800x480/cybercircle1.png b/android/assets/800x480/cybercircle1.png new file mode 100755 index 0000000..467fceb Binary files /dev/null and b/android/assets/800x480/cybercircle1.png differ diff --git a/android/assets/800x480/cybercircle3B.png b/android/assets/800x480/cybercircle3B.png new file mode 100755 index 0000000..cf3174f Binary files /dev/null and b/android/assets/800x480/cybercircle3B.png differ diff --git a/android/assets/800x480/magicCircle.png b/android/assets/800x480/magicCircle.png new file mode 100755 index 0000000..7395eb1 Binary files /dev/null and b/android/assets/800x480/magicCircle.png differ diff --git a/android/assets/800x480/polyjet-standard.png b/android/assets/800x480/polyjet-standard.png new file mode 100755 index 0000000..d4fbd4a Binary files /dev/null and b/android/assets/800x480/polyjet-standard.png differ diff --git a/android/assets/800x480/splashlogo.png b/android/assets/800x480/splashlogo.png new file mode 100755 index 0000000..96fdfd0 Binary files /dev/null and b/android/assets/800x480/splashlogo.png differ diff --git a/android/assets/800x480/square.png b/android/assets/800x480/square.png new file mode 100755 index 0000000..302cbc2 Binary files /dev/null and b/android/assets/800x480/square.png differ diff --git a/android/assets/800x480/standard_thrust.p b/android/assets/800x480/standard_thrust.p new file mode 100755 index 0000000..649229a --- /dev/null +++ b/android/assets/800x480/standard_thrust.p @@ -0,0 +1,131 @@ +thrust +- Delay - +active: false +- Duration - +lowMin: 0.0 +lowMax: 0.0 +- Count - +min: 0 +max: 15 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 20.0 +highMax: 20.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 400.0 +highMax: 400.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life Offset - +active: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: point +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 2.0 +highMax: 2.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.29411766 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 30.0 +highMax: 30.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: true +lowMin: 110.0 +lowMax: 50.0 +highMin: 90.0 +highMax: 90.0 +relative: false +scalingCount: 2 +scaling0: 0.0 +scaling1: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 0.47260273 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 3 +colors0: 0.047058824 +colors1: 0.7647059 +colors2: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 4 +scaling0: 0.0 +scaling1: 1.0 +scaling2: 1.0 +scaling3: 0.0 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.25342464 +timeline2: 0.79452056 +timeline3: 1.0 +- Options - +attached: false +continuous: true +aligned: false +additive: false +behind: false +premultipliedAlpha: false +- Image Path - +cube.png diff --git a/android/assets/JTransforms-3.1-with-dependencies.jar b/android/assets/JTransforms-3.1-with-dependencies.jar new file mode 100755 index 0000000..c6d5e1a Binary files /dev/null and b/android/assets/JTransforms-3.1-with-dependencies.jar differ diff --git a/android/assets/badlogic.jpg b/android/assets/badlogic.jpg new file mode 100755 index 0000000..4390da6 Binary files /dev/null and b/android/assets/badlogic.jpg differ diff --git a/android/assets/foespritesheet.atlas b/android/assets/foespritesheet.atlas new file mode 100755 index 0000000..ed5136c --- /dev/null +++ b/android/assets/foespritesheet.atlas @@ -0,0 +1,22 @@ + +foespritesheet.png +size: 512, 512 +format: RGBA8888 +filter: Linear,Linear +repeat: none +bar-beat + rotate: false + xy: 1, 1 + size: 2, 4 + split: 1, 1, 0, 0 + orig: 2, 4 + offset: 0, 0 + index: -1 +black-hole + rotate: false + xy: 4, 1 + size: 3, 3 + split: 1, 1, 1, 1 + orig: 3, 3 + offset: 0, 0 + index: -1 \ No newline at end of file diff --git a/android/assets/foespritesheet.png b/android/assets/foespritesheet.png new file mode 100755 index 0000000..5f6555b Binary files /dev/null and b/android/assets/foespritesheet.png differ diff --git a/android/assets/fonts/Gasalt-Regular.ttf b/android/assets/fonts/Gasalt-Regular.ttf new file mode 100755 index 0000000..79ff0fa Binary files /dev/null and b/android/assets/fonts/Gasalt-Regular.ttf differ diff --git a/android/assets/fonts/darktech_ldr.ttf b/android/assets/fonts/darktech_ldr.ttf new file mode 100755 index 0000000..273716f Binary files /dev/null and b/android/assets/fonts/darktech_ldr.ttf differ diff --git a/android/assets/fonts/maiden.TTF b/android/assets/fonts/maiden.TTF new file mode 100755 index 0000000..cb4b9d9 Binary files /dev/null and b/android/assets/fonts/maiden.TTF differ diff --git a/android/assets/keyboard.atlas b/android/assets/keyboard.atlas new file mode 100755 index 0000000..f0df62f --- /dev/null +++ b/android/assets/keyboard.atlas @@ -0,0 +1,650 @@ + +keyboard.png +size: 1024,1024 +format: RGBA8888 +filter: Nearest,Nearest +repeat: none +Keyboard_Black_0 + rotate: false + xy: 2, 920 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_1 + rotate: false + xy: 2, 818 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_2 + rotate: false + xy: 104, 920 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_3 + rotate: false + xy: 2, 716 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_4 + rotate: false + xy: 104, 818 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_5 + rotate: false + xy: 206, 920 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_6 + rotate: false + xy: 2, 614 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_7 + rotate: false + xy: 104, 716 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_8 + rotate: false + xy: 206, 818 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_9 + rotate: false + xy: 308, 920 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_F10 + rotate: false + xy: 2, 512 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_F11 + rotate: false + xy: 104, 614 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_F12 + rotate: false + xy: 206, 716 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_A + rotate: false + xy: 308, 818 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Alt + rotate: false + xy: 410, 920 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Down + rotate: false + xy: 2, 410 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Left + rotate: false + xy: 104, 512 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Right + rotate: false + xy: 206, 614 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Up + rotate: false + xy: 308, 716 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Asterisk + rotate: false + xy: 410, 818 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_B + rotate: false + xy: 512, 920 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Backspace + rotate: false + xy: 2, 308 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Backspace_Alt + rotate: false + xy: 104, 410 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Bracket_Left + rotate: false + xy: 206, 512 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Bracket_Right + rotate: false + xy: 308, 614 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_C + rotate: false + xy: 410, 716 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Caps_Lock + rotate: false + xy: 512, 818 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Command + rotate: false + xy: 614, 920 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Ctrl + rotate: false + xy: 2, 206 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_D + rotate: false + xy: 104, 308 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Del + rotate: false + xy: 206, 410 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_E + rotate: false + xy: 308, 512 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_End + rotate: false + xy: 410, 614 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Enter + rotate: false + xy: 512, 716 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Enter_Alt + rotate: false + xy: 614, 818 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Enter_Tall + rotate: false + xy: 716, 920 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Escape + rotate: false + xy: 2, 104 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_F + rotate: false + xy: 104, 206 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_F1 + rotate: false + xy: 206, 308 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_F2 + rotate: false + xy: 308, 410 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_F3 + rotate: false + xy: 410, 512 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_F4 + rotate: false + xy: 512, 614 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_F5 + rotate: false + xy: 614, 716 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_F6 + rotate: false + xy: 716, 818 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_F7 + rotate: false + xy: 818, 920 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_F8 + rotate: false + xy: 2, 2 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_F9 + rotate: false + xy: 104, 104 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_G + rotate: false + xy: 206, 206 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_H + rotate: false + xy: 308, 308 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Home + rotate: false + xy: 410, 410 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_I + rotate: false + xy: 512, 512 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Insert + rotate: false + xy: 614, 614 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_J + rotate: false + xy: 716, 716 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_K + rotate: false + xy: 818, 818 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_L + rotate: false + xy: 920, 920 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_M + rotate: false + xy: 104, 2 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Mark_Left + rotate: false + xy: 206, 104 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Mark_Right + rotate: false + xy: 308, 206 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Minus + rotate: false + xy: 410, 308 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Mouse_Left + rotate: false + xy: 512, 410 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Mouse_Middle + rotate: false + xy: 614, 512 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Mouse_Right + rotate: false + xy: 716, 614 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Mouse_Simple + rotate: false + xy: 818, 716 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_N + rotate: false + xy: 920, 818 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Num_Lock + rotate: false + xy: 206, 2 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_O + rotate: false + xy: 308, 104 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_P + rotate: false + xy: 410, 206 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Page_Down + rotate: false + xy: 512, 308 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Page_Up + rotate: false + xy: 614, 410 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Plus + rotate: false + xy: 716, 512 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Plus_Tall + rotate: false + xy: 818, 614 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Print_Screen + rotate: false + xy: 920, 716 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Q + rotate: false + xy: 308, 2 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Question + rotate: false + xy: 410, 104 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Quote + rotate: false + xy: 512, 206 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_R + rotate: false + xy: 614, 308 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_S + rotate: false + xy: 716, 410 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Semicolon + rotate: false + xy: 818, 512 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Shift + rotate: false + xy: 920, 614 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Shift_Alt + rotate: false + xy: 410, 2 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Slash + rotate: false + xy: 512, 104 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Space + rotate: false + xy: 614, 206 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_T + rotate: false + xy: 716, 308 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Tab + rotate: false + xy: 818, 410 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Tilda + rotate: false + xy: 920, 512 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_U + rotate: false + xy: 512, 2 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_V + rotate: false + xy: 614, 104 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_W + rotate: false + xy: 716, 206 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Win + rotate: false + xy: 818, 308 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_X + rotate: false + xy: 920, 410 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Y + rotate: false + xy: 614, 2 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +Keyboard_Black_Z + rotate: false + xy: 716, 104 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 diff --git a/android/assets/keyboard.png b/android/assets/keyboard.png new file mode 100755 index 0000000..21673f8 Binary files /dev/null and b/android/assets/keyboard.png differ diff --git a/android/assets/sounds/MainMenuLoop1.ogg b/android/assets/sounds/MainMenuLoop1.ogg new file mode 100755 index 0000000..85794cc Binary files /dev/null and b/android/assets/sounds/MainMenuLoop1.ogg differ diff --git a/android/assets/sounds/metal_clang.ogg b/android/assets/sounds/metal_clang.ogg new file mode 100755 index 0000000..5a9fd85 Binary files /dev/null and b/android/assets/sounds/metal_clang.ogg differ diff --git a/android/assets/uiskin.atlas b/android/assets/uiskin.atlas new file mode 100755 index 0000000..b2d1a57 --- /dev/null +++ b/android/assets/uiskin.atlas @@ -0,0 +1,281 @@ + +uiskin.png +size: 256,256 +format: RGBA8888 +filter: Linear,Linear +repeat: none +check-off + rotate: false + xy: 11, 5 + size: 14, 14 + split: 4, 4, 4, 4 + 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 + split: 5, 5, 5, 5 + 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, 5 + orig: 12, 20 + offset: 0, 0 + index: -1 +default-round-down + rotate: false + xy: 99, 29 + size: 12, 20 + split: 5, 5, 5, 5 + 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 +pause + rotate: false + xy: 1, 50 + size: 44, 44 + orig: 44, 44 + offset: 0, 0 + index: -1 +pause-down + rotate: false + xy: 46, 50 + size: 44, 44 + orig: 44, 44 + offset: 0, 0 + index: -1 +bar-empty + rotate: false + xy: 133, 21 + size: 26, 7 + split: 0, 0, 1, 1 + orig: 32, 32 + offset: 0, 0 + index: -1 +bar-fill + rotate: false + xy: 106, 21 + size: 26, 7 + split: 0, 0, 1, 1 + orig: 26, 7 + offset: 0, 0 + index: -1 +left-button + rotate: false + xy: 42, 8 + size: 12, 20 + split: 1, 4, 3, 3 + orig: 12, 20 + offset: 0, 0 + index: -1 +left-button-down + rotate: false + xy: 55, 8 + size: 12, 20 + split: 1, 4, 3, 3 + orig: 12, 20 + offset: 0, 0 + index: -1 +point-arrow + rotate: false + xy: 1, 123 + size: 101, 132 + orig: 101, 132 + offset: 0, 0 + index: -1 +arrow + rotate: false + xy: 91, 50 + size: 44, 44 + orig: 44, 44 + offset: 0, 0 + index: -1 +three-quart-circle + rotate: false; + xy: 136, 50 + size: 44, 44 + orig: 44, 44 + offset: 0, 0 + index: -1 +left-double-arrow + rotate: false; + xy: 1, 95 + size: 21, 21 + orig: 21, 21 + offset: 0, 0 + index: -1 +right-double-arrow + rotate: false; + xy: 23, 95 + size: 21, 21 + orig: 21, 21 + offset: 0, 0 + index: -1 \ No newline at end of file diff --git a/android/assets/uiskin.png b/android/assets/uiskin.png new file mode 100755 index 0000000..33156ca Binary files /dev/null and b/android/assets/uiskin.png differ diff --git a/android/assets/uiskin_legacy.png b/android/assets/uiskin_legacy.png new file mode 100755 index 0000000..86e641f Binary files /dev/null and b/android/assets/uiskin_legacy.png differ diff --git a/android/build.gradle b/android/build.gradle new file mode 100755 index 0000000..7593cc1 --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,129 @@ +android { + buildToolsVersion "25.0.2" + compileSdkVersion 25 + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src'] + aidl.srcDirs = ['src'] + renderscript.srcDirs = ['src'] + res.srcDirs = ['res'] + assets.srcDirs = ['assets'] + jniLibs.srcDirs = ['libs'] + } + + instrumentTest.setRoot('tests') + } + packagingOptions { + exclude 'META-INF/robovm/ios/robovm.xml' + } + defaultConfig { + applicationId "zero1hd.polyjet" + minSdkVersion 9 + targetSdkVersion 25 + } +} + + +// 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() { + 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" + } + } + } +} + +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', 'zero1hd.polyjet/zero1hd.polyjet.AndroidLauncher' +} + +// sets up the Android Eclipse project, using the old Ant based build. +eclipse { + // need to specify Java source sets explicitly, SpringSource Gradle Eclipse plugin + // ignores any nodes added in classpath.file.withXml + sourceSets { + main { + java.srcDirs "src", 'gen' + } + } + + jdt { + sourceCompatibility = 1.6 + targetCompatibility = 1.6 + } + + classpath { + plusConfigurations += [ project.configurations.compile ] + containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES' + } + + project { + name = appName + "-android" + natures 'com.android.ide.eclipse.adt.AndroidNature' + buildCommands.clear(); + buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder" + buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder" + buildCommand "org.eclipse.jdt.core.javabuilder" + buildCommand "com.android.ide.eclipse.adt.ApkBuilder" + } +} + +// sets up the Android Idea project, using the old Ant based build. +idea { + module { + sourceDirs += file("src"); + scopes = [ COMPILE: [plus:[project.configurations.compile]]] + + iml { + withXml { + def node = it.asNode() + def builder = NodeBuilder.newInstance(); + builder.current = node; + builder.component(name: "FacetManager") { + facet(type: "android", name: "Android") { + configuration { + option(name: "UPDATE_PROPERTY_FILES", value:"true") + } + } + } + } + } + } +} diff --git a/android/ic_launcher-web.png b/android/ic_launcher-web.png new file mode 100755 index 0000000..8f0110d Binary files /dev/null and b/android/ic_launcher-web.png differ diff --git a/android/proguard-project.txt b/android/proguard-project.txt new file mode 100755 index 0000000..b166b1e --- /dev/null +++ b/android/proguard-project.txt @@ -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 100755 index 0000000..4ab1256 --- /dev/null +++ b/android/project.properties @@ -0,0 +1,14 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-19 diff --git a/android/res/drawable-hdpi/ic_launcher.png b/android/res/drawable-hdpi/ic_launcher.png new file mode 100755 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 100755 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 100755 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 100755 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 100755 index 0000000..d109946 Binary files /dev/null and b/android/res/drawable-xxxhdpi/ic_launcher.png differ diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml new file mode 100755 index 0000000..b8b69a6 --- /dev/null +++ b/android/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + Polyjet + + diff --git a/android/res/values/styles.xml b/android/res/values/styles.xml new file mode 100755 index 0000000..3f00fc5 --- /dev/null +++ b/android/res/values/styles.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/android/src/zero1hd/polyjet/AndroidLauncher.java b/android/src/zero1hd/polyjet/AndroidLauncher.java new file mode 100755 index 0000000..c88b7b8 --- /dev/null +++ b/android/src/zero1hd/polyjet/AndroidLauncher.java @@ -0,0 +1,16 @@ +package zero1hd.polyjet; + +import android.os.Bundle; + +import com.badlogic.gdx.backends.android.AndroidApplication; +import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; +import zero1hd.polyjet.Polyjet; + +public class AndroidLauncher extends AndroidApplication { + @Override + protected void onCreate (Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); + initialize(new Polyjet(), config); + } +} diff --git a/build.gradle b/build.gradle new file mode 100755 index 0000000..d73aba4 --- /dev/null +++ b/build.gradle @@ -0,0 +1,99 @@ +buildscript { + repositories { + mavenLocal() + mavenCentral() + maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.5.0' + } +} + +allprojects { + apply plugin: "eclipse" + apply plugin: "idea" + + version = '1.0' + ext { + appName = "Polyjet" + gdxVersion = '1.9.6' + roboVMVersion = '2.3.0' + box2DLightsVersion = '1.4' + ashleyVersion = '1.7.0' + aiVersion = '1.8.0' + } + + repositories { + mavenLocal() + mavenCentral() + maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } + maven { url "https://oss.sonatype.org/content/repositories/releases/" } + } +} + +project(":desktop") { + apply plugin: "java" + + + dependencies { + compile project(":core") + compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" + + compile "com.googlecode.soundlibs:mp3spi:1.9.5-1" + + compile "org.apache.commons:commons-math3:3.2" + + compile "com.github.rwl:jtransforms:2.4.0" + } +} + +project(":android") { + apply plugin: "android" + + configurations { natives } + + dependencies { + compile project(":core") + compile "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" + compile "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" + + compile "com.googlecode.soundlibs:mp3spi:1.9.5-1" + + compile "org.apache.commons:commons-math3:3.2" + + compile "com.github.rwl:jtransforms:2.4.0" + } +} + +project(":core") { + apply plugin: "java" + + + dependencies { + compile "com.badlogicgames.gdx:gdx:$gdxVersion" + compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" + + compile "com.googlecode.soundlibs:mp3spi:1.9.5-1" + + compile "org.apache.commons:commons-math3:3.2" + + compile "com.github.rwl:jtransforms:2.4.0" + } +} + +tasks.eclipse.doLast { + delete ".project" +} \ No newline at end of file diff --git a/config b/config new file mode 100644 index 0000000..07d359d --- /dev/null +++ b/config @@ -0,0 +1,4 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true diff --git a/core/build.gradle b/core/build.gradle new file mode 100755 index 0000000..03cd1be --- /dev/null +++ b/core/build.gradle @@ -0,0 +1,11 @@ +apply plugin: "java" + +sourceCompatibility = 1.6 +[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' + +sourceSets.main.java.srcDirs = [ "src/" ] + + +eclipse.project { + name = appName + "-core" +} diff --git a/core/src/zero1hd/polyjet/Polyjet.java b/core/src/zero1hd/polyjet/Polyjet.java new file mode 100755 index 0000000..026dc2b --- /dev/null +++ b/core/src/zero1hd/polyjet/Polyjet.java @@ -0,0 +1,234 @@ +package zero1hd.polyjet; + +import com.badlogic.gdx.Application; +import com.badlogic.gdx.Game; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Preferences; +import com.badlogic.gdx.assets.AssetManager; +import com.badlogic.gdx.assets.loaders.ParticleEffectLoader; +import com.badlogic.gdx.assets.loaders.TextureAtlasLoader; +import com.badlogic.gdx.assets.loaders.TextureLoader; +import com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver; +import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution; +import com.badlogic.gdx.audio.Sound; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.ParticleEffect; +import com.badlogic.gdx.graphics.g2d.TextureAtlas; +import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator; +import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter; +import com.badlogic.gdx.math.MathUtils; +import com.badlogic.gdx.scenes.scene2d.ui.CheckBox.CheckBoxStyle; +import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; +import com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle; +import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane.ScrollPaneStyle; +import com.badlogic.gdx.scenes.scene2d.ui.SelectBox.SelectBoxStyle; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; +import com.badlogic.gdx.scenes.scene2d.ui.Slider.SliderStyle; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle; +import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; +import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle; + +import zero1hd.polyjet.screens.GameScreen; +import zero1hd.polyjet.screens.MainMenu; +import zero1hd.polyjet.screens.PreGameScreen; +import zero1hd.polyjet.screens.LoadingScreen; + +public class Polyjet extends Game { + private boolean initComplete = false; + + public static final int GAME_AREA_WIDTH = 64; + public static final int GAME_AREA_HEIGHT = 48; + public static final String VERSION = "(0.1)R1-PreAlpha"; + + public AssetManager assetManager = new AssetManager(); + public Skin defaultSkin = new Skin(); + public TextureAtlas buttons; + public FreeTypeFontGenerator default_fontGenerator; + public FreeTypeFontGenerator darktech_ldr_fontGenerator; + TextureAtlas skinAtlas; + public Preferences prefs; + + //screens + public MainMenu mainMenuScreen; + public PreGameScreen preGameScreen; + public GameScreen gameScreen; + + + + @Override + public void create() { + Gdx.app.setLogLevel(Application.LOG_DEBUG); + prefs = Gdx.app.getPreferences("PolyJet_Preferences"); + + if (prefs.getBoolean("fullscreen", true)) { + Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode()); + } else { + Gdx.graphics.setWindowedMode(prefs.getInteger("screen-width"), prefs.getInteger("screen-height")); + } + + Gdx.app.debug("Prelaunch Debug Info", "\ncurrent window size: " + + Gdx.graphics.getWidth() + "x" + Gdx.graphics.getHeight() +"\n" + + "Pixel density (PPI): " + Gdx.graphics.getDensity()); + + setScreen(mainMenuScreen = new MainMenu(this)); + + Resolution[] resolution = { + new Resolution(800, 480, "800x480"), + new Resolution(1280, 720, "1280x720"), + new Resolution(1366, 768, "1366x768"), + new Resolution(1280, 800, "1280x800"), + new Resolution(1920, 1080, "1920x1080"), + new Resolution(1920, 1200, "1920x1200"), + new Resolution(2560, 1440, "2560x1440"), + new Resolution(3840, 2160, "3840x2160"), + }; + + RoundingResolutionHandler resolver = new RoundingResolutionHandler(new InternalFileHandleResolver(), resolution); + + assetManager.setLoader(TextureAtlas.class, new TextureAtlasLoader(resolver)); + assetManager.setLoader(Texture.class, new TextureLoader(resolver)); + assetManager.setLoader(ParticleEffect.class, new ParticleEffectLoader(resolver)); + + default_fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/Gasalt-Regular.ttf")); + darktech_ldr_fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/darktech_ldr.ttf")); + + + } + + @Override + public void render() { + super.render(); + } + + @Override + public void dispose() { + if (skinAtlas != null) { + skinAtlas.dispose(); + defaultSkin.dispose(); + default_fontGenerator.dispose(); + darktech_ldr_fontGenerator.dispose(); + assetManager.dispose(); + } + super.dispose(); + } + + public void queueAssets() { + assetManager.load("sounds/metal_clang.ogg", Sound.class); + assetManager.load("sounds/MainMenuLoop1.ogg", Sound.class); + assetManager.load("uiskin.atlas", TextureAtlas.class); + assetManager.load("Tech-Circle1.png", Texture.class); + assetManager.load("polyjet-standard.png", Texture.class); + assetManager.load("standard_thrust.p", ParticleEffect.class); + assetManager.load("keyboard.atlas", TextureAtlas.class); + assetManager.load("cybercircle3B.png", Texture.class); + assetManager.load("PolyjetTitle.png", Texture.class); + assetManager.load("cybercircle1.png", Texture.class); + } + public void generateFonts() { + initComplete = true; + defaultSkin = new Skin(); + Gdx.app.debug("Prelaunch Debug Info", "Generating fonts..."); + + skinAtlas = assetManager.get("uiskin.atlas", TextureAtlas.class); + defaultSkin.addRegions(skinAtlas); + + defaultSkin.add("small-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() { + { + size = fontScale(0.04f); + } + })); + + defaultSkin.add("default-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() { + { + size = fontScale(0.06f); + } + })); + + defaultSkin.add("large-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() { + { + size = fontScale(0.08f); + } + })); + + defaultSkin.add("special-font", darktech_ldr_fontGenerator.generateFont(new FreeTypeFontParameter() { + { + size = fontScale(0.08f); + } + })); + + } + + public void defineSkinStyles() { + defaultSkin.add("default", Color.BLACK); + defaultSkin.add("inverse", Color.WHITE); + + TextButtonStyle defaultTextButton = new TextButtonStyle(); + defaultTextButton.up = defaultSkin.getDrawable("default-round"); + defaultTextButton.down = defaultSkin.getDrawable("default-round-down"); + defaultTextButton.font = defaultSkin.getFont("default-font"); + defaultTextButton.fontColor = defaultSkin.getColor("default"); + defaultSkin.add("default", defaultTextButton); + + TextButtonStyle smallTextButton = new TextButtonStyle(defaultTextButton); + smallTextButton.font = defaultSkin.getFont("small-font"); + defaultSkin.add("small", smallTextButton); + + TextButtonStyle textButtonLeft = new TextButtonStyle(); + textButtonLeft.up = defaultSkin.getDrawable("left-button"); + textButtonLeft.down = defaultSkin.getDrawable("left-button-down"); + textButtonLeft.font = defaultSkin.getFont("default-font"); + textButtonLeft.fontColor = defaultSkin.getColor("default"); + defaultSkin.add("left", textButtonLeft); + + SliderStyle defaultSlider = new SliderStyle(defaultSkin.getDrawable("default-slider"), defaultSkin.getDrawable("default-slider-knob")); + defaultSkin.add("default-horizontal", defaultSlider); + + LabelStyle defaultLabel = new LabelStyle(); + defaultLabel.font = defaultSkin.getFont("default-font"); + defaultLabel.fontColor = defaultSkin.getColor("default"); + defaultSkin.add("default", defaultLabel); + + TextFieldStyle defaultTextField = new TextFieldStyle(defaultSkin.getFont("small-font"), defaultSkin.getColor("default"), defaultSkin.getDrawable("cursor"), defaultSkin.getDrawable("selection"), defaultSkin.getDrawable("textfield")); + defaultSkin.add("default", defaultTextField); + + WindowStyle defaultWindow = new WindowStyle(defaultSkin.getFont("small-font"), defaultSkin.getColor("default"), defaultSkin.getDrawable("default-window")); + defaultSkin.add("default", defaultWindow); + + ListStyle defaultList = new ListStyle(defaultSkin.getFont("small-font"), defaultSkin.getColor("inverse"), defaultSkin.getColor("default"), defaultSkin.getDrawable("selection")); + defaultSkin.add("default", defaultList); + + ScrollPaneStyle defaultScrollPane = new ScrollPaneStyle(); + defaultScrollPane.vScroll = defaultSkin.getDrawable("default-scroll"); + defaultScrollPane.hScrollKnob = defaultSkin.getDrawable("default-round-large"); + defaultScrollPane.hScroll = defaultSkin.getDrawable("default-scroll"); + defaultScrollPane.vScrollKnob = defaultSkin.getDrawable("default-round-large"); + defaultSkin.add("default", defaultScrollPane); + + CheckBoxStyle defaultCheckBox = new CheckBoxStyle(defaultSkin.getDrawable("check-off"), defaultSkin.getDrawable("check-on"), defaultSkin.getFont("small-font"), defaultSkin.getColor("default")); + defaultSkin.add("default", defaultCheckBox); + + SelectBoxStyle defaultSelectBox = new SelectBoxStyle(defaultSkin.getFont("default-font"), defaultSkin.getColor("default"), defaultSkin.getDrawable("default-select"), defaultScrollPane, defaultList); + defaultSkin.add("default", defaultSelectBox); + } + + @Override + public void resize(int width, int height) { + if (initComplete) { + defaultSkin.dispose(); + gameScreen = null; + assetManager.clear(); + prefs.putInteger("screen-width", width); + prefs.putInteger("screen-height", height); + prefs.flush(); + } + setScreen(new LoadingScreen(this, getScreen(), true, !initComplete)); + super.resize(width, height); + } + + + public int fontScale(float fontSize) { + Gdx.app.debug("Font pixel size", MathUtils.round(Gdx.graphics.getDensity()*(fontSize*Gdx.graphics.getHeight())) + "px"); + return MathUtils.round(Gdx.graphics.getDensity()*(fontSize*Gdx.graphics.getHeight())); + } +} diff --git a/core/src/zero1hd/polyjet/RoundingResolutionHandler.java b/core/src/zero1hd/polyjet/RoundingResolutionHandler.java new file mode 100755 index 0000000..82097ac --- /dev/null +++ b/core/src/zero1hd/polyjet/RoundingResolutionHandler.java @@ -0,0 +1,66 @@ +package zero1hd.polyjet; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.assets.loaders.FileHandleResolver; +import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution; +import com.badlogic.gdx.files.FileHandle; +import com.badlogic.gdx.math.MathUtils; + +public class RoundingResolutionHandler implements FileHandleResolver { + private final Resolution[] descriptors; + private final FileHandleResolver resolver; + + public RoundingResolutionHandler(FileHandleResolver fileResolver, Resolution... descriptors) { + if (descriptors.length == 0) throw new IllegalArgumentException("At least one Resolution needs to be supplied."); + this.descriptors = descriptors; + this.resolver = fileResolver; + } + + + public Resolution chooseRounded(Resolution... descriptors) { + Resolution best = descriptors[0]; + + int leastDifference = -1; + + int w = MathUtils.round(Gdx.graphics.getWidth()*Gdx.graphics.getDensity()), h = MathUtils.round(Gdx.graphics.getHeight()*Gdx.graphics.getDensity()); + + if (w < h) { + for (int i = 0; i < descriptors.length; i++) { + int currentDiff = h - descriptors[i].portraitHeight; + + if (currentDiff < 0) { + currentDiff = currentDiff*-1; + } + + if (currentDiff < leastDifference || leastDifference == -1) { + best = descriptors[i]; + leastDifference = currentDiff; + } + } + } else { + for (int i = 0; i < descriptors.length; i++) { + int currentDiff = w - descriptors[i].portraitWidth; + + if (currentDiff < 0) { + currentDiff = currentDiff*-1; + } + + if (currentDiff < leastDifference || leastDifference == -1) { + best = descriptors[i]; + leastDifference = currentDiff; + } + } + } + return best; + } + + @Override + public FileHandle resolve(String fileName) { + Resolution bestRes = chooseRounded(descriptors); + FileHandle initialHandle = new FileHandle(fileName); + + FileHandle resSpecificFile = resolver.resolve(bestRes.folder + "/" + initialHandle.name()); + if (!resSpecificFile.exists()) resSpecificFile = resolver.resolve(fileName); + return resSpecificFile; + } +} diff --git a/core/src/zero1hd/polyjet/TransitionAdapter.java b/core/src/zero1hd/polyjet/TransitionAdapter.java new file mode 100755 index 0000000..d7633ce --- /dev/null +++ b/core/src/zero1hd/polyjet/TransitionAdapter.java @@ -0,0 +1,5 @@ +package zero1hd.polyjet; + +public interface TransitionAdapter { + public void postTransition(); +} diff --git a/core/src/zero1hd/polyjet/audio/AudioAnalyzer.java b/core/src/zero1hd/polyjet/audio/AudioAnalyzer.java new file mode 100755 index 0000000..7d703cb --- /dev/null +++ b/core/src/zero1hd/polyjet/audio/AudioAnalyzer.java @@ -0,0 +1,291 @@ +package zero1hd.polyjet.audio; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.utils.FloatArray; + +import edu.emory.mathcs.jtransforms.fft.FloatFFT_1D; + +public class AudioAnalyzer { + public boolean containsData; + + FloatFFT_1D fft; + public AudioData audiofile; + + float[] audioPCM; + float[] spectrum; + float[] lastSpectrum; + float[] fftData; + + Thread analyticalThread; + Runnable analysisAlgorithm; + int bassBinBegin; + int bassBinEnd; + private FloatArray bassSpectralFlux = new FloatArray(); + private FloatArray bassThreshold = new FloatArray(); + private FloatArray bassPrunned = new FloatArray(); + private FloatArray bassPeaks = new FloatArray(); + private float bassMaxValue; + + int UMBinBegin; + int UMBinEnd; + private FloatArray UMSpectralFlux = new FloatArray(); + private FloatArray UMThreshold = new FloatArray(); + private FloatArray UMPrunned = new FloatArray(); + private FloatArray UMPeaks = new FloatArray(); + private float UMMaxValue; + + private FloatArray overlappedBeats = new FloatArray(); + + float bassThresholdMultiplier; + float UMThresholdMultiplier; + int UMThresholdCalcRange; + int bassThresholdCalcRange; + + public AudioAnalyzer() { + analysisAlgorithm = new Runnable() { + + @Override + public void run() { + bassThresholdMultiplier = 1.5f; + UMThresholdMultiplier = 2f; + + bassBinBegin = binCalculator(60); + bassBinEnd = binCalculator(800); + + UMBinBegin = binCalculator(1500); + UMBinEnd = binCalculator(3000); + + UMThresholdCalcRange = thresholdRangeCalc(0.5f); + bassThresholdCalcRange = thresholdRangeCalc(0.7f); + + Gdx.app.debug("Read freq", String.valueOf(audiofile.getFormat().getSampleRate())); + Gdx.app.debug("Using following bin ranges", "\nBass freq begin: " + bassBinBegin + "\nBass freq end: " + bassBinEnd + "\nMain freq begin: " + UMBinBegin + "\nMain freq end: " + UMBinEnd); + + + Gdx.app.debug("Threshold Calc Range UM", String.valueOf(UMThresholdCalcRange)); + Gdx.app.debug("Threshold Calc Range Bass", String.valueOf(bassThresholdCalcRange)); + + + fft = new FloatFFT_1D(audiofile.getReadWindowSize()); + while (audiofile.readSamples(audioPCM) > 0) { + + + fft.realForward(audioPCM); + + System.arraycopy(spectrum, 0, lastSpectrum, 0, spectrum.length); + System.arraycopy(audioPCM, 0, spectrum, 0, spectrum.length); + + float fluxVal = 0; + //bass detection + fluxVal = 0; + for (int i = bassBinBegin; i < bassBinEnd; i++) { + fluxVal += ((int) (spectrum[i] - lastSpectrum[i])) > 0 + ? (int) (spectrum[i] - lastSpectrum[i]) : 0; + } + bassSpectralFlux.add(fluxVal); + + //main detection + fluxVal = 0; + for (int i = UMBinBegin; i < UMBinEnd; i++) { + fluxVal += ((int) (spectrum[i] - lastSpectrum[i])) > 0 + ? (int) (spectrum[i] - lastSpectrum[i]) : 0; + } + UMSpectralFlux.add(fluxVal); + } + + Gdx.app.debug("Audio Analyzer", "Done getting spectral flux."); + + //threshold calculation + for (int i = 0; i < UMSpectralFlux.size; i++) { + int UMStart = Math.max(0, i - UMThresholdCalcRange/2); + int UMEnd = Math.min(UMSpectralFlux.size - 1, i + UMThresholdCalcRange/2); + + int bassStart = Math.max(0, i - bassThresholdCalcRange/2); + int bassEnd = Math.min(UMSpectralFlux.size - 1, i + bassThresholdCalcRange/2); + + float average = 0; + for (int j = bassStart; j <= bassEnd; j++) { + average += bassSpectralFlux.get(j); + } + average /= (bassEnd - bassStart); + bassThreshold.add(average * bassThresholdMultiplier); + + average = 0; + for (int j = UMStart; j <= UMEnd; j++) { + average+= UMSpectralFlux.get(j); + } + average /= (UMEnd - UMStart); + UMThreshold.add(average*UMThresholdMultiplier); + } + + Gdx.app.debug("Audio Analyzer", "Threshold calculated."); + + + //pruning data + float prunnedCurrentVal; + for (int i = 0; i < UMSpectralFlux.size; i++) { + prunnedCurrentVal = bassSpectralFlux.get(i) - bassThreshold.get(i); + + if (prunnedCurrentVal >= 0) { + bassPrunned.add(prunnedCurrentVal); + } else { + bassPrunned.add(0); + } + + prunnedCurrentVal = UMSpectralFlux.get(i) - UMThreshold.get(i); + + if (prunnedCurrentVal >= 0 ) { + UMPrunned.add(prunnedCurrentVal); + } else { + UMPrunned.add(0); + } + } + Gdx.app.debug("Audio Analyzer", "Data prunned."); + + //peak detection + for (int i = 0; i < UMPrunned.size-1; i++) { + bassPeaks.add((bassPrunned.get(i) > bassPrunned.get(i+1) ? bassPrunned.get(i) : 0)); + if (bassPeaks.get(i) > bassMaxValue) { + bassMaxValue = bassPeaks.get(i); + } + + UMPeaks.add((UMPrunned.get(i) > UMPrunned.get(i+1) ? UMPrunned.get(i) : 0)); + if (UMPeaks.get(i) > UMMaxValue) { + UMMaxValue = UMPeaks.get(i); + } + } + + Gdx.app.debug("Audio Analyzer", "Found all peaks."); + + //overlapping beats + for (int i = 0; i < UMPeaks.size; i++) { + if (bassPeaks.get(i) != 0 && UMPeaks.get(i) != 0) { + overlappedBeats.add(bassPeaks.get(i)+UMPeaks.get(i)/2); + } else { + overlappedBeats.add(0); + } + } + + + + Gdx.app.debug("Audio Analyzer", "overlapped beats checked."); + shrinkData(); + containsData = true; + } + }; + } + + public void resetVars() { + bassSpectralFlux.clear(); + bassThreshold.clear(); + bassPrunned.clear(); + bassPeaks.clear(); + + UMSpectralFlux.clear(); + UMThreshold.clear(); + UMPrunned.clear(); + UMPeaks.clear(); + + overlappedBeats.clear(); + + containsData = false; + } + + public void shrinkData() { + bassSpectralFlux.shrink(); + bassThreshold.shrink(); + bassPrunned.shrink(); + bassPeaks.shrink(); + + UMSpectralFlux.shrink(); + UMThreshold.shrink(); + UMPrunned.shrink(); + UMPeaks.shrink(); + + overlappedBeats.shrink(); + } + + public void startAnalyticalThread(final AudioData audiofile) { + + fftData = new float[audiofile.getReadWindowSize()]; + spectrum = new float[(audiofile.getReadWindowSize()/2)+1]; + lastSpectrum = new float[(audiofile.getReadWindowSize()/2)+1]; + this.audiofile = audiofile; + + analyticalThread = new Thread(analysisAlgorithm); + analyticalThread.start(); + } + + public float[][] splitChannelData(float[] samples, int channelCount) { + int byteIndex = 0; + float[][] splitSamples = new float[channelCount][samples.length / (channelCount * 2)]; + for (int currentByte = 0; currentByte < samples.length;) { + for (int channel = 0; channel < channelCount; channel++) { + int low = (int) samples[currentByte]; + currentByte++; + int high = (int) samples[currentByte]; + currentByte++; + splitSamples[channel][byteIndex] = (high << 8) + (low & 0x00ff); + } + byteIndex++; + } + return splitSamples; + } + + public float[] convertPCM(float[] leftChannel, float[] rightChannel) { + float[] result = new float[leftChannel.length]; + for (int i = 0; i < leftChannel.length; i++) + result[i] = (leftChannel[i] + rightChannel[i]) / 2 / 32768.0f; + return result; + } + + public float[] byteToFloat(byte[] byteArray) { + float[] floatArray = new float[byteArray.length]; + for (int i = 0; i < byteArray.length; i++) { + floatArray[i] = byteArray[i]; + } + return floatArray; + } + + public FloatArray getBassPeaks() { + return bassPeaks; + } + public FloatArray getUMPeaks() { + return UMPeaks; + } + + private int binCalculator(int frequency) { + float totalBins = audiofile.getReadWindowSize()/2 +1; + float frequencyRange = audiofile.getFormat().getSampleRate()/2; + + //Formula derived from: (22050b/513)+(22050/513/2) = F + //let b be the bin + //let F be the frequency. + return (int) (totalBins*(frequency - (frequencyRange/totalBins*2))/frequencyRange); + } + + private int thresholdRangeCalc(float durationOfRange) { + float timePerWindow = (float)audiofile.getReadWindowSize()/audiofile.getFormat().getSampleRate(); + return (int) (durationOfRange/timePerWindow); + } + + public float getBassMaxValue() { + return bassMaxValue; + } + + public float getUMMaxValue() { + return UMMaxValue; + } + + public int getReadIndex() { + if (audiofile.getReadIndex() < UMPeaks.size) { + return audiofile.getReadIndex(); + } else { + return 0; + } + } + + public boolean containsData() { + return containsData; + } +} diff --git a/core/src/zero1hd/polyjet/audio/AudioData.java b/core/src/zero1hd/polyjet/audio/AudioData.java new file mode 100755 index 0000000..e1a6c35 --- /dev/null +++ b/core/src/zero1hd/polyjet/audio/AudioData.java @@ -0,0 +1,55 @@ +package zero1hd.polyjet.audio; + +import javax.sound.sampled.AudioFormat; + +import com.badlogic.gdx.audio.Music; +import com.badlogic.gdx.files.FileHandle; + +public interface AudioData { + /** + * sets a integer variable to the current window of audio data the playback is at. + * Useful for efficiency because we compute once for that frame then get the values everytime it is required instead of calculating every time we get the index. + */ + public void readIndexUpdate(); + + /** + * Gets the current position in seconds + * @return the current frame of audio. + */ + public int getReadIndex(); + + /** + * Sets the current audio file + */ + public void setAudioFile(FileHandle setAudio); + + /** + * Completely resets the current audio data. Think of pooling, except, only one instance which is reused instead of multiple. + */ + public void reset(); + + /** + * returns the read window size. + * @return + */ + public int getReadWindowSize(); + + /** + * Gets the object to play the music. Contains playback data. + * @return + */ + public Music getPlaybackMusic(); + + /** + * read in samples and fills the array. + * @param samples the array that should contain said samples + * @return amount read. Will return 0 if end of stream. + */ + public int readSamples(float[] samples); + + /** + * Returns properly setup AudioFormat object. + * @return + */ + public AudioFormat getFormat(); +} diff --git a/core/src/zero1hd/polyjet/audio/Mp3AudioData.java b/core/src/zero1hd/polyjet/audio/Mp3AudioData.java new file mode 100755 index 0000000..cfd7809 --- /dev/null +++ b/core/src/zero1hd/polyjet/audio/Mp3AudioData.java @@ -0,0 +1,113 @@ +package zero1hd.polyjet.audio; + +import java.io.IOException; + +import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; +import javax.sound.sampled.UnsupportedAudioFileException; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.audio.Music; +import com.badlogic.gdx.files.FileHandle; + +import javazoom.jl.decoder.Obuffer; + +public class Mp3AudioData implements AudioData { + private int readWindowSize = 1024; + + private AudioInputStream audStream; + private AudioInputStream faudStream; + + private AudioFormat audioFormat; + private Music playbackMusic; + private int readIndex; + + @Override + public void readIndexUpdate() { + readIndex = (int) (playbackMusic.getPosition() * audioFormat.getSampleRate() / readWindowSize); + } + + @Override + public int getReadIndex() { + return readIndex; + } + + @Override + public void setAudioFile(FileHandle setAudio) { + reset(); + try { + audStream = AudioSystem.getAudioInputStream(setAudio.file()); + AudioFormat bFormat = audStream.getFormat(); + audioFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, bFormat.getSampleRate(), 16, bFormat.getChannels(), bFormat.getChannels()*2, bFormat.getSampleRate(), false); + faudStream = AudioSystem.getAudioInputStream(audioFormat, audStream); + } catch (UnsupportedAudioFileException | IOException e) { + e.printStackTrace(); + } + + + playbackMusic = Gdx.audio.newMusic(setAudio); + + } + + @Override + public void reset() { + if (playbackMusic != null) { + playbackMusic.stop(); + playbackMusic.dispose(); + playbackMusic = null; + } + + if (audStream != null) { + try { + audStream.close(); + faudStream.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + @Override + public int getReadWindowSize() { + return readWindowSize; + } + + @Override + public Music getPlaybackMusic() { + return playbackMusic; + } + + @Override + public int readSamples(float[] samples) { + int samplesRead = 0; + int sampleAverage = 0; + for (int currentSample = 0; currentSample < samples.length; currentSample++) { + for (int channel = 0; channel < audioFormat.getChannels(); channel++) { + try { + sampleAverage += audStream.read(); + if (sampleAverage == -1) { + break; + } + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + sampleAverage /= audioFormat.getChannels()*Short.MAX_VALUE+1; + samples[currentSample] = sampleAverage; + samplesRead++; + if (sampleAverage == -1) { + break; + } + } + return samplesRead; + } + + @Override + public AudioFormat getFormat() { + return audioFormat; + } + +} diff --git a/core/src/zero1hd/polyjet/audio/WavAudioData.java b/core/src/zero1hd/polyjet/audio/WavAudioData.java new file mode 100755 index 0000000..39d090d --- /dev/null +++ b/core/src/zero1hd/polyjet/audio/WavAudioData.java @@ -0,0 +1,83 @@ +package zero1hd.polyjet.audio; + +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; + +import javax.sound.sampled.AudioFormat; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.audio.Music; +import com.badlogic.gdx.files.FileHandle; + +import zero1hd.wavedecoder.WavDecoder; + +public class WavAudioData implements AudioData { + private int readWindowSize = 1024; + private InputStream inStream; + private InputStream bufferedAudioIn; + private AudioFormat format; + int readIndex; + Music playbackMusic; + WavDecoder decoder; + + @Override + public void readIndexUpdate() { + readIndex = (int) (playbackMusic.getPosition() * decoder.getSampleRate() / readWindowSize); + } + + @Override + public int getReadIndex() { + return readIndex; + } + + @Override + public void setAudioFile(FileHandle audioFileHandler) { + reset(); + + inStream = audioFileHandler.read(); + bufferedAudioIn = new BufferedInputStream(inStream); + decoder.setAudioFile(audioFileHandler.file()); + playbackMusic = Gdx.audio.newMusic(audioFileHandler); + format = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, (float) decoder.getSampleRate(), 16, decoder.getChannels(), decoder.getChannels()*2, (float)decoder.getSampleRate(), false); + } + + @Override + public void reset() { + if (playbackMusic != null) { + playbackMusic.stop(); + playbackMusic.dispose(); + playbackMusic = null; + } + + if (inStream != null) { + try { + bufferedAudioIn.close(); + inStream.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + @Override + public int getReadWindowSize() { + return readWindowSize; + } + + @Override + public Music getPlaybackMusic() { + return playbackMusic; + } + + @Override + public int readSamples(float[] samples) { + return decoder.readSamples(samples); + } + + @Override + public AudioFormat getFormat() { + return format; + } +} diff --git a/core/src/zero1hd/polyjet/entity/BarBeat.java b/core/src/zero1hd/polyjet/entity/BarBeat.java new file mode 100755 index 0000000..f4617b2 --- /dev/null +++ b/core/src/zero1hd/polyjet/entity/BarBeat.java @@ -0,0 +1,44 @@ +package zero1hd.polyjet.entity; + +import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.graphics.g2d.NinePatch; + +import zero1hd.polyjet.Polyjet; + +public class BarBeat extends Entity { + NinePatch texture; + float rate; + + public void initiate(float size, float rate, float spawnX, float spawnY, NinePatch texture) { + hitpoints = 1; + this.rate = rate; + setPosition(spawnX, spawnY); + this.texture = texture; + } + + @Override + public void act(float delta) { + if (getY() + getHeight() < Polyjet.GAME_AREA_HEIGHT) { + hitpoints = 0; + } + moveBy(0, -rate*delta); + super.act(delta); + } + + @Override + public void draw(Batch batch, float parentAlpha) { + texture.draw(batch, getX(), getY(), getWidth(), getHeight()); + super.draw(batch, parentAlpha); + } + + @Override + public int getDamageDealt() { + return 10; + } + + @Override + public void reset() { + texture = null; + super.reset(); + } +} diff --git a/core/src/zero1hd/polyjet/entity/Entity.java b/core/src/zero1hd/polyjet/entity/Entity.java new file mode 100755 index 0000000..8185adc --- /dev/null +++ b/core/src/zero1hd/polyjet/entity/Entity.java @@ -0,0 +1,71 @@ +package zero1hd.polyjet.entity; + +import com.badlogic.gdx.math.Rectangle; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.utils.Pool.Poolable; + +public class Entity extends Actor implements Poolable { + private Rectangle hitbox; + protected int hitpoints; + + public Entity() { + hitbox = new Rectangle(); + } + + @Override + public void setSize(float width, float height) { + hitbox.setSize(width, height); + super.setSize(width, height); + } + + @Override + public void act(float delta) { + hitbox.setPosition(getX(), getY()); + super.act(delta); + } + + /** + * @return amount of hp this entity has left. + */ + public int getHitPoints() { + return hitpoints; + } + + /** + * used as a hitbox. + * @return a rectangle used for hit detection + */ + public Rectangle getHitbox() { + return hitbox; + } + + /** + * Returns 0 if not overridden. + * @return the amount of damage dealt. + */ + public int getDamageDealt() { + return 0; + } + + /** + * Doesn't do anything if not overridden. + * @param damageToDeal the amount of damage to deal to this entity. + */ + public void dealDamage(int damageToDeal) { + } + /** + * Default value is 0 if not overridden and setup properly. + * Note: this method is called whether or not this entity is dead. whenever two entities cross, this will be called. + * @return the amount of points this entity is worth + */ + public int getPoints() { + return 0; + } + + @Override + public void reset() { + setPosition(0, 0); + setSize(0, 0); + hitpoints = 0; + } +} diff --git a/core/src/zero1hd/polyjet/entity/PolyJetEntity.java b/core/src/zero1hd/polyjet/entity/PolyJetEntity.java new file mode 100755 index 0000000..1904280 --- /dev/null +++ b/core/src/zero1hd/polyjet/entity/PolyJetEntity.java @@ -0,0 +1,68 @@ +package zero1hd.polyjet.entity; + +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.graphics.g2d.ParticleEffect; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.actions.Actions; + +import zero1hd.polyjet.Polyjet; + +public class PolyJetEntity extends Actor { + + private ParticleEffect thrust; + private Texture polyjet; + private ParticleEffect teleportCloak; + + + public boolean moveLeft, moveRight, moveUp, moveDown, teleporting; + private int rate; + public PolyJetEntity(Polyjet core, int rate, String jet) { + this.rate = rate; + + setSize(3, 3); + + setPosition(Polyjet.GAME_AREA_WIDTH/2 - getWidth()/2, -4f); + + polyjet = core.assetManager.get("polyjet-" + jet + ".png", Texture.class); + thrust = core.assetManager.get("standard_thrust.p", ParticleEffect.class); + thrust.start(); + + teleportCloak = core.assetManager.get("magicCircle.png", ParticleEffect.class); + + addAction(Actions.moveTo(getX(), 4f, 0.5f)); + } + + @Override + public void act(float delta) { + thrust.setPosition(getX()+(getWidth()-2)/2 - 1f/16f, getY()-0.15f); + thrust.update(delta); + teleportCloak.setPosition(getX() +(getWidth()-1)/2, getY() + (getHeight()-1)/2); + + super.act(delta); + + //Movement! + if (moveLeft && !moveRight) { + moveBy(-(rate*delta), 0); + } + if (moveRight && !moveLeft) { + moveBy(rate*delta, 0); + } + if (moveUp && !moveDown) { + moveBy(0, rate*delta); + } + + if (moveDown && !moveUp) { + moveBy(0, -rate*delta); + } + + } + + @Override + public void draw(Batch batch, float parentAlpha) { + thrust.draw(batch); + batch.draw(polyjet, getX(), getY(), getWidth(), getHeight()); + super.draw(batch, parentAlpha); + + } +} diff --git a/core/src/zero1hd/polyjet/entity/Projectile.java b/core/src/zero1hd/polyjet/entity/Projectile.java new file mode 100755 index 0000000..363f1ce --- /dev/null +++ b/core/src/zero1hd/polyjet/entity/Projectile.java @@ -0,0 +1,75 @@ +package zero1hd.polyjet.entity; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.Batch; + +import zero1hd.polyjet.Polyjet; + +public class Projectile extends Entity { + float rate; + int damage; + Texture texture; + int hp; + int storedPoints; + + public Projectile() { + super(); + Gdx.app.debug("Projectile", "A new projectile was created."); + } + /** + * + * @param spawnX x spawn location + * @param spawnY y spawn location + * @param rate r/second + * @param hp health this projectile should have + * @param texture texture this projectile should render. + */ + public void initiate(float spawnX, float spawnY, float rate, int hp, Texture texture, float width, float height) { + this.hp = hp; + setX(spawnX); + setY(spawnY); + this.texture = texture; + this.rate = rate; + setSize(width, height); + damage = 1; + } + + public void setDamage(int damage) { + this.damage = damage; + } + + public void printDebug() { + Gdx.app.debug("Projectile", "Coordinates (X,Y): (" + getX() + ", " + getY() + ") Current parent: " + getParent().getName()); + Gdx.app.debug("Projectile", "Width and height: " + getWidth() + "x" + getHeight()); + } + + + @Override + public void act(float delta) { + moveBy(0, delta*rate); + if (getY() > Polyjet.GAME_AREA_HEIGHT) { + hp = 0; + } + super.act(delta); + } + + @Override + public void draw(Batch batch, float parentAlpha) { + batch.draw(texture, getX(), getY(), getWidth(), getHeight()); + super.draw(batch, parentAlpha); + } + + @Override + public void reset() { + texture = null; + storedPoints = 0; + rate = 0; + damage = 0; + setDebug(false); + } + @Override + public int getHitPoints() { + return hp; + } +} diff --git a/core/src/zero1hd/polyjet/maps/KeyMap.java b/core/src/zero1hd/polyjet/maps/KeyMap.java new file mode 100755 index 0000000..e1a5602 --- /dev/null +++ b/core/src/zero1hd/polyjet/maps/KeyMap.java @@ -0,0 +1,142 @@ +package zero1hd.polyjet.maps; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input.Keys; +import com.badlogic.gdx.Preferences; +import com.badlogic.gdx.graphics.g2d.TextureAtlas; +import com.badlogic.gdx.graphics.g2d.TextureRegion; + +import zero1hd.polyjet.Polyjet; + +public class KeyMap { + TextureAtlas keyTextures; + private Preferences keyBindPrefs; + + public static final String UP = "up"; + public static final String DOWN = "down"; + public static final String LEFT = "left"; + public static final String RIGHT = "right"; + + public static final String SHOOT = "shoot"; + + public static final String FIRSTTHIRDTELEPORT = "firstThirdTP"; + public static final String SECONDTHIRDTELEPORT = "secondThirdTP"; + public static final String THIRDTHIRDTELEPORT = "thirdThirdTP"; + + /** + * forward binding. + */ + public static int up; + /** + * backward binding. + */ + public static int down; + /** + * left binding. + */ + public static int left; + /** + * right binding. + */ + public static int right; + /** + * shoot binding + */ + public static int shoot; + /** + * teleport first third binding + */ + public static int firstThirdTeleport; + /** + * teleport second third binding + */ + public static int secondThirdTeleport; + /** + * teleport third third binding + */ + public static int thirdThirdTeleport; + + + public KeyMap(Polyjet core) { + keyTextures = core.assetManager.get("keyboard.atlas", TextureAtlas.class); + + setKeys(Gdx.app.getPreferences("PolyJet_Controls")); + updateKeys(); + } + + public Preferences getKeys() { + return keyBindPrefs; + } + + public void setKeys(Preferences keys) { + this.keyBindPrefs = keys; + } + + public TextureRegion getIcon(int keycode) { +// Gdx.app.debug("Keycode texture name", Keys.toString(keycode)); + + switch (keycode) { + case Keys.ALT_LEFT: + case Keys.ALT_RIGHT: + return keyTextures.findRegion("Keyboard_Black_Alt"); + case Keys.SHIFT_LEFT: + case Keys.SHIFT_RIGHT: + return keyTextures.findRegion("Keyboard_Black_Shift"); + case Keys.LEFT_BRACKET: + return keyTextures.findRegion("Keyboard_Black_Bracket_Left"); + case Keys.RIGHT_BRACKET: + return keyTextures.findRegion("Keyboard_Black_Bracket_Right"); + case Keys.SEMICOLON: + return keyTextures.findRegion("Keyboard_Black_Semicolon"); + case Keys.SLASH: + return keyTextures.findRegion("Keyboard_Black_Slash"); + case Keys.NUM: + return keyTextures.findRegion("Keyboard_Black_Num_Lock"); + default: + return keyTextures.findRegion("Keyboard_Black_" + Keys.toString(keycode).replace(' ', '_')); + } + } + + public void updateKeys() { + up = keyBindPrefs.getInteger(KeyMap.UP, Keys.UP); + down = keyBindPrefs.getInteger(KeyMap.DOWN, Keys.DOWN); + left = keyBindPrefs.getInteger(KeyMap.LEFT, Keys.LEFT); + right = keyBindPrefs.getInteger(KeyMap.RIGHT, Keys.RIGHT); + + shoot = keyBindPrefs.getInteger(KeyMap.SHOOT, Keys.SPACE); + + firstThirdTeleport = keyBindPrefs.getInteger(KeyMap.FIRSTTHIRDTELEPORT, Keys.Q); + secondThirdTeleport = keyBindPrefs.getInteger(KeyMap.SECONDTHIRDTELEPORT, Keys.W); + thirdThirdTeleport = keyBindPrefs.getInteger(KeyMap.THIRDTHIRDTELEPORT, Keys.E); + } + + /** + * resets all binding to default; + */ + public void resetAllBinding() { + keyBindPrefs.clear(); + keyBindPrefs.flush(); + } + + public int stringToID(String control) { + if (control == KeyMap.UP) { + return KeyMap.up; + } else if (control == KeyMap.DOWN) { + return KeyMap.down; + } else if (control == KeyMap.LEFT) { + return KeyMap.left; + } else if (control == KeyMap.RIGHT) { + return KeyMap.right; + } else if (control == KeyMap.SHOOT) { + return KeyMap.shoot; + } else if (control == KeyMap.FIRSTTHIRDTELEPORT) { + return KeyMap.firstThirdTeleport; + } else if (control == KeyMap.SECONDTHIRDTELEPORT) { + return KeyMap.secondThirdTeleport; + } else if (control == KeyMap.THIRDTHIRDTELEPORT) { + return KeyMap.thirdThirdTeleport; + } else { + return -1; + } + } +} diff --git a/core/src/zero1hd/polyjet/maps/RhythmMap.java b/core/src/zero1hd/polyjet/maps/RhythmMap.java new file mode 100755 index 0000000..a56e829 --- /dev/null +++ b/core/src/zero1hd/polyjet/maps/RhythmMap.java @@ -0,0 +1,40 @@ +package zero1hd.polyjet.maps; + +import com.badlogic.gdx.Gdx; + +import zero1hd.polyjet.audio.AudioAnalyzer; + +public class RhythmMap { + private boolean done; + public Thread generator; + public GenerationAlgorithm generationAlgorithm; + int window = 0; + public AudioAnalyzer analyzer; + + public RhythmMap(AudioAnalyzer analyzer) { + this.analyzer = analyzer; + generationAlgorithm = new GenerationAlgorithm(); + } + + public void generateMapData(int difficulty) { + generationAlgorithm.setDifficulty(difficulty); + generator = new Thread(generationAlgorithm); + generator.start(); + } + + public boolean isDone() { + return done; + } + + private class GenerationAlgorithm implements Runnable { + private int difficulty; + @Override + public void run() { + Gdx.app.debug("Difficulty", String.valueOf(difficulty)); + } + + public void setDifficulty(int difficulty) { + this.difficulty = difficulty; + } + } +} diff --git a/core/src/zero1hd/polyjet/screens/CreativeDebugScreen.java b/core/src/zero1hd/polyjet/screens/CreativeDebugScreen.java new file mode 100755 index 0000000..e139140 --- /dev/null +++ b/core/src/zero1hd/polyjet/screens/CreativeDebugScreen.java @@ -0,0 +1,50 @@ +package zero1hd.polyjet.screens; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.InputMultiplexer; +import com.badlogic.gdx.ScreenAdapter; +import com.badlogic.gdx.graphics.GL20; + +import zero1hd.polyjet.Polyjet; +import zero1hd.polyjet.ui.stages.CreativeStage; +import zero1hd.polyjet.ui.stages.GamePlayArea; + +public class CreativeDebugScreen extends ScreenAdapter { + CreativeStage creative; + GamePlayArea gamePlayArea; + InputMultiplexer inputs; + + + public CreativeDebugScreen(Polyjet core) { + creative = new CreativeStage(core); + gamePlayArea = new GamePlayArea(core); + inputs = new InputMultiplexer(creative, gamePlayArea); + } + + @Override + public void show() { + Gdx.input.setInputProcessor(inputs); + super.show(); + } + + @Override + public void render(float delta) { + Gdx.gl.glClearColor(1f, 1f, 1f, 1f); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); + + gamePlayArea.getViewport().apply(); + gamePlayArea.act(); + gamePlayArea.draw(); + + creative.getViewport().apply(); + creative.act(); + creative.draw(); + super.render(delta); + } + + @Override + public void resize(int width, int height) { + // TODO Auto-generated method stub + super.resize(width, height); + } +} diff --git a/core/src/zero1hd/polyjet/screens/GameScreen.java b/core/src/zero1hd/polyjet/screens/GameScreen.java new file mode 100755 index 0000000..44b7e13 --- /dev/null +++ b/core/src/zero1hd/polyjet/screens/GameScreen.java @@ -0,0 +1,260 @@ +package zero1hd.polyjet.screens; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input.Keys; +import com.badlogic.gdx.InputMultiplexer; +import com.badlogic.gdx.InputProcessor; +import com.badlogic.gdx.ScreenAdapter; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; +import com.badlogic.gdx.scenes.scene2d.ui.Window; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; + +import zero1hd.polyjet.Polyjet; +import zero1hd.polyjet.audio.AudioData; +import zero1hd.polyjet.maps.RhythmMap; +import zero1hd.polyjet.ui.stages.GamePlayArea; +import zero1hd.polyjet.ui.windows.FPSWindow; + +public class GameScreen extends ScreenAdapter implements InputProcessor { + private GamePlayArea gameArea; + public InputMultiplexer inputs; + + public boolean paused = false; + private boolean debug = false; + + public Polyjet core; + public Stage overlay; + private Label scoreLabel; + Window pauseMenu; + FPSWindow FPSDisplay; + + private AudioData music; + + public GameScreen(Polyjet polyJet) { + core = polyJet; + + // Overlay stuff + overlay = new Stage(); + scoreLabel = new Label("Score: 0", core.defaultSkin, "default-font", Color.WHITE); + scoreLabel.setPosition(25, Gdx.graphics.getHeight() - scoreLabel.getHeight() - 25); + + ImageButton pause = new ImageButton(core.defaultSkin.getDrawable("pause"), + core.defaultSkin.getDrawable("pause-down")); + pause.setPosition(Gdx.graphics.getWidth() - pause.getWidth() - 25, + Gdx.graphics.getHeight() - pause.getHeight() - 25); + pause.addListener(new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + pause(); + } + }); + + WidgetGroup healthBar = new WidgetGroup(); + final Image healthBarTank = new Image(core.defaultSkin.getPatch("bar-empty")); + healthBarTank.setHeight(100); + healthBar.setSize(healthBarTank.getWidth(), healthBarTank.getHeight()); + healthBar.setPosition(Gdx.graphics.getWidth() - healthBar.getWidth() - 16, + pause.getY() - healthBar.getHeight() - 32); + + Image healthBarFiller = new Image(core.defaultSkin.getPatch("bar-fill")) { + @Override + public void act(float delta) { + setHeight( + ((float) gameArea.getHealth() / (float) gameArea.getMaxHealth()) * (healthBarTank.getHeight())); + super.act(delta); + } + }; + healthBar.addActor(healthBarFiller); + healthBar.addActor(healthBarTank); + overlay.addActor(healthBar); + + FPSDisplay = new FPSWindow("FPS", core.defaultSkin); + overlay.addActor(pause); + overlay.addActor(scoreLabel); + + // Pause menu + pauseMenu = new Window("Paused", core.defaultSkin); + pauseMenu.add(new TextButton("resume", core.defaultSkin) { + { + addListener(new ChangeListener() { + + @Override + public void changed(ChangeEvent event, Actor actor) { + recommence(); + } + }); + } + }).space(20f); + pauseMenu.setModal(true); + pauseMenu.setPosition((Gdx.graphics.getWidth() - pauseMenu.getWidth()) / 2, + (Gdx.graphics.getHeight() - pauseMenu.getHeight()) / 2); + + // Continue to add things to input multiplexer + gameArea = new GamePlayArea(core); + + inputs = new InputMultiplexer(); + inputs.addProcessor(this); + inputs.addProcessor(overlay); + inputs.addProcessor(gameArea); + + if (!paused) { + music.getPlaybackMusic().play(); + } + } + + public void setMap (RhythmMap map) { + this.music = map.analyzer.audiofile; + gameArea.setMap(map); + } + + @Override + public void show() { + Gdx.input.setInputProcessor(inputs); + super.show(); + } + + @Override + public void render(float delta) { + Gdx.gl.glClearColor(1f, 1f, 1f, 1f); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); + gameArea.getViewport().apply(); + gameArea.draw(); + + overlay.getViewport().apply(); + overlay.draw(); + if (!paused) { + music.readIndexUpdate(); + gameArea.setAudioIndex(music.getReadIndex()); + scoreLabel.setText("Score: " + gameArea.getScore()); + gameArea.act(delta); + + if (gameArea.getHealth() == 0) { + end(false); + } + + overlay.act(delta); + } else { + } + + if (!music.getPlaybackMusic().isPlaying()) { + end(true); + } + } + + private void end(boolean trueEnd) { + if (trueEnd) { + // TODO they didn't die + } else { + // TODO They done goofed and ended up dying. + } + } + + @Override + public void dispose() { + overlay.dispose(); + gameArea.dispose(); + super.dispose(); + } + + @Override + public void resize(int width, int height) { + gameArea.getViewport().update(width, height, true); + overlay.getViewport().update(width, height, true); + + super.resize(width, height); + } + + @Override + public void pause() { + paused = true; + overlay.addActor(pauseMenu); + music.getPlaybackMusic().pause(); + super.pause(); + } + + @Override + public void resume() { + super.resume(); + } + + public void recommence() { + paused = false; + pauseMenu.remove(); + music.getPlaybackMusic().play(); + } + + @Override + public boolean keyUp(int keycode) { + switch (keycode) { + case Keys.F3: + if (debug) { + debug = false; + for (int i = 0; i < gameArea.getActors().size; i++) { + gameArea.setDebugAll(debug); + } + FPSDisplay.remove(); + } else { + debug = true; + for (int i = 0; i < gameArea.getActors().size; i++) { + gameArea.setDebugAll(debug); + } + overlay.addActor(FPSDisplay); + } + + break; + + case Keys.ESCAPE: + if (paused) { + recommence(); + } else { + pause(); + } + break; + } + return false; + } + + @Override + public boolean keyTyped(char character) { + return false; + } + + @Override + public boolean mouseMoved(int screenX, int screenY) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean scrolled(int amount) { + return false; + } + + @Override + public boolean keyDown(int keycode) { + return false; + } + + @Override + public boolean touchDown(int screenX, int screenY, int pointer, int button) { + return false; + } + + @Override + public boolean touchUp(int screenX, int screenY, int pointer, int button) { + return false; + } + + @Override + public boolean touchDragged(int screenX, int screenY, int pointer) { + return false; + } +} \ No newline at end of file diff --git a/core/src/zero1hd/polyjet/screens/LoadingScreen.java b/core/src/zero1hd/polyjet/screens/LoadingScreen.java new file mode 100755 index 0000000..78b9808 --- /dev/null +++ b/core/src/zero1hd/polyjet/screens/LoadingScreen.java @@ -0,0 +1,77 @@ +package zero1hd.polyjet.screens; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Screen; +import com.badlogic.gdx.ScreenAdapter; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.ParticleEffect; +import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.actions.Actions; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.utils.viewport.ScreenViewport; + +import zero1hd.polyjet.Polyjet; +import zero1hd.polyjet.TransitionAdapter; + +public class LoadingScreen extends ScreenAdapter { + private Stage stage; + Polyjet core; + Image zero1HD; + Screen gotoScreen; + boolean reInit; + + public LoadingScreen(Polyjet core, Screen gotoScreen, boolean reInit, boolean timer) { + this.core = core; + this.gotoScreen = gotoScreen; + this.reInit = reInit; + + stage = new Stage(new ScreenViewport()); + core.assetManager.load("splashlogo.png", Texture.class); + core.assetManager.finishLoading(); + zero1HD = new Image(this.core.assetManager.get("splashlogo.png", Texture.class)); + + zero1HD.setColor(0f,1f,1f,0f); + stage.addActor(zero1HD); + + zero1HD.setPosition(stage.getWidth()/2 - zero1HD.getWidth()/2, stage.getHeight()/2 - zero1HD.getHeight()/2); + if (timer) { + zero1HD.addAction(Actions.sequence(Actions.color(Color.WHITE, 1f))); + } + + core.queueAssets(); + } + + float count = 0; + @Override + public void render(float delta) { + Gdx.gl.glClearColor(1f, 1f, 1f, 1f); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + stage.act(delta); + + if (!zero1HD.hasActions() & core.assetManager.update()) { + Gdx.app.debug("Loading Screen", "queue has all been loaded. Action is done playing."); + zero1HD.remove(); + + core.generateFonts(); + core.defineSkinStyles(); + + if (reInit) { + ((TransitionAdapter) gotoScreen).postTransition(); + } + + core.setScreen(gotoScreen); + core.assetManager.unload("splashlogo.png"); + core.assetManager.get("standard_thrust.p", ParticleEffect.class).flipY(); + } + + stage.draw(); + super.render(delta); + } + @Override + public void resize(int width, int height) { + stage.getViewport().update(width, height, true); + super.resize(width, height); + } +} diff --git a/core/src/zero1hd/polyjet/screens/MainMenu.java b/core/src/zero1hd/polyjet/screens/MainMenu.java new file mode 100755 index 0000000..14e5ff2 --- /dev/null +++ b/core/src/zero1hd/polyjet/screens/MainMenu.java @@ -0,0 +1,122 @@ +package zero1hd.polyjet.screens; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input.Keys; +import com.badlogic.gdx.ScreenAdapter; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.math.Vector3; +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.utils.ClickListener; +import com.badlogic.gdx.utils.viewport.ScreenViewport; + +import zero1hd.polyjet.Polyjet; +import zero1hd.polyjet.TransitionAdapter; +import zero1hd.polyjet.ui.CreditsPage; +import zero1hd.polyjet.ui.MainPage; +import zero1hd.polyjet.ui.MoreOptionsPage; +import zero1hd.polyjet.ui.OptionsPage; + + + +public class MainMenu extends ScreenAdapter implements TransitionAdapter { + public Stage stage; + private Vector3 targetPosition; + + private MainPage mainPage; + private OptionsPage optionsPage; + private CreditsPage creditsPage; + private MoreOptionsPage moreOptionsPage; + + Polyjet core; + public MainMenu(final Polyjet core) { + this.core = core; + stage = new Stage(new ScreenViewport()); + targetPosition = new Vector3(stage.getCamera().position); + } + + public void postTransition() { + stage.clear(); + + mainPage = new MainPage(core, targetPosition); + mainPage.setPosition(0, 0); + stage.addActor(mainPage); + + //End main menu + moreOptionsPage = new MoreOptionsPage(core, targetPosition); + + optionsPage = new OptionsPage(core, targetPosition, moreOptionsPage); + optionsPage.setPosition(Gdx.graphics.getWidth(), 0); + stage.addActor(optionsPage); + + creditsPage = new CreditsPage(core.defaultSkin); + creditsPage.setPosition(0, Gdx.graphics.getHeight()); + stage.addActor(creditsPage); + + moreOptionsPage.setPosition(1f*Gdx.graphics.getWidth(), -1f*Gdx.graphics.getHeight()); + stage.addActor(moreOptionsPage); + + stage.addListener(new InputListener() { + @Override + public boolean keyUp(InputEvent event, int keycode) { + if (keycode == Keys.ESCAPE) { + stage.unfocusAll(); + if (targetPosition.x != 0.5f*Gdx.graphics.getWidth() || targetPosition.y != 0.5f*Gdx.graphics.getHeight()) { + targetPosition.x = 0.5f*Gdx.graphics.getWidth(); + targetPosition.y = 0.5f*Gdx.graphics.getHeight(); + } + moreOptionsPage.controlUnselect(); + optionsPage.saveOptions(core.prefs); + } + return super.keyUp(event, keycode); + } + }); + + stage.addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + if (stage.hit(x, y, true) == null) { + stage.unfocusAll(); + moreOptionsPage.controlUnselect(); + } + super.clicked(event, x, y); + } + }); + + Gdx.app.debug("Post Transition", "Beginning screen setup for Mainmenu."); + } + + @Override + public void show() { + Gdx.input.setInputProcessor(stage); + super.show(); + } + + @Override + public void render(float delta) { + Gdx.gl.glClearColor(1f, 1f, 1f, 1f); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + stage.act(); + stage.draw(); + if (stage.getCamera().position.x != targetPosition.x || stage.getCamera().position.y != targetPosition.y) { + stage.getCamera().position.lerp(targetPosition, 0.25f); + } + + super.render(delta); + } + + @Override + public void resize(int width, int height) { + stage.getViewport().update(width, height, false); + targetPosition.x = width/2; + targetPosition.y = height/2; + super.resize(width, height); + } + + @Override + public void dispose() { + stage.dispose(); + super.dispose(); + } +} diff --git a/core/src/zero1hd/polyjet/screens/PreGameScreen.java b/core/src/zero1hd/polyjet/screens/PreGameScreen.java new file mode 100755 index 0000000..82ec3d6 --- /dev/null +++ b/core/src/zero1hd/polyjet/screens/PreGameScreen.java @@ -0,0 +1,158 @@ +package zero1hd.polyjet.screens; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.ScreenAdapter; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.math.Vector3; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.actions.Actions; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; + +import zero1hd.polyjet.Polyjet; +import zero1hd.polyjet.TransitionAdapter; +import zero1hd.polyjet.audio.AudioAnalyzer; +import zero1hd.polyjet.audio.WavAudioData; +import zero1hd.polyjet.maps.RhythmMap; + + +public class PreGameScreen extends ScreenAdapter implements TransitionAdapter { + byte phase = 0; + Polyjet core; + Stage stage; + Label statusText; + + AudioAnalyzer analyzer; + WavAudioData audiofile; + RhythmMap rhythmMap; + Vector3 cameraTarget; + + Label lastStatement; + + public PreGameScreen(final Polyjet core) { + this.core = core; + analyzer = new AudioAnalyzer(); + rhythmMap = new RhythmMap(analyzer); + + stage = new Stage(); + + stage.addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + if (phase == 4) { + if (core.gameScreen != null) { + core.setScreen(core.gameScreen); + } else { + core.setScreen((core.gameScreen = new GameScreen(core))); + } + } + super.clicked(event, x, y); + } + }); + + cameraTarget = new Vector3(stage.getCamera().position); + postTransition(); + } + + @Override + public void postTransition() { + stage.clear(); + //draw music selector + + statusText = new Label(null, core.defaultSkin); + statusText.setPosition(1.6f*Gdx.graphics.getWidth(), (Gdx.graphics.getHeight()-statusText.getHeight())/2); + Image cyberCircle1 = new Image(core.assetManager.get("cybercircle3B.png", Texture.class)); + cyberCircle1.setScale(0.7f); + cyberCircle1.setOrigin(cyberCircle1.getWidth()/2, cyberCircle1.getHeight()/2); + cyberCircle1.setColor(0.8f,0.8f,0.8f,0.7f); + cyberCircle1.addAction(Actions.forever(Actions.rotateBy(-360f, 10f))); + cyberCircle1.setPosition(Gdx.graphics.getWidth()-cyberCircle1.getWidth()/2-10, -cyberCircle1.getHeight()*2/4f); + stage.addActor(cyberCircle1); + + Image cyberCircle2 = new Image(core.assetManager.get("cybercircle1.png", Texture.class)); + cyberCircle2.setPosition(1.5f*Gdx.graphics.getWidth()-cyberCircle2.getWidth()/2+20, (Gdx.graphics.getHeight()-cyberCircle2.getHeight())/2); + cyberCircle2.setColor(0.8f,0.8f,0.8f,0.7f); + cyberCircle2.addAction(Actions.alpha(0.7f)); + stage.addActor(cyberCircle2); + stage.addActor(statusText); + } + + @Override + public void render(float delta) { + Gdx.gl.glClearColor(1f, 1f, 1f, 1f); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + stage.getViewport().apply(); + stage.act(); + stage.draw(); + switch (phase) { + case 0: + + break; + case 1: + if (stage.getCamera().position.x != cameraTarget.x) { + stage.getCamera().position.lerp(cameraTarget, 0.25f); + } + if (analyzer.containsData()) { + phase++; + statusText.setText("Mapping beats"); + //TODO MAP GENERATION + } + break; + case 2: + //finish map generation + if (true) { + statusText.setText("Loading assets"); + statusText.setPosition(1.5f*Gdx.graphics.getWidth(), (Gdx.graphics.getHeight()-statusText.getHeight())/2); + + //list of assets needed for game screen exclusively + Gdx.app.debug("PreGameScreen Phase", String.valueOf(phase)); + phase++; + } + break; + case 3: + //Resource loading... + if (core.assetManager.update()) { + Gdx.app.debug("PreGameScreen Phase", String.valueOf(phase)); + phase++; + Gdx.app.debug("PreGameScreen Phase", String.valueOf(phase)); + cameraTarget.x = 2.5f*Gdx.graphics.getWidth(); + } + break; + case 4: + if (stage.getCamera().position.x != cameraTarget.x) { + stage.getCamera().position.lerp(cameraTarget, 0.25f); + } + + if (lastStatement == null) { + lastStatement = new Label("Are you ready?", core.defaultSkin); + lastStatement.setPosition(2.5f*Gdx.graphics.getWidth()-lastStatement.getWidth()/2, (Gdx.graphics.getHeight()-lastStatement.getHeight())/2); + stage.addActor(lastStatement); + } + break; + } + + super.render(delta); + } + + @Override + public void show() { + Gdx.input.setInputProcessor(stage); + analyzer.resetVars(); + super.show(); + } + + @Override + public void resize(int width, int height) { + stage.getViewport().update(width, height); + super.resize(width, height); + } + + @Override + public void dispose() { + stage.dispose(); + super.dispose(); + } +} diff --git a/core/src/zero1hd/polyjet/ui/CreditsPage.java b/core/src/zero1hd/polyjet/ui/CreditsPage.java new file mode 100755 index 0000000..7c2a0d4 --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/CreditsPage.java @@ -0,0 +1,26 @@ +package zero1hd.polyjet.ui; + +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; + +public class CreditsPage extends Page { + + public CreditsPage(Skin skin) { + Label title = new Label("Credits", skin, "large-font", skin.getColor("default")); + title.setPosition(15, getHeight()-title.getHeight()-15); + addActor(title); + + Label subtitle = new Label("This game wouldn't be possible without these people.", skin, "small-font", skin.getColor("default")); + subtitle.setPosition(title.getX(), title.getY()-subtitle.getHeight()); + addActor(subtitle); + + Label listOfNames = new Label( + "TheClimbingHippo (texture)\n" + + "Crepitus (sound effects)\n" + + "Neoqueto - Darktech LDR (font)\n" + + "Rémi Lagast - Gasalt (font)\n" + + "Timour Jgenti - Iron Maiden (font)", skin, "small-font", skin.getColor("default")); + listOfNames.setPosition(subtitle.getX()+16, subtitle.getY()-listOfNames.getHeight()-10); + addActor(listOfNames); + } +} diff --git a/core/src/zero1hd/polyjet/ui/MainPage.java b/core/src/zero1hd/polyjet/ui/MainPage.java new file mode 100755 index 0000000..5cf516b --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/MainPage.java @@ -0,0 +1,118 @@ +package zero1hd.polyjet.ui; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.math.Vector3; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.actions.Actions; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; + +import zero1hd.polyjet.Polyjet; +import zero1hd.polyjet.screens.PreGameScreen; + +public class MainPage extends Page { + private Image polyjetTitle; + private Label polyJetVersion; + private TextButton options; + private Image cyberCircle; + private Label begin; + private TextButton quit; + private TextButton credits; + private WidgetGroup playButton; + + public MainPage(final Polyjet core, final Vector3 targetPosition) { + polyjetTitle = new Image(core.assetManager.get("PolyjetTitle.png", Texture.class)); + polyjetTitle.setPosition(15, getHeight() - polyjetTitle.getHeight()-15); + addActor(polyjetTitle); + polyJetVersion = new Label("Version: " + Polyjet.VERSION, core.defaultSkin, "small-font", + core.defaultSkin.getColor("default")); + polyJetVersion.setPosition(3, 3); + addActor(polyJetVersion); + + options = new TextButton(" Options ", core.defaultSkin, "left"); + options.addListener(new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + // TODO Options screen + targetPosition.x = 1.5f * getWidth(); + } + }); + options.setPosition(-options.getWidth(), polyjetTitle.getY() - options.getHeight() - 30); + options.addAction(Actions.sequence(Actions.delay(0.25f), Actions.moveTo(0, options.getY(), 0.5f))); + addActor(options); + + credits = new TextButton(" Credits ", core.defaultSkin, "left"); + credits.addListener(new ChangeListener() { + + @Override + public void changed(ChangeEvent event, Actor actor) { + targetPosition.y = 1.5f * getHeight(); + } + }); + credits.setPosition(-credits.getWidth(), options.getY() - credits.getHeight() - 10); + credits.addAction(Actions.sequence(Actions.delay(0.5f), Actions.moveTo(0, credits.getY(), 0.5f))); + addActor(credits); + + quit = new TextButton(" Quit ", core.defaultSkin, "left"); + quit.setPosition(-quit.getWidth(), credits.getY() - credits.getHeight() - 10); + quit.addListener(new ChangeListener() { + + @Override + public void changed(ChangeEvent event, Actor actor) { + Gdx.app.exit(); + } + + }); + quit.addAction(Actions.sequence(Actions.delay(0.75f), Actions.moveTo(0, quit.getY(), 0.5f))); + addActor(quit); + + // begin play button + playButton = new WidgetGroup(); + + cyberCircle = new Image(core.assetManager.get("Tech-Circle1.png", Texture.class)); + cyberCircle.setOrigin(cyberCircle.getWidth() / 2, cyberCircle.getHeight() / 2); + cyberCircle.setColor(0.7f, 0.7f, 0.7f, 0.8f); + cyberCircle.addAction(Actions.forever(Actions.rotateBy(-360f, 10f))); + playButton.addActor(cyberCircle); + playButton.setSize(cyberCircle.getWidth(), cyberCircle.getHeight()); + + begin = new Label("Play", core.defaultSkin, "special-font", core.defaultSkin.getColor("default")); + begin.setColor(1f, 1f, 1f, 1f); + playButton.addActor(begin); + begin.setPosition(((playButton.getWidth() - begin.getWidth()) / 2)-10, + (playButton.getHeight() - begin.getHeight()) / 2); + playButton.setPosition(getWidth() - cyberCircle.getWidth() * 3 / 4, -cyberCircle.getHeight() / 4); + + // begin animation of begin button + playButton.addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + if (targetPosition.x == 0.5f * getWidth()) { + cyberCircle.addAction( + Actions.sequence(Actions.parallel(Actions.scaleBy(2f, 2f, 0.25f), Actions.fadeOut(0.25f)), + Actions.run(new Runnable() { + @Override + public void run() { + + if (core.preGameScreen != null) { + core.setScreen(core.preGameScreen); + } else { + core.setScreen(core.preGameScreen = new PreGameScreen(core)); + } + } + }), Actions.parallel(Actions.scaleTo(1, 1), Actions.alpha(0.6f)))); + } + super.clicked(event, x, y); + } + }); + addActor(playButton); + // end play button + } + +} diff --git a/core/src/zero1hd/polyjet/ui/MoreOptionsPage.java b/core/src/zero1hd/polyjet/ui/MoreOptionsPage.java new file mode 100755 index 0000000..68b46b9 --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/MoreOptionsPage.java @@ -0,0 +1,64 @@ +package zero1hd.polyjet.ui; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.math.Vector3; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; + +import zero1hd.polyjet.Polyjet; +import zero1hd.polyjet.maps.KeyMap; +import zero1hd.polyjet.ui.builders.ArrowButton; +import zero1hd.polyjet.ui.builders.GraphicsTable; +import zero1hd.polyjet.ui.builders.SetControls; + +public class MoreOptionsPage extends Page { + private KeyMap keymap; + private ScrollPane keyBinds; + private GraphicsTable graphicsSettings; + private SetControls controlSetter; + + public MoreOptionsPage(Polyjet core, final Vector3 targetLocation) { + keymap = new KeyMap(core); + + controlSetter = new SetControls(core.defaultSkin, keymap); + keyBinds = new ScrollPane(controlSetter, core.defaultSkin); + keyBinds.setSize(getWidth(), getHeight()); + addActor(keyBinds); + keyBinds.setVisible(false); + + graphicsSettings = new GraphicsTable(core.defaultSkin, core.prefs); + graphicsSettings.setSize(getWidth(), getHeight()); + addActor(graphicsSettings); + graphicsSettings.setVisible(false); + + ArrowButton backArrow = new ArrowButton(core.defaultSkin); + backArrow.setRotation(90f); + backArrow.setPosition(30, getHeight()-backArrow.getHeight()-10); + backArrow.addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + targetLocation.y = 0.5f*Gdx.graphics.getHeight(); + super.clicked(event, x, y); + } + }); + addActor(backArrow); + } + + public void controlUnselect() { + controlSetter.unselect(); + } + + public void setControlType(byte type) { + switch (type) { + case 0: + keyBinds.setVisible(true); + graphicsSettings.setVisible(false); + break; + case 1: + keyBinds.setVisible(false); + graphicsSettings.setVisible(true); + break; + } + } +} diff --git a/core/src/zero1hd/polyjet/ui/MusicSelectionPage.java b/core/src/zero1hd/polyjet/ui/MusicSelectionPage.java new file mode 100755 index 0000000..44ab580 --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/MusicSelectionPage.java @@ -0,0 +1,7 @@ +package zero1hd.polyjet.ui; + +public class MusicSelectionPage extends Page { + public MusicSelectionPage() { + + } +} diff --git a/core/src/zero1hd/polyjet/ui/OptionsPage.java b/core/src/zero1hd/polyjet/ui/OptionsPage.java new file mode 100755 index 0000000..9817157 --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/OptionsPage.java @@ -0,0 +1,176 @@ +package zero1hd.polyjet.ui; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input.Keys; +import com.badlogic.gdx.Preferences; +import com.badlogic.gdx.math.MathUtils; +import com.badlogic.gdx.math.Vector3; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.InputListener; +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.ui.ProgressBar; +import com.badlogic.gdx.scenes.scene2d.ui.Slider; +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.ui.TextField; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; + +import zero1hd.polyjet.Polyjet; +import zero1hd.polyjet.screens.CreativeDebugScreen; +import zero1hd.polyjet.ui.builders.ArrowButton; + +public class OptionsPage extends Page { + Table optionsTable = new Table(); + private ProgressBar musicVolSlider; + private ProgressBar fxVolSlider; + private TextField directoryField; + private Polyjet core; + + private byte goToScreen; + private ArrowButton backSymbol; + public OptionsPage(final Polyjet core, final Vector3 targetPosition, final MoreOptionsPage moreOptionsPage) { + this.core = core; + optionsTable.defaults().padTop(5f).padBottom(5f); + + Label optionGeneralTitle = new Label("General", core.defaultSkin, "large-font", core.defaultSkin.getColor("default")); + optionsTable.add(optionGeneralTitle).left().spaceBottom(10f); + + optionsTable.row(); + + Label musicVolSliderLabel = new Label("Music Volume: ", core.defaultSkin); + optionsTable.add(musicVolSliderLabel).left(); + musicVolSlider = new Slider(0, 100, 0.1f, false, core.defaultSkin); + musicVolSlider.setValue(core.prefs.getFloat("music vol", 100f)); + optionsTable.add(musicVolSlider).prefWidth(790); + final Label musicVolPercentage = new Label(MathUtils.round(musicVolSlider.getValue()) + "%", core.defaultSkin); + musicVolSlider.addListener(new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + saveOptions(core.prefs); + musicVolPercentage.setText(MathUtils.round(musicVolSlider.getValue()) + "%"); + } + }); + optionsTable.add(musicVolPercentage).spaceLeft(12f).left(); + + optionsTable.row(); + + Label fxVolSliderLabel = new Label("FX Volume: ", core.defaultSkin); + optionsTable.add(fxVolSliderLabel).left(); + fxVolSlider = new Slider(0, 100, 1, false, core.defaultSkin); + fxVolSlider.setValue(core.prefs.getFloat("fx vol", 100f)); + optionsTable.add(fxVolSlider).prefWidth(790); + final Label fxVolPercentage = new Label(MathUtils.round(fxVolSlider.getValue()) + "%", core.defaultSkin); + fxVolSlider.addListener(new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + saveOptions(core.prefs); + fxVolPercentage.setText(MathUtils.round(fxVolSlider.getValue()) + "%"); + } + }); + + optionsTable.add(fxVolPercentage).spaceLeft(12f).left(); + + optionsTable.row(); + + Label musicDirectoryLabel = new Label("Music Directory: ", core.defaultSkin); + optionsTable.add(musicDirectoryLabel).left(); + directoryField = new TextField(null, core.defaultSkin); + directoryField.setText(core.prefs.getString("music dir", System.getProperty("user.home")+System.getProperty("file.separator")+"Music")); + optionsTable.add(directoryField).prefWidth(810).left(); + + optionsTable.row(); + + Label debugCodeLabel = new Label("Debug Code: ", core.defaultSkin); + optionsTable.add(debugCodeLabel).left(); + final TextField debugCodeField = new TextField(null, core.defaultSkin); + debugCodeField.addListener(new InputListener() { + @Override + public boolean keyUp(InputEvent event, int keycode) { + if (keycode == Keys.ENTER) { + Gdx.app.debug("Debug Field", debugCodeField.getText()); + if (debugCodeField.getText().equals("creative")) { + saveOptions(core.prefs); + Gdx.app.debug("Debug Field", "going to creative test room..."); + goToScreen = 1; + } + } + return super.keyUp(event, keycode); + } + }); + optionsTable.add(debugCodeField).prefWidth(810).left(); + + optionsTable.top(); + + + //Back button + backSymbol = new ArrowButton(core.defaultSkin); + backSymbol.addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + targetPosition.x = 0.5f*Gdx.graphics.getWidth(); + super.clicked(event, x, y); + } + }); + backSymbol.setRotation(180); + backSymbol.setPosition(10, (getHeight()-backSymbol.getHeight())/2); + addActor(backSymbol); + + optionsTable.setPosition(backSymbol.getX()+ 20 + backSymbol.getWidth(), 0); + optionsTable.setSize(getWidth()-backSymbol.getWidth()-10-20-10, getHeight()); + addActor(optionsTable); + + + ArrowButton keybindSettings = new ArrowButton(core.defaultSkin); + keybindSettings.setRotation(270f); + keybindSettings.addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + moreOptionsPage.setControlType((byte) 0); + targetPosition.y = -0.5f*Gdx.graphics.getHeight(); + super.clicked(event, x, y); + } + }); + keybindSettings.setPosition(optionsTable.getWidth()/3, optionsTable.getY()); + addActor(keybindSettings); + Label controlsSection = new Label("Controls", core.defaultSkin); + controlsSection.setPosition(keybindSettings.getX()+(keybindSettings.getWidth()-controlsSection.getWidth())/2, keybindSettings.getHeight()+keybindSettings.getY()); + addActor(controlsSection); + + ArrowButton graphicsSettings = new ArrowButton(core.defaultSkin); + graphicsSettings.setRotation(270f); + graphicsSettings.addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + moreOptionsPage.setControlType((byte) 1); + targetPosition.y = -0.5f*Gdx.graphics.getHeight(); + super.clicked(event, x, y); + } + }); + graphicsSettings.setPosition(optionsTable.getWidth()*2/3, optionsTable.getY()); + addActor(graphicsSettings); + Label graphicsSection = new Label("Graphics", core.defaultSkin); + graphicsSection.setPosition(graphicsSettings.getX()+(graphicsSettings.getWidth()-graphicsSection.getWidth())/2, graphicsSettings.getHeight()+graphicsSettings.getY()); + addActor(graphicsSection); + } + + public void saveOptions(Preferences prefs) { + prefs.putFloat("music vol", musicVolSlider.getValue()); + prefs.putFloat("fx vol", fxVolSlider.getValue()); + prefs.putString("music dir", directoryField.getText()); + prefs.flush(); + } + + @Override + public void act(float delta) { + if (core.assetManager.update() && goToScreen != 0) { + switch (goToScreen) { + case 1: + core.setScreen(new CreativeDebugScreen(core)); + } + goToScreen = 0; + } + super.act(delta); + } + +} diff --git a/core/src/zero1hd/polyjet/ui/Page.java b/core/src/zero1hd/polyjet/ui/Page.java new file mode 100755 index 0000000..05d8a9d --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/Page.java @@ -0,0 +1,12 @@ +package zero1hd.polyjet.ui; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.scenes.scene2d.Group; +import com.badlogic.gdx.scenes.scene2d.Touchable; + +public class Page extends Group { + public Page() { + setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); + setTouchable(Touchable.childrenOnly); + } +} diff --git a/core/src/zero1hd/polyjet/ui/builders/ArrowButton.java b/core/src/zero1hd/polyjet/ui/builders/ArrowButton.java new file mode 100755 index 0000000..d4538c4 --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/builders/ArrowButton.java @@ -0,0 +1,15 @@ +package zero1hd.polyjet.ui.builders; + +import com.badlogic.gdx.scenes.scene2d.actions.Actions; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; + +public class ArrowButton extends Image { + public ArrowButton(Skin skin) { + super(skin.getDrawable("point-arrow")); + setOrigin(getWidth()/2, getHeight()/2); + setPosition(10, (getHeight()-getHeight())/2); + addAction(Actions.forever(Actions.sequence(Actions.alpha(0.5f, 1.5f), Actions.alpha(1f, 1.5f)))); + + } +} diff --git a/core/src/zero1hd/polyjet/ui/builders/AudioGraph.java b/core/src/zero1hd/polyjet/ui/builders/AudioGraph.java new file mode 100755 index 0000000..24c7721 --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/builders/AudioGraph.java @@ -0,0 +1,110 @@ +package zero1hd.polyjet.ui.builders; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input.Keys; +import com.badlogic.gdx.graphics.Pixmap; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.Pixmap.Format; +import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.utils.FloatArray; + +public class AudioGraph extends Actor { + Pixmap audioGraph; + Texture textureOfGraph; + FloatArray mainGraph; + FloatArray overlayGraph; + int dataIndex; + int displayMode; + + public AudioGraph(int graphSizeW, int graphSizeH) { + audioGraph = new Pixmap(graphSizeW, graphSizeH, Format.RGBA8888); + audioGraph.setColor(0.1f, 0.1f, 0.1f, 0.75f); + audioGraph.fill(); + + textureOfGraph = new Texture(audioGraph); + setWidth(graphSizeW); + setHeight(graphSizeH); + } + + public void setAudioDataIndex(int audioDataIndex) { + this.dataIndex = audioDataIndex; + } + + float scale = 0.2f; + @Override + public void act(float delta) { + audioGraph.setColor(0f, 0f, 0f, 0.75f); + audioGraph.fill(); + + if (Gdx.input.isKeyPressed(Keys.COMMA)) { + if (scale > 0.02) { + scale -= 0.005f; + } + } else if (Gdx.input.isKeyPressed(Keys.PERIOD)) { + if (scale < 1.5) { + scale += 0.005f; + } + } + if (Gdx.input.isKeyJustPressed(Keys.M)) { + displayMode++; + if (displayMode != 3) { + Gdx.app.debug("Graph", "Switching to another graph."); + } else { + displayMode = 0; + } + } + switch (displayMode) { + case 0: + audioGraph.setColor(1f, 0f, 0f, 0.75f); + for (int x = 0; x < audioGraph.getWidth(); x++) { + try { + audioGraph.drawLine(x, audioGraph.getHeight(), x, (int) (audioGraph.getHeight()-mainGraph.get(dataIndex+x-audioGraph.getWidth()/2)*scale)); + } catch (NullPointerException | IndexOutOfBoundsException e) { + + } + } + + case 1: + audioGraph.setColor(0f, 0f, 1f, 0.75f); + for (int x = 0; x < audioGraph.getWidth() -1; x++) { + try { + audioGraph.drawLine(x, audioGraph.getHeight(), x, (int) (audioGraph.getHeight()-overlayGraph.get(dataIndex+x-audioGraph.getWidth()/2)*scale)); + } catch (NullPointerException | IndexOutOfBoundsException e) { + + } + } + break; + case 2: + audioGraph.setColor(1f, 0f, 0f, 0.75f); + for (int x = 0; x < audioGraph.getWidth(); x++) { + try { + audioGraph.drawLine(x, audioGraph.getHeight(), x, (int) (audioGraph.getHeight()-mainGraph.get(dataIndex+x-audioGraph.getWidth()/2)*scale)); + } catch (NullPointerException | IndexOutOfBoundsException e) { + + } + } + break; + } + + + + audioGraph.setColor(0f, 1f, 0f, 0.95f); + audioGraph.drawLine(audioGraph.getWidth()/2, 0, audioGraph.getWidth()/2, audioGraph.getHeight()); + + textureOfGraph.draw(audioGraph, 0, 0); + super.act(delta); + } + + @Override + public void draw(Batch batch, float parentAlpha) { + batch.draw(textureOfGraph, getX(), getY(), getWidth(), getHeight()); + super.draw(batch, parentAlpha); + } + + public void setGraphingData(FloatArray dataSet1, FloatArray dataSet2) { + this.mainGraph = dataSet1; + this.overlayGraph = dataSet2; + } + +} diff --git a/core/src/zero1hd/polyjet/ui/builders/AudioGraphRelation.java b/core/src/zero1hd/polyjet/ui/builders/AudioGraphRelation.java new file mode 100755 index 0000000..4f41dc5 --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/builders/AudioGraphRelation.java @@ -0,0 +1,82 @@ +package zero1hd.polyjet.ui.builders; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input.Keys; +import com.badlogic.gdx.graphics.Pixmap; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.Pixmap.Format; +import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.utils.FloatArray; + +public class AudioGraphRelation extends Actor { + Pixmap audioGraph; + Texture textureOfGraph; + FloatArray mainGraph; + FloatArray overlayGraph; + int audioDataIndex; + + public AudioGraphRelation(FloatArray mainGraph, FloatArray overlayGraph, int graphSizeW, int graphSizeH) { + audioGraph = new Pixmap(graphSizeW, graphSizeH, Format.RGBA8888); + audioGraph.setColor(0.1f, 0.1f, 0.1f, 0.75f); + audioGraph.fill(); + + textureOfGraph = new Texture(audioGraph); + setWidth(Gdx.graphics.getWidth()); + setHeight(280); + this.mainGraph = mainGraph; + this.overlayGraph = overlayGraph; + } + + public void setAudioDataIndex(int audioDataIndex) { + this.audioDataIndex = audioDataIndex; + } + + float scale = 0.2f; + @Override + public void act(float delta) { + audioGraph.setColor(0f, 0f, 0f, 0.75f); + audioGraph.fill(); + + if (Gdx.input.isKeyPressed(Keys.COMMA)) { + if (scale > 0.02) { + scale -= 0.005f; + } + } else if (Gdx.input.isKeyPressed(Keys.PERIOD)) { + if (scale < 1) { + scale += 0.005f; + } + } + + audioGraph.setColor(0f, 1f, 1f, 0.75f); + for (int x = 0; x < audioGraph.getWidth() -1; x++) { + try { + audioGraph.drawLine(x, (int) (audioGraph.getHeight()-mainGraph.get(audioDataIndex+x-audioGraph.getWidth()/2)*scale), x+1, (int) (audioGraph.getHeight()-mainGraph.get(audioDataIndex+x+1-audioGraph.getWidth()/2)*scale)); + } catch (IndexOutOfBoundsException e) { + + } + } + + audioGraph.setColor(0f, 0.25f, 1f, 0.75f); + for (int x = 0; x < audioGraph.getWidth() -1; x++) { + try { + audioGraph.drawLine(x, (int) (audioGraph.getHeight()-overlayGraph.get(audioDataIndex+x-audioGraph.getWidth()/2)*scale), x+1, (int) (audioGraph.getHeight()-overlayGraph.get(audioDataIndex+x+1-audioGraph.getWidth()/2)*scale)); + } catch (IndexOutOfBoundsException e) { + + } + } + + audioGraph.setColor(0f, 0f, 1, 0.95f); + audioGraph.drawLine(audioGraph.getWidth()/2, 0, audioGraph.getWidth()/2, audioGraph.getHeight()); + + textureOfGraph.draw(audioGraph, 0, 0); + super.act(delta); + } + + @Override + public void draw(Batch batch, float parentAlpha) { + batch.draw(textureOfGraph, getX(), getY(), getWidth(), getHeight()); + super.draw(batch, parentAlpha); + } + +} diff --git a/core/src/zero1hd/polyjet/ui/builders/GraphicsTable.java b/core/src/zero1hd/polyjet/ui/builders/GraphicsTable.java new file mode 100755 index 0000000..1c38107 --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/builders/GraphicsTable.java @@ -0,0 +1,82 @@ +package zero1hd.polyjet.ui.builders; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Preferences; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.badlogic.gdx.utils.Align; + +public class GraphicsTable extends Table { + private Label explanation; + + private SetResolutionButton + _3840x2160, + _2560x1440, + _1920x1200, + _1920x1080, + _1280x800, + _1280x720, + _1366x768, + _800x480; + + + public GraphicsTable(Skin skin, final Preferences pref) { + align(Align.top); + defaults().space(10f); + + explanation = new Label("This game is freely resizable\n with a minimun size of\n800x480 and maximum of 3840x2160.\nThe following resolutions are the most optimal however.", skin, "small-font", skin.getColor("default")); + add(explanation); + row().space(15f); + + TextButton fullscreen = new TextButton("Fullscreen", skin); + fullscreen.addListener(new ChangeListener() { + + @Override + public void changed(ChangeEvent event, Actor actor) { + if (!Gdx.graphics.isFullscreen()) { + Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode()); + pref.putBoolean("fullscreen", true); + pref.flush(); + } + } + }); + add(fullscreen).fillX(); + row(); + + _3840x2160 = new SetResolutionButton(3840, 2160, skin, pref); + add(_3840x2160).fillX(); + row(); + + _2560x1440 = new SetResolutionButton(2560, 1440, skin, pref); + add(_2560x1440).fillX(); + row(); + + _1920x1200 = new SetResolutionButton(1920, 1200, skin, pref); + add(_1920x1200).fillX(); + row(); + + _1920x1080 = new SetResolutionButton(1920, 1080, skin, pref); + add(_1920x1080).fillX(); + row(); + + _1280x800 = new SetResolutionButton(1280, 800, skin, pref); + add(_1280x800).fillX(); + row(); + + _1280x720 = new SetResolutionButton(1280, 720, skin, pref); + add(_1280x720).fillX(); + row(); + + _1366x768 = new SetResolutionButton(1366, 768, skin, pref); + add(_1366x768).fillX(); + row(); + + _800x480 = new SetResolutionButton(800, 480, skin, pref); + add(_800x480).fillX(); + row(); + } +} diff --git a/core/src/zero1hd/polyjet/ui/builders/KeySetter.java b/core/src/zero1hd/polyjet/ui/builders/KeySetter.java new file mode 100755 index 0000000..79bd46b --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/builders/KeySetter.java @@ -0,0 +1,64 @@ +package zero1hd.polyjet.ui.builders; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input.Keys; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.InputListener; +import com.badlogic.gdx.scenes.scene2d.actions.Actions; + +import zero1hd.polyjet.maps.KeyMap; + +public class KeySetter extends Actor { + TextureRegion keyIcon; + KeyMap keyMap; + + public KeySetter(final KeyMap keyMap, final String control) { + this.keyMap = keyMap; + keyIcon = keyMap.getIcon(keyMap.stringToID(control)); + setSize(keyIcon.getRegionWidth(), keyIcon.getRegionHeight()); + + InputListener keyListener = new InputListener() { + @Override + public boolean keyUp(InputEvent event, int keycode) { + getStage().setKeyboardFocus(null); + Gdx.app.debug("KeySetter", "input keycode received: " + keycode); + if (keycode != Keys.ESCAPE) { + Gdx.app.debug("keySetter", "input has been set to: " + Keys.toString(keycode)); + if (setKey(keycode, control)) { + keyMap.updateKeys(); + addAction(Actions.sequence(Actions.color(Color.GREEN, 0.2f), Actions.color(Color.WHITE, 0.2f))); + } else { + addAction(Actions.sequence(Actions.color(Color.RED, 0.2f), Actions.delay(0.1f), Actions.color(Color.WHITE, 0.2f))); + } + } + return super.keyUp(event, keycode); + + } + }; + + addListener(keyListener); + + } + + + public boolean setKey(int keycode, String control) { + if (keyMap.getIcon(keycode) != null) { + keyMap.getKeys().putInteger(control, keycode); + keyIcon = keyMap.getIcon(keycode); + return true; + } else { + return false; + } + } + + @Override + public void draw(Batch batch, float parentAlpha) { + batch.setColor(getColor()); + batch.draw(keyIcon, getX(), getY(), getWidth(), getHeight()); + super.draw(batch, parentAlpha); + } +} diff --git a/core/src/zero1hd/polyjet/ui/builders/MusicSelectable.java b/core/src/zero1hd/polyjet/ui/builders/MusicSelectable.java new file mode 100644 index 0000000..8429e9f --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/builders/MusicSelectable.java @@ -0,0 +1,16 @@ +package zero1hd.polyjet.ui.builders; + +import com.badlogic.gdx.files.FileHandle; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.ui.Image; + +public class MusicSelectable extends Actor { + Image imageIcon; + FileHandle musicFile; + public MusicSelectable(FileHandle musicFile) { + this.musicFile = musicFile; + imageIcon = new Image(new Texture(musicFile)); + + } +} diff --git a/core/src/zero1hd/polyjet/ui/builders/SetControls.java b/core/src/zero1hd/polyjet/ui/builders/SetControls.java new file mode 100755 index 0000000..fed9f75 --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/builders/SetControls.java @@ -0,0 +1,102 @@ +package zero1hd.polyjet.ui.builders; + +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; +import com.badlogic.gdx.utils.Array; + +import zero1hd.polyjet.maps.KeyMap; + +public class SetControls extends Table { + public SetControls(Skin skin, KeyMap keyMap) { + super(skin); + + Label forwardKeyLabel = new Label("Forward: ",skin); + forwardKeyLabel.setName(KeyMap.UP); + add(forwardKeyLabel).left(); + KeySetter forwardKeySetter = new KeySetter(keyMap, KeyMap.UP); + add(forwardKeySetter); + + row(); + + Label backwardKeyLabel = new Label("Backward: ", skin); + backwardKeyLabel.setName(KeyMap.DOWN); + add(backwardKeyLabel).left(); + KeySetter backwardKeySetter = new KeySetter(keyMap, KeyMap.DOWN); + add(backwardKeySetter); + + row(); + + Label leftKeyLabel = new Label("Left: ", skin); + leftKeyLabel.setName(KeyMap.LEFT); + add(leftKeyLabel).left(); + KeySetter leftKeySetter = new KeySetter(keyMap, KeyMap.LEFT); + add(leftKeySetter); + + row(); + + Label rightKeyLabel = new Label("Right: ", skin); + rightKeyLabel.setName(KeyMap.RIGHT); + add(rightKeyLabel).left(); + KeySetter rightKeySetter = new KeySetter(keyMap, KeyMap.RIGHT); + add(rightKeySetter); + + row(); + + Label shootKeyLabel = new Label("Shoot: ", skin); + shootKeyLabel.setName(KeyMap.SHOOT); + add(shootKeyLabel).left(); + KeySetter shootKeySetter = new KeySetter(keyMap, KeyMap.SHOOT); + add(shootKeySetter); + + row(); + + Label sector1TPKeyLabel = new Label("Left Teleport", skin); + sector1TPKeyLabel.setName(KeyMap.FIRSTTHIRDTELEPORT); + add(sector1TPKeyLabel).left(); + KeySetter Sector1TPKeySetter = new KeySetter(keyMap, KeyMap.FIRSTTHIRDTELEPORT); + add(Sector1TPKeySetter); + + row(); + + Label sector2TPKeyLabel = new Label("Middle Teleport: ", skin); + sector2TPKeyLabel.setName(KeyMap.SECONDTHIRDTELEPORT); + add(sector2TPKeyLabel).left(); + KeySetter sector2TPKeySetter = new KeySetter(keyMap, KeyMap.SECONDTHIRDTELEPORT); + add(sector2TPKeySetter); + + row(); + + Label sector3TPKeyLabel = new Label("Right Teleport: ", skin); + sector3TPKeyLabel.setName(KeyMap.THIRDTHIRDTELEPORT); + add(sector3TPKeyLabel).left(); + KeySetter sector3TPKeySetter = new KeySetter(keyMap, KeyMap.THIRDTHIRDTELEPORT); + add(sector3TPKeySetter); + + addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + unselect(); + getStage().setKeyboardFocus(event.getTarget()); + event.getTarget().setColor(Color.ORANGE); + super.clicked(event, x, y); + } + }); + } + + public void unselect() { + Array keys = getChildren(); + for (int i = 0; i < keys.size; i++) { + keys.get(i).setColor(Color.WHITE);; + } + } + + @Override + public void act(float delta) { + super.act(delta); + } +} diff --git a/core/src/zero1hd/polyjet/ui/builders/SetResolutionButton.java b/core/src/zero1hd/polyjet/ui/builders/SetResolutionButton.java new file mode 100755 index 0000000..92dceca --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/builders/SetResolutionButton.java @@ -0,0 +1,27 @@ +package zero1hd.polyjet.ui.builders; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Preferences; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; + +public class SetResolutionButton extends TextButton { + + public SetResolutionButton(final int width, final int height, Skin skin, final Preferences prefs) { + super(width + "x" + height, skin); + + addListener(new ChangeListener() { + + @Override + public void changed(ChangeEvent event, Actor actor) { + Gdx.graphics.setWindowedMode(width, height); + prefs.putInteger("screen-width", width); + prefs.putInteger("screen-height", height); + prefs.putBoolean("fullscreen", false); + prefs.flush(); + } + }); + } +} diff --git a/core/src/zero1hd/polyjet/ui/stages/AnalysisResults.java b/core/src/zero1hd/polyjet/ui/stages/AnalysisResults.java new file mode 100755 index 0000000..731d74f --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/stages/AnalysisResults.java @@ -0,0 +1,65 @@ +package zero1hd.polyjet.ui.stages; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.actions.Actions; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; + +import zero1hd.polyjet.Polyjet; +import zero1hd.polyjet.maps.RhythmMap; + +public class AnalysisResults extends Stage { + Label DR; + Image circle1; + Image circle2; + Label proceed; + RhythmMap rhythmMap; + public boolean next; + + public AnalysisResults(Polyjet core, RhythmMap rhythmMap) { + this.rhythmMap = rhythmMap; + this.DR = new Label("Ready?", core.defaultSkin, "large-font", Color.WHITE); + this.DR.setPosition(Gdx.graphics.getWidth()/2 - this.DR.getWidth()/2, Gdx.graphics.getHeight()/2 - this.DR.getHeight()/2); + proceed = new Label("Waiting for user input...", core.defaultSkin, "small-font", Color.WHITE); + + proceed.setPosition((Gdx.graphics.getWidth()-proceed.getWidth())/2, Gdx.graphics.getHeight()-proceed.getHeight()-20); + proceed.addAction(Actions.forever(Actions.sequence(Actions.alpha(0.25f, 0.75f), Actions.alpha(1f, 0.75f)))); + + circle1 = new Image(core.assetManager.get("circle.png", Texture.class)); + circle1.setPosition(0, 0); + circle2 = new Image(core.assetManager.get("circle.png", Texture.class)); + circle2.setPosition(Gdx.graphics.getWidth()-circle2.getWidth(), Gdx.graphics.getHeight()-circle2.getHeight()); + addActor(circle1); + addActor(circle2); + addActor(this.DR); + addActor(proceed); + + addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + next = true; + super.clicked(event, x, y); + } + }); + + } + + @Override + public void act(float delta) { + super.act(delta); + + //TODO set text to data difficulty + } + + + @Override + public void draw() { + // TODO Auto-generated method stub + super.draw(); + } +} diff --git a/core/src/zero1hd/polyjet/ui/stages/CreativeStage.java b/core/src/zero1hd/polyjet/ui/stages/CreativeStage.java new file mode 100755 index 0000000..361c544 --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/stages/CreativeStage.java @@ -0,0 +1,219 @@ +package zero1hd.polyjet.ui.stages; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input.Keys; +import com.badlogic.gdx.scenes.scene2d.Actor; +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.CheckBox; +import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.ui.Window; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; + +import zero1hd.polyjet.Polyjet; +import zero1hd.polyjet.audio.AudioAnalyzer; +import zero1hd.polyjet.audio.WavAudioData; +import zero1hd.polyjet.ui.windows.BeatViewer; +import zero1hd.polyjet.ui.windows.FPSWindow; +import zero1hd.polyjet.ui.windows.GraphWindow; +import zero1hd.polyjet.ui.windows.MusicController; +import zero1hd.polyjet.ui.windows.MusicSelector; +import zero1hd.polyjet.ui.windows.VolumeWindow; + +public class CreativeStage extends Stage { + WavAudioData audioWrapper; + MusicController musicPlayBackControls; + MusicSelector musicSelector; + FPSWindow fpsViewer; + BeatViewer beatViewer; + GraphWindow graphViewer; + VolumeWindow volumeWindow; + + AudioAnalyzer analyzer; + Window toolbox; + Polyjet core; + boolean postAnalysisComplete; + + public CreativeStage(final Polyjet core) { + this.core = core; + analyzer = new AudioAnalyzer(); + audioWrapper = new WavAudioData(); + musicPlayBackControls = new MusicController(core.defaultSkin, audioWrapper); + musicSelector = new MusicSelector("Select Audio File", core.defaultSkin, core.prefs.getString("music dir"), "default", false); + musicSelector.setSize(400, 200); + musicSelector.postInit(); + musicSelector.refresh(); + fpsViewer = new FPSWindow("FPS", core.defaultSkin); + beatViewer = new BeatViewer("Beat", core.defaultSkin, core, analyzer); + graphViewer = new GraphWindow("Peak Values", core.defaultSkin); + volumeWindow = new VolumeWindow("Volume adjustments", core.defaultSkin, core.prefs); + + //Back button + TextButton backButton = new TextButton("Back", core.defaultSkin); + backButton.addListener(new ChangeListener() { + + @Override + public void changed(ChangeEvent event, Actor actor) { + dispose(); + core.setScreen(core.mainMenuScreen); + } + }); + backButton.setPosition(10, Gdx.graphics.getHeight()-backButton.getHeight()-10); + addActor(backButton); + + + toolbox = new Window("Tools", core.defaultSkin); + toolbox.defaults().pad(5f); + + Table toolboxToolSet = new Table(core.defaultSkin); + toolboxToolSet.defaults().space(5f); + + final CheckBox musicSelectorCheckbox = new CheckBox(" Music selector", core.defaultSkin); + musicSelectorCheckbox.addListener(new ChangeListener() { + + @Override + public void changed(ChangeEvent event, Actor actor) { + if (musicSelectorCheckbox.isChecked()) { + addActor(musicSelector); + } else { + musicSelector.remove(); + } + } + }); + toolboxToolSet.add(musicSelectorCheckbox); + toolboxToolSet.row(); + + final CheckBox musicPlayBackCheckbox = new CheckBox(" Playback controls", core.defaultSkin); + musicPlayBackCheckbox.addListener(new ChangeListener() { + + @Override + public void changed(ChangeEvent event, Actor actor) { + if (musicPlayBackCheckbox.isChecked()) { + addActor(musicPlayBackControls); + } else { + musicPlayBackControls.remove(); + } + } + }); + toolboxToolSet.add(musicPlayBackCheckbox); + toolboxToolSet.row(); + + final CheckBox beatViewerCheckbox = new CheckBox(" Beat viewer", core.defaultSkin); + beatViewerCheckbox.addListener(new ChangeListener() { + + @Override + public void changed(ChangeEvent event, Actor actor) { + if (beatViewerCheckbox.isChecked()) { + addActor(beatViewer); + } else { + beatViewer.remove(); + } + } + }); + toolboxToolSet.add(beatViewerCheckbox); + toolboxToolSet.row(); + + final CheckBox fpsViewerCheckbox = new CheckBox(" FPS", core.defaultSkin); + fpsViewerCheckbox.addListener(new ChangeListener() { + + @Override + public void changed(ChangeEvent event, Actor actor) { + if (fpsViewerCheckbox.isChecked()) { + addActor(fpsViewer); + } else { + fpsViewer.remove(); + } + } + }); + toolboxToolSet.add(fpsViewerCheckbox); + toolboxToolSet.row(); + + final CheckBox peakGraphCheckbox = new CheckBox(" Peak Graph", core.defaultSkin); + peakGraphCheckbox.addListener(new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + if (peakGraphCheckbox.isChecked()) { + addActor(graphViewer); + } else { + graphViewer.remove(); + } + + } + }); + toolboxToolSet.add(peakGraphCheckbox); + toolboxToolSet.row(); + + final CheckBox volumeMixerCheckbox = new CheckBox(" Volume", core.defaultSkin); + volumeMixerCheckbox.addListener(new ChangeListener() { + + @Override + public void changed(ChangeEvent event, Actor actor) { + if (volumeMixerCheckbox.isChecked()) { + addActor(volumeWindow); + } else { + volumeWindow.remove(); + } + } + }); + toolboxToolSet.add(volumeMixerCheckbox); + + ScrollPane scroller = new ScrollPane(toolboxToolSet, core.defaultSkin); + toolbox.add(scroller).prefWidth(205); + toolbox.setSize(210, 140); + addActor(toolbox); + + addListener(new InputListener() { + @Override + public boolean keyUp(InputEvent event, int keycode) { + if (keycode == Keys.ENTER || keycode == Keys.ESCAPE) { + setKeyboardFocus(null); + } + return super.keyUp(event, keycode); + } + }); + } + + @Override + public void act(float delta) { + if (musicSelector.isConfirmed()) { + audioWrapper.setAudioFile(musicSelector.getSelectedMusic()); + audioWrapper.getPlaybackMusic().setVolume(core.prefs.getFloat("music vol")/100f); + analyzer.resetVars(); + analyzer.startAnalyticalThread(audioWrapper); + musicPlayBackControls.setMusicReady(false); + beatViewer.setMusicReady(false); + graphViewer.setData(analyzer.getBassPeaks(), analyzer.getUMPeaks()); + postAnalysisComplete = false; + } + + if (!postAnalysisComplete && analyzer.containsData) { + postAnalysisComplete = true; + musicPlayBackControls.setMusicReady(true); + beatViewer.setMusicReady(true); + + } + + if (analyzer.audiofile != null) { + if (volumeWindow.isUpdateRequired()) { + analyzer.audiofile.getPlaybackMusic().setVolume(core.prefs.getFloat("music vol")/100f); + } + + analyzer.audiofile.readIndexUpdate(); + beatViewer.setSongIndex(analyzer.getReadIndex()); + graphViewer.getGraph().setAudioDataIndex(analyzer.getReadIndex()); + } + super.act(delta); + } + + @Override + public void dispose() { + analyzer.resetVars(); + analyzer.shrinkData(); + audioWrapper.reset(); + super.dispose(); + } + +} diff --git a/core/src/zero1hd/polyjet/ui/stages/GamePlayArea.java b/core/src/zero1hd/polyjet/ui/stages/GamePlayArea.java new file mode 100755 index 0000000..7db5e84 --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/stages/GamePlayArea.java @@ -0,0 +1,210 @@ +package zero1hd.polyjet.ui.stages; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.Pixmap; +import com.badlogic.gdx.graphics.Pixmap.Format; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.scenes.scene2d.Group; +import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.utils.Pool; +import com.badlogic.gdx.utils.Pools; +import com.badlogic.gdx.utils.viewport.FitViewport; + +import zero1hd.polyjet.Polyjet; +import zero1hd.polyjet.entity.BarBeat; +import zero1hd.polyjet.entity.PolyJetEntity; +import zero1hd.polyjet.entity.Projectile; +import zero1hd.polyjet.maps.KeyMap; +import zero1hd.polyjet.maps.RhythmMap; + + +public class GamePlayArea extends Stage { + public PolyJetEntity polyJet; + RhythmMap map; + + float timeCounter; + + //Required to know when to spawn entities on screen. + int audioIndex; + + private float health = 50; + private float maxHealth = 100; + private float yTeleport = Polyjet.GAME_AREA_HEIGHT/2; + private int score; + + private final Pool projectilePool = Pools.get(Projectile.class, 50); + private final Pool barBeatPool = Pools.get(BarBeat.class); + + Group projectile; + + Group foes; + + Texture basicLaserTexture; + public GamePlayArea(Polyjet core) { + super(new FitViewport(Polyjet.GAME_AREA_WIDTH, Polyjet.GAME_AREA_HEIGHT)); + + Pixmap basicLaser = new Pixmap(2, 32, Format.RGBA8888); + basicLaser.setColor(0f, 0.4f, 1f, 1f); + basicLaser.fill(); + + basicLaserTexture = new Texture(basicLaser); + basicLaser.dispose(); + + getCamera().far = 32f; + getCamera().near = 0f; + + Gdx.app.debug("Camera position (x,y,z)", getCamera().position.x + " " + getCamera().position.y + " " + getCamera().position.z); + getCamera().update(); + + polyJet = new PolyJetEntity(core, 54, "standard"); + addActor(polyJet); + + projectile = new Group(); + projectile.setName("basic Projectiles"); + addActor(projectile); + + foes = new Group(); + addActor(foes); + } + + public void init() { + health = 50; + maxHealth = 100; + } + @Override + public void act(float delta) { + timeCounter+=delta; + + for (int projectileID = 0; projectileID < projectile.getChildren().size; projectileID++) { + Projectile currentProjectile = (Projectile) projectile.getChildren().get(projectileID); + if (currentProjectile.getHitPoints() <= 0) { + currentProjectile.printDebug(); + currentProjectile.remove(); + projectilePool.free(currentProjectile); + } + } + + for (int barBeatID = 0; barBeatID < foes.getChildren().size; barBeatID++) { + BarBeat currentBarBeat = (BarBeat) foes.getChildren().get(barBeatID); + if (currentBarBeat.getHitPoints() <= 0) { + currentBarBeat.remove(); + barBeatPool.free(currentBarBeat); + } + } + + health -= 2*delta; + + if (health <= 0) { + health = 0; + } + + if (polyJet.getX() <= 1) { + polyJet.moveLeft = false; + polyJet.setX(1f); + } + + if (polyJet.getX() >= Polyjet.GAME_AREA_WIDTH-1-polyJet.getWidth()) { + polyJet.moveRight = false; + polyJet.setX(Polyjet.GAME_AREA_WIDTH-1f-polyJet.getWidth()); + } + + if (polyJet.getY() >= Polyjet.GAME_AREA_HEIGHT - 1 - polyJet.getHeight()) { + polyJet.moveUp = false; + polyJet.setY(Polyjet.GAME_AREA_HEIGHT - 1 - polyJet.getHeight()); + } + + if (polyJet.getY() <= 1) { + polyJet.moveDown = false; + polyJet.setY(1f); + } + super.act(delta); + } + + public void setAudioIndex(int audioIndex) { + this.audioIndex = audioIndex; + } + public void addScore (int score) { + this.score += score; + health += score; + if (health > maxHealth) { + health = maxHealth; + } + } + + public void spawnProjectile(int ID) { + switch (ID) { + case 0: + Projectile currentProjectile = projectilePool.obtain(); + currentProjectile.initiate( + polyJet.getX()+polyJet.getWidth()/2-(0.125f)/2, + polyJet.getY()+polyJet.getHeight()+0.5f, + 100, + 1, + basicLaserTexture, 0.125f, 2f); + projectile.addActor(currentProjectile); + + health -= 5; + break; + } + } + + + @Override + public boolean keyDown(int keycode) { + if (keycode == KeyMap.left) { + polyJet.moveLeft = true; + } + if (keycode == KeyMap.right) { + polyJet.moveRight = true; + } + + if (keycode == KeyMap.up) { + polyJet.moveUp = true; + } + + if (keycode == KeyMap.down) { + polyJet.moveDown = true; + } + return false; + } + + @Override + public boolean keyUp(int keycode) { + if (keycode == KeyMap.left) { + polyJet.moveLeft = false; + } + if (keycode == KeyMap.right) { + polyJet.moveRight = false; + } + if (keycode == KeyMap.up) { + polyJet.moveUp = false; + } + if (keycode == KeyMap.down) { + polyJet.moveDown = false; + } + if (keycode == KeyMap.shoot) { + spawnProjectile(0); + } + return false; + } + + public int getScore() { + return score; + } + + public float getHealth() { + return health; + } + + public float getMaxHealth() { + return maxHealth; + } + + public void setMap(RhythmMap map) { + this.map = map; + } + + public float getyTeleport() { + return yTeleport; + } +} diff --git a/core/src/zero1hd/polyjet/ui/windows/BeatViewer.java b/core/src/zero1hd/polyjet/ui/windows/BeatViewer.java new file mode 100755 index 0000000..3903a1d --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/windows/BeatViewer.java @@ -0,0 +1,112 @@ +package zero1hd.polyjet.ui.windows; + +import com.badlogic.gdx.graphics.Pixmap; +import com.badlogic.gdx.graphics.Pixmap.Format; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.scenes.scene2d.actions.Actions; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; +import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; +import com.badlogic.gdx.scenes.scene2d.ui.Window; + +import zero1hd.polyjet.Polyjet; +import zero1hd.polyjet.audio.AudioAnalyzer; + +public class BeatViewer extends Window { + Pixmap lights; + int songIndex; + boolean musicReady; + Texture lightOn; + + public BeatViewer(String title, Skin skin, Polyjet core, final AudioAnalyzer data) { + super(title, skin); + defaults().space(5f); + setSize(64, 100); + + + //Draw the 'lights' + lights = new Pixmap(16, 16, Format.RGBA8888); + lights.setColor(1, 0.2f, 0.2f, 1f); + lights.fillCircle(lights.getWidth()/2, lights.getHeight()/2, 7); + lightOn = new Texture(lights); + + + WidgetGroup bassBar = new WidgetGroup(); + final Image bgBassBar = new Image(core.defaultSkin.getPatch("bar-empty")); + bgBassBar.setHeight(50f); + bassBar.setSize(bgBassBar.getWidth(), bgBassBar.getHeight()); + + final Image bassBarFill = new Image(core.defaultSkin.getPatch("bar-fill")) { + @Override + public void act(float delta) { + if (musicReady && data.getBassPeaks().get(songIndex) >= 1f) { + clearActions(); + addAction(Actions.sequence(Actions.sizeTo(getWidth(), (data.getBassPeaks().get(songIndex)/data.getBassMaxValue())*bgBassBar.getHeight()), Actions.sizeTo(getWidth(), 0, 0.3f))); + } + super.act(delta); + } + }; + bassBarFill.setHeight(0f); + bassBar.addActor(bgBassBar); + bassBar.addActor(bassBarFill); + add(bassBar).minSize(bassBar.getWidth(), bassBar.getHeight()); + + WidgetGroup UMBar = new WidgetGroup(); + final Image bgUMBar = new Image(core.defaultSkin.getPatch("bar-empty")); + bgUMBar.setHeight(50f); + UMBar.setSize(bgUMBar.getWidth(), bgUMBar.getHeight()); + Image UMBarFill = new Image(core.defaultSkin.getPatch("bar-fill")) { + @Override + public void act(float delta) { + if (musicReady && data.getUMPeaks().get(songIndex) >= 1f) { + clearActions(); + addAction(Actions.sequence(Actions.sizeTo(getWidth(), (data.getUMPeaks().get(songIndex)/data.getUMMaxValue())*bgUMBar.getHeight()), Actions.sizeTo(getWidth(), 0f, 0.3f))); + } + super.act(delta); + } + }; + UMBarFill.setHeight(0f); + UMBar.addActor(bgUMBar); + UMBar.addActor(UMBarFill); + add(UMBar).minSize(UMBar.getWidth(), UMBar.getHeight()); + + + row(); + + Image bassIndicator = new Image(lightOn) { + @Override + public void act(float delta) { + if (musicReady && data.getBassPeaks().get(songIndex) >= 2) { + clearActions(); + addAction(Actions.sequence(Actions.alpha(1f), Actions.fadeOut(0.15f))); + } + super.act(delta); + } + }; + + bassIndicator.setColor(1f, 1f, 1f, 0f); + add(bassIndicator).center(); + + + Image UMIndicator = new Image(lightOn) { + @Override + public void act(float delta) { + if (musicReady && data.getUMPeaks().get(songIndex) >= 1) { + clearActions(); + addAction(Actions.sequence(Actions.alpha(1f), Actions.fadeOut(0.15f))); + } + super.act(delta); + } + }; + UMIndicator.setColor(1f, 1f, 1f, 0f); + add(UMIndicator).center(); + } + + public void setSongIndex(int songIndex) { + this.songIndex = songIndex; + } + + public void setMusicReady(boolean musicReady) { + this.musicReady = musicReady; + } +} diff --git a/core/src/zero1hd/polyjet/ui/windows/FPSWindow.java b/core/src/zero1hd/polyjet/ui/windows/FPSWindow.java new file mode 100755 index 0000000..30f834c --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/windows/FPSWindow.java @@ -0,0 +1,24 @@ +package zero1hd.polyjet.ui.windows; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; +import com.badlogic.gdx.scenes.scene2d.ui.Window; + +public class FPSWindow extends Window { + + public FPSWindow(String title, Skin skin) { + super(title, skin); + Label FPS = new Label("FPS: ", skin, "small-font", skin.getColor("default")) { + @Override + public void act(float delta) { + setText("FPS: " + Gdx.graphics.getFramesPerSecond()); + super.act(delta); + } + }; + + add(FPS).center(); + setSize(70, 70); + } + +} \ No newline at end of file diff --git a/core/src/zero1hd/polyjet/ui/windows/GraphWindow.java b/core/src/zero1hd/polyjet/ui/windows/GraphWindow.java new file mode 100755 index 0000000..02261e0 --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/windows/GraphWindow.java @@ -0,0 +1,32 @@ +package zero1hd.polyjet.ui.windows; + +import com.badlogic.gdx.scenes.scene2d.ui.Skin; +import com.badlogic.gdx.scenes.scene2d.ui.Window; +import com.badlogic.gdx.utils.FloatArray; + +import zero1hd.polyjet.ui.builders.AudioGraph; + +public class GraphWindow extends Window { + AudioGraph graph; + + public GraphWindow(String title, Skin skin) { + super(title, skin); + graph = new AudioGraph(300, 150); + add(graph); + setSize(305, 155); + } + + @Override + public void act(float delta) { + super.act(delta); + } + + public void setData(FloatArray dataSet1, FloatArray dataSet2) { + graph.setGraphingData(dataSet1, dataSet2); + } + + public AudioGraph getGraph() { + return graph; + } + +} diff --git a/core/src/zero1hd/polyjet/ui/windows/MusicController.java b/core/src/zero1hd/polyjet/ui/windows/MusicController.java new file mode 100755 index 0000000..1ca5a39 --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/windows/MusicController.java @@ -0,0 +1,136 @@ +package zero1hd.polyjet.ui.windows; + +import com.badlogic.gdx.Input.Keys; +import com.badlogic.gdx.math.MathUtils; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.InputListener; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; +import com.badlogic.gdx.scenes.scene2d.ui.TextField; +import com.badlogic.gdx.scenes.scene2d.ui.Window; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; + +import zero1hd.polyjet.audio.WavAudioData; + +public class MusicController extends Window { + boolean musicReady; + Skin skin; + private Image togglePlay; + private TextField info; + private WavAudioData audiofile; + + public MusicController(final Skin skin, final WavAudioData audiofile) { + super("Playback Controller", skin); + this.audiofile = audiofile; + + defaults().space(5f); + + this.skin = skin; + final ImageButton rewind = new ImageButton(skin.getDrawable("left-double-arrow")); + rewind.addListener(new ChangeListener() { + + @Override + public void changed(ChangeEvent event, Actor actor) { + if (audiofile.getPlaybackMusic() != null) { + audiofile.getPlaybackMusic().setPosition(audiofile.getPlaybackMusic().getPosition() - 2); + info.setText(String.valueOf(MathUtils.round(audiofile.getPlaybackMusic().getPosition())) + " sec"); + } + } + }); + + add(rewind).center(); + + togglePlay = new Image(skin.getDrawable("three-quart-circle")) { + @Override + public void act(float delta) { + if (audiofile.getPlaybackMusic() != null) { + if (audiofile.getPlaybackMusic().isPlaying()) { + setDrawable(skin.getDrawable("pause")); + } else if (!audiofile.getPlaybackMusic().isPlaying() && musicReady) { + setDrawable(skin.getDrawable("arrow")); + } + } + super.act(delta); + } + }; + togglePlay.addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + if (audiofile.getPlaybackMusic() != null) { + if (audiofile.getPlaybackMusic().isPlaying()) { + audiofile.getPlaybackMusic().pause(); + } else { + if (musicReady) { + audiofile.getPlaybackMusic().play(); + } + } + } + super.clicked(event, x, y); + } + }); + add(togglePlay).minWidth(togglePlay.getDrawable().getMinWidth()).center(); + + final ImageButton fastForward = new ImageButton(skin.getDrawable("right-double-arrow")); + fastForward.addListener(new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + if (audiofile.getPlaybackMusic() != null) { + audiofile.getPlaybackMusic().play(); + audiofile.getPlaybackMusic().setPosition(audiofile.getPlaybackMusic().getPosition() + 2); + info.setText(String.valueOf(MathUtils.round(audiofile.getPlaybackMusic().getPosition())) + " sec"); + } + } + }); + + add(fastForward); + + info = new TextField(null, skin) { + @Override + public void act(float delta) { + if (audiofile.getPlaybackMusic() != null && audiofile.getPlaybackMusic().isPlaying()) { + setText(String.valueOf(MathUtils.round(audiofile.getPlaybackMusic().getPosition())) + " sec"); + } + super.act(delta); + } + }; + add(info); + + + addListener(new InputListener() { + @Override + public boolean keyUp(InputEvent event, int keycode) { + if (keycode == Keys.ENTER) { + if (!info.getText().replaceAll("(?![0-9])\\S+", "").trim().isEmpty()) { + audiofile.getPlaybackMusic().setPosition(Float.valueOf(info.getText().replaceAll("(?![0-9])\\S+", "").trim())); + } + } + return super.keyUp(event, keycode); + } + }); + + + setSize(260, 75); + } + + public void setMusicReady(boolean musicReady) { + this.musicReady = musicReady; + if (!musicReady) { + togglePlay.setDrawable(skin.getDrawable("three-quart-circle")); + info.setText("Analyzing..."); + } else { + togglePlay.setDrawable(skin.getDrawable("arrow")); + info.setText("Ready."); + audiofile.getPlaybackMusic().play(); + audiofile.getPlaybackMusic().pause(); + } + } + + @Override + public void act(float delta) { + // TODO Auto-generated method stub + super.act(delta); + } +} diff --git a/core/src/zero1hd/polyjet/ui/windows/MusicSelector.java b/core/src/zero1hd/polyjet/ui/windows/MusicSelector.java new file mode 100755 index 0000000..ef16ebd --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/windows/MusicSelector.java @@ -0,0 +1,94 @@ +package zero1hd.polyjet.ui.windows; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.files.FileHandle; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.ui.List; +import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.ui.Window; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.badlogic.gdx.utils.Array; + +public class MusicSelector extends Window { + boolean confirmed; + boolean back; + FileHandle selectedMusic; + Array fileNames; + private List musicList; + private String path; + private ScrollPane listScroller; + public MusicSelector(String title, Skin skin, final String path, String listStyle, boolean containsBackButton) { + super(title, skin); + this.path = path; + padTop(25f); + padLeft(5f); + padRight(5f); + + setSize(Gdx.graphics.getWidth()*0.8f, Gdx.graphics.getHeight()*0.9f); + + fileNames = new Array<>(); + musicList = new List(skin, listStyle); + + if (containsBackButton) { + TextButton backButton = new TextButton("back", skin); + backButton.addListener(new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + back = true; + } + }); + add(backButton).left(); + } + + TextButton confirmButton = new TextButton("confirm", skin); + confirmButton.addListener(new ChangeListener() { + + @Override + public void changed(ChangeEvent event, Actor actor) { + confirmed = true; + selectedMusic = Gdx.files.absolute(path+System.getProperty("file.separator")+musicList.getSelected()); + } + }); + add(confirmButton).right(); + + row(); + + listScroller = new ScrollPane(musicList, skin); + listScroller.setScrollingDisabled(true, false); + } + + public void postInit() { + add(listScroller).colspan(2).expand().fill().prefWidth(getWidth()-5); + } + + public void refresh() { + fileNames.clear(); + FileHandle[] musicListArray = Gdx.files.absolute(path).list(); + for (int i = 0; i < musicListArray.length; i++) { + if (musicListArray[i].name().toLowerCase().endsWith(".wav")) { + fileNames.add(musicListArray[i].name()); + } + } + fileNames.sort(); + musicList.setItems(fileNames); + + } + + public boolean isConfirmed() { + boolean isConfirmed = confirmed; + confirmed = false; + return isConfirmed; + } + + public boolean isBack() { + boolean isBack = back; + back = false; + return isBack; + } + + public FileHandle getSelectedMusic() { + return selectedMusic; + } +} diff --git a/core/src/zero1hd/polyjet/ui/windows/Spawnables.java b/core/src/zero1hd/polyjet/ui/windows/Spawnables.java new file mode 100755 index 0000000..d41f4c4 --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/windows/Spawnables.java @@ -0,0 +1,21 @@ +package zero1hd.polyjet.ui.windows; + +import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.ui.Window; + +public class Spawnables extends Window { + + public Spawnables(String title, Skin skin) { + super(title, skin); + + Table spawnButtons = new Table(skin); + + ScrollPane entityListScroller = new ScrollPane(spawnButtons); + entityListScroller.setSize(180, 80); + add(entityListScroller); + setSize(185, 85); + } + +} diff --git a/core/src/zero1hd/polyjet/ui/windows/VolumeWindow.java b/core/src/zero1hd/polyjet/ui/windows/VolumeWindow.java new file mode 100755 index 0000000..15fc535 --- /dev/null +++ b/core/src/zero1hd/polyjet/ui/windows/VolumeWindow.java @@ -0,0 +1,71 @@ +package zero1hd.polyjet.ui.windows; + +import com.badlogic.gdx.Preferences; +import com.badlogic.gdx.math.MathUtils; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; +import com.badlogic.gdx.scenes.scene2d.ui.Slider; +import com.badlogic.gdx.scenes.scene2d.ui.Window; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; + +public class VolumeWindow extends Window { + + private Slider fxVolSlider; + private Slider musicVolSlider; + private Preferences prefs; + boolean updateRequired; + + public VolumeWindow(String title, Skin skin, Preferences prefs) { + super(title, skin); + this.prefs = prefs; + setSize(360f, 100f); + + Label musicVolSliderLabel = new Label("Music Volume: ", skin, "small-font", skin.getColor("default")); + add(musicVolSliderLabel).left().padLeft(5f); + musicVolSlider = new Slider(0, 100, 0.1f, false, skin); + musicVolSlider.setValue(prefs.getFloat("music vol", 100f)); + add(musicVolSlider).width(200f); + final Label musicVolPercentage = new Label(MathUtils.round(musicVolSlider.getValue()) + "%", skin, "small-font", skin.getColor("default")); + musicVolSlider.addListener(new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + save(); + musicVolPercentage.setText(MathUtils.round(musicVolSlider.getValue()) + "%"); + } + }); + + add(musicVolPercentage).spaceLeft(10f).expandX().left(); + + row(); + + Label fxVolSliderLabel = new Label("FX Volume: ", skin, "small-font", skin.getColor("default")); + add(fxVolSliderLabel).left().padLeft(5f); + fxVolSlider = new Slider(0, 100, 1, false, skin); + fxVolSlider.setValue(prefs.getFloat("fx vol", 100f)); + add(fxVolSlider).width(200f); + final Label fxVolPercentage = new Label(MathUtils.round(fxVolSlider.getValue()) + "%", skin, "small-font", skin.getColor("default")); + fxVolSlider.addListener(new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + save(); + fxVolPercentage.setText(MathUtils.round(fxVolSlider.getValue()) + "%"); + } + }); + + add(fxVolPercentage).spaceLeft(10f).expandX().left(); + } + + public void save() { + prefs.putFloat("music vol", musicVolSlider.getValue()); + prefs.putFloat("fx vol", fxVolSlider.getValue()); + updateRequired = true; + prefs.flush(); + } + + public boolean isUpdateRequired() { + boolean isUpdateRequired = updateRequired; + updateRequired = false; + return isUpdateRequired; + } +} diff --git a/core/src/zero1hd/wavedecoder/WavDecoder.java b/core/src/zero1hd/wavedecoder/WavDecoder.java new file mode 100755 index 0000000..f141ae1 --- /dev/null +++ b/core/src/zero1hd/wavedecoder/WavDecoder.java @@ -0,0 +1,115 @@ +package zero1hd.wavedecoder; + +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.security.InvalidParameterException; + +public class WavDecoder { + DataInputStream readStream; + private int channels; + private double sampleRate; + private int dataSize; + private int byteRate; + + public void setAudioFile(File file) throws InvalidParameterException { + try { + FileInputStream audioFile = new FileInputStream(file); + readStream = new DataInputStream(audioFile); + + if (!readBytesToString(4).equals("RIFF")) { + throw new InvalidParameterException("RIFF tag not found in header."); + } + dataSize = littleEndianIntBytes(); + + if (!readBytesToString(4).equals("WAVE")) { + throw new InvalidParameterException("WAVE format tag not found."); + } + + if (!readBytesToString(4).equals("fmt ")) { + throw new InvalidParameterException("fmt header not found."); + } + + if (readStream.readByte() != 16) { + throw new InvalidParameterException("Data not pcm?"); + } + + readStream.skipBytes(3); + if (readStream.readByte() != 1) { + throw new InvalidParameterException("Data not pcm?"); + } + readStream.skipBytes(1); + + channels = readStream.readByte(); + readStream.skipBytes(1); + + sampleRate = littleEndianIntBytes(); + + byteRate = littleEndianIntBytes(); + + readStream.skipBytes(38); + + if (!readBytesToString(4).equals("data")) { + throw new InvalidParameterException("initial data section tag not found"); + } + readStream.skipBytes(4); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private String readBytesToString(int bytesToRead) throws IOException { + byte byteString[] = new byte[bytesToRead]; + readStream.read(byteString); + return new String(byteString); + } + + private int littleEndianIntBytes() throws IOException { + int data = readStream.readInt(); + return Integer.reverseBytes(data); + } + + private short readLittleEndianShort() throws IOException { + short data = readStream.readShort(); + return Short.reverseBytes(data); + } + + public int getChannels() { + return channels; + } + + public double getSampleRate() { + return sampleRate; + } + + public int getByteRate() { + return byteRate; + } + + public int getDataSize() { + return dataSize; + } + + public int readSamples(float[] samples) { + int samplesRead = 0; + + for (int i = 0; i < samples.length; i++) { + try { + + int currentSample = 0; + for (int channel = 0; channel < channels; channel++) { + currentSample += readLittleEndianShort(); + } + currentSample /= channels*Short.MAX_VALUE+1; + samples[i] = currentSample; + samplesRead++; + } catch (IOException e) { + break; + } + } + + return samplesRead; + } + +} diff --git a/description b/description new file mode 100644 index 0000000..498b267 --- /dev/null +++ b/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/desktop/build.gradle b/desktop/build.gradle new file mode 100755 index 0000000..7d66a00 --- /dev/null +++ b/desktop/build.gradle @@ -0,0 +1,55 @@ +apply plugin: "java" + +sourceCompatibility = 1.6 +sourceSets.main.java.srcDirs = [ "src/" ] + +project.ext.mainClassName = "zero1hd.polyjet.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) { + from files(sourceSets.main.output.classesDir) + from files(sourceSets.main.output.resourcesDir) + from {configurations.compile.collect {zipTree(it)}} + from files(project.assetsDir); + + manifest { + attributes 'Main-Class': project.mainClassName + } +} + +dist.dependsOn classes + +eclipse { + project { + name = appName + "-desktop" + linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets' + } +} + +task afterEclipseImport(description: "Post processing after project generation", group: "IDE") { + doLast { + def classpath = new XmlParser().parse(file(".classpath")) + new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]); + def writer = new FileWriter(file(".classpath")) + def printer = new XmlNodePrinter(new PrintWriter(writer)) + printer.setPreserveWhitespace(true) + printer.print(classpath) + } +} diff --git a/desktop/src/zero1hd/polyjet/desktop/DesktopLauncher.java b/desktop/src/zero1hd/polyjet/desktop/DesktopLauncher.java new file mode 100755 index 0000000..5b6e035 --- /dev/null +++ b/desktop/src/zero1hd/polyjet/desktop/DesktopLauncher.java @@ -0,0 +1,21 @@ +package zero1hd.polyjet.desktop; + +import com.badlogic.gdx.backends.lwjgl.LwjglApplication; +import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; + +import zero1hd.polyjet.Polyjet; + +public class DesktopLauncher { + public static void main (String[] arg) { + LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); + config.title = "Polyjet"; + config.width = 800; + config.height = 480; + config.resizable = false; + System.setProperty("org.lwjgl.opengl.Window.undecorated", "true"); + + + new LwjglApplication(new Polyjet(), config); + + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100755 index 0000000..339fa15 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.daemon=true +org.gradle.jvmargs=-Xms128m -Xmx1500m +org.gradle.configureondemand=true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100755 index 0000000..b979729 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 100755 index 0000000..b902acb --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sat Sep 21 13:08:26 CEST 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..91a7e26 --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# 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 +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# 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\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +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" ] ; 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"` + + # 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 + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100755 index 0000000..aec9973 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@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 + +@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= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@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 Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_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=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +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/hooks/applypatch-msg.sample b/hooks/applypatch-msg.sample new file mode 100755 index 0000000..a5d7b84 --- /dev/null +++ b/hooks/applypatch-msg.sample @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +commitmsg="$(git rev-parse --git-path hooks/commit-msg)" +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} +: diff --git a/hooks/commit-msg.sample b/hooks/commit-msg.sample new file mode 100755 index 0000000..b58d118 --- /dev/null +++ b/hooks/commit-msg.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff --git a/hooks/post-update.sample b/hooks/post-update.sample new file mode 100755 index 0000000..ec17ec1 --- /dev/null +++ b/hooks/post-update.sample @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff --git a/hooks/pre-applypatch.sample b/hooks/pre-applypatch.sample new file mode 100755 index 0000000..4142082 --- /dev/null +++ b/hooks/pre-applypatch.sample @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +precommit="$(git rev-parse --git-path hooks/pre-commit)" +test -x "$precommit" && exec "$precommit" ${1+"$@"} +: diff --git a/hooks/pre-commit.sample b/hooks/pre-commit.sample new file mode 100755 index 0000000..68d62d5 --- /dev/null +++ b/hooks/pre-commit.sample @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff --git a/hooks/pre-push.sample b/hooks/pre-push.sample new file mode 100755 index 0000000..6187dbf --- /dev/null +++ b/hooks/pre-push.sample @@ -0,0 +1,53 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +while read local_ref local_sha remote_ref remote_sha +do + if [ "$local_sha" = $z40 ] + then + # Handle delete + : + else + if [ "$remote_sha" = $z40 ] + then + # New branch, examine all commits + range="$local_sha" + else + # Update to existing branch, examine new commits + range="$remote_sha..$local_sha" + fi + + # Check for WIP commit + commit=`git rev-list -n 1 --grep '^WIP' "$range"` + if [ -n "$commit" ] + then + echo >&2 "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff --git a/hooks/pre-rebase.sample b/hooks/pre-rebase.sample new file mode 100755 index 0000000..33730ca --- /dev/null +++ b/hooks/pre-rebase.sample @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up-to-date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff --git a/hooks/prepare-commit-msg.sample b/hooks/prepare-commit-msg.sample new file mode 100755 index 0000000..f093a02 --- /dev/null +++ b/hooks/prepare-commit-msg.sample @@ -0,0 +1,36 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first comments out the +# "Conflicts:" part of a merge commit. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +case "$2,$3" in + merge,) + /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; + +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$1" ;; + + *) ;; +esac + +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" diff --git a/hooks/update.sample b/hooks/update.sample new file mode 100755 index 0000000..80ba941 --- /dev/null +++ b/hooks/update.sample @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to block unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --bool hooks.allowunannotated) +allowdeletebranch=$(git config --bool hooks.allowdeletebranch) +denycreatebranch=$(git config --bool hooks.denycreatebranch) +allowdeletetag=$(git config --bool hooks.allowdeletetag) +allowmodifytag=$(git config --bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero="0000000000000000000000000000000000000000" +if [ "$newrev" = "$zero" ]; then + newrev_type=delete +else + newrev_type=$(git cat-file -t $newrev) +fi + +case "$refname","$newrev_type" in + refs/tags/*,commit) + # un-annotated tag + short_refname=${refname##refs/tags/} + if [ "$allowunannotated" != "true" ]; then + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 diff --git a/info/exclude b/info/exclude new file mode 100644 index 0000000..a5196d1 --- /dev/null +++ b/info/exclude @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/settings.gradle b/settings.gradle new file mode 100755 index 0000000..77ae463 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include 'desktop', 'android', 'core' \ No newline at end of file