Initial commit
@@ -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-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/
|
||||||
|
*.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/
|
||||||
|
|
||||||
|
/build/
|
||||||
|
/android/build/
|
||||||
|
/core/build/
|
||||||
|
/desktop/build/
|
||||||
|
/html/build/
|
||||||
|
/ios/build/
|
||||||
|
|
||||||
|
/nbbuild/
|
||||||
|
/android/nbbuild/
|
||||||
|
/core/nbbuild/
|
||||||
|
/desktop/nbbuild/
|
||||||
|
/html/nbbuild/
|
||||||
|
/ios/nbbuild/
|
||||||
|
|
||||||
|
/dist/
|
||||||
|
/android/dist/
|
||||||
|
/core/dist/
|
||||||
|
/desktop/dist/
|
||||||
|
/html/dist/
|
||||||
|
/ios/dist/
|
||||||
|
|
||||||
|
/nbdist/
|
||||||
|
/android/nbdist/
|
||||||
|
/core/nbdist/
|
||||||
|
/desktop/nbdist/
|
||||||
|
/html/nbdist/
|
||||||
|
/ios/nbdist/
|
||||||
|
|
||||||
|
nbactions.xml
|
||||||
|
nb-configuration.xml
|
||||||
|
|
||||||
|
## Gradle
|
||||||
|
|
||||||
|
/local.properties
|
||||||
|
.gradle/
|
||||||
|
gradle-app.setting
|
||||||
|
/build/
|
||||||
|
/android/build/
|
||||||
|
/core/build/
|
||||||
|
/desktop/build/
|
||||||
|
/html/build/
|
||||||
|
/ios/build/
|
||||||
|
|
||||||
|
## OS Specific
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
## iOS
|
||||||
|
/ios/xcode/*.xcodeproj/*
|
||||||
|
!/ios/xcode/*.xcodeproj/xcshareddata
|
||||||
|
!/ios/xcode/*.xcodeproj/project.pbxproj
|
||||||
|
/ios/xcode/native/
|
||||||
|
/ios/IOSLauncher.app
|
||||||
|
/ios/IOSLauncher.app.dSYM
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:fullBackupContent="true"
|
||||||
|
android:icon="@drawable/ic_launcher"
|
||||||
|
android:isGame="true"
|
||||||
|
android:appCategory="game"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:theme="@style/AppTheme"
|
||||||
|
tools:ignore="UnusedAttribute">
|
||||||
|
<activity
|
||||||
|
android:name="ru.samung.gamestudio.AndroidLauncher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:screenOrientation="landscape"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenSize|screenLayout"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
android {
|
||||||
|
namespace "ru.samung.itschool"
|
||||||
|
buildToolsVersion "33.0.2"
|
||||||
|
compileSdkVersion 32
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
manifest.srcFile 'AndroidManifest.xml'
|
||||||
|
java.srcDirs = ['src']
|
||||||
|
aidl.srcDirs = ['src']
|
||||||
|
renderscript.srcDirs = ['src']
|
||||||
|
res.srcDirs = ['res']
|
||||||
|
assets.srcDirs = ['../assets']
|
||||||
|
jniLibs.srcDirs = ['libs']
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
packagingOptions {
|
||||||
|
exclude 'META-INF/robovm/ios/robovm.xml'
|
||||||
|
}
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "ru.samung.itschool"
|
||||||
|
minSdkVersion 14
|
||||||
|
targetSdkVersion 32
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled true
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// called every time gradle gets executed, takes the native dependencies of
|
||||||
|
// the natives configuration, and extracts them to the proper libs/ folders
|
||||||
|
// so they get packed with the APK.
|
||||||
|
tasks.register('copyAndroidNatives') {
|
||||||
|
doFirst {
|
||||||
|
file("libs/armeabi-v7a/").mkdirs()
|
||||||
|
file("libs/arm64-v8a/").mkdirs()
|
||||||
|
file("libs/x86_64/").mkdirs()
|
||||||
|
file("libs/x86/").mkdirs()
|
||||||
|
|
||||||
|
configurations.natives.copy().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-x86_64.jar")) outputDir = file("libs/x86_64")
|
||||||
|
if (jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
|
||||||
|
if (outputDir != null) {
|
||||||
|
copy {
|
||||||
|
from zipTree(jar)
|
||||||
|
into outputDir
|
||||||
|
include "*.so"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.matching { it.name.contains("merge") && it.name.contains("JniLibFolders") }.configureEach { packageTask ->
|
||||||
|
packageTask.dependsOn 'copyAndroidNatives'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register('run', 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', 'ru.samung.itschool/ru.samung.itschool.AndroidLauncher'
|
||||||
|
}
|
||||||
|
|
||||||
|
eclipse.project.name = appName + "-android"
|
||||||
|
After Width: | Height: | Size: 22 KiB |
@@ -0,0 +1,38 @@
|
|||||||
|
# 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 com.badlogic.gdx.backends.android.AndroidFragmentApplication
|
||||||
|
|
||||||
|
# Required if using Gdx-Controllers extension
|
||||||
|
-keep class com.badlogic.gdx.controllers.android.AndroidControllers
|
||||||
|
|
||||||
|
# Required if using Box2D extension
|
||||||
|
-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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# This file is used by the Eclipse ADT plugin. It is unnecessary for IDEA and Android Studio projects, which
|
||||||
|
# configure Proguard and the Android target via the build.gradle file.
|
||||||
|
|
||||||
|
# To enable ProGuard to work with Eclipse ADT, uncomment this (available properties: sdk.dir, user.home)
|
||||||
|
# and ensure proguard.jar in the Android SDK is up to date (or alternately reduce the android target to 23 or lower):
|
||||||
|
# proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-rules.pro
|
||||||
|
|
||||||
|
# Project target.
|
||||||
|
target=android-19
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/ic_background_color"/>
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path
|
||||||
|
android:pathData="M22,48.667l2.987,0l0,10.667l-2.987,0z"
|
||||||
|
android:fillColor="#000000"
|
||||||
|
android:strokeColor="#00000000"
|
||||||
|
android:fillAlpha="1"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M26.907,52.72l2.987,0l0,6.613l-2.987,0z"
|
||||||
|
android:fillColor="#000000"
|
||||||
|
android:strokeColor="#00000000"
|
||||||
|
android:fillAlpha="1"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M26.907,48.667l2.987,0l0,2.56l-2.987,0z"
|
||||||
|
android:fillColor="#000000"
|
||||||
|
android:strokeColor="#00000000"
|
||||||
|
android:fillAlpha="1"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M31.813,48.667L31.813,52.72 31.813,55.067 31.813,56.767 31.813,59.333l2.992,0 2.117,0c1.654,0 2.998,-1.481 2.998,-3.307 0,-1.826 -1.344,-3.307 -2.998,-3.307l-2.117,0L34.805,48.667ZM34.805,55.067l1.269,0c0.469,0 0.848,0.384 0.848,0.853 0,0.469 -0.379,0.847 -0.848,0.847l-1.269,0z"
|
||||||
|
android:fillColor="#000000"
|
||||||
|
android:strokeColor="#00000000"
|
||||||
|
android:fillAlpha="1"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m44.192,48.667c-1.65,0 -2.992,1.481 -2.992,3.307 0,0.023 -0,0.044 0,0.067 0,0.004 -0,0.009 0,0.013l0,3.893c-0.001,0.027 0,0.053 0,0.08 0,1.826 1.341,3.307 2.992,3.307l2.112,0 0.247,0 2.739,0 0.247,0 2.112,0c1.651,0 2.992,-1.481 2.992,-3.307 0,-1.826 -1.341,-3.307 -2.992,-3.307l-1.199,0 -0.48,0 -2.372,0l0,2.347l2.372,0 0.48,0 0.353,0c0.468,0 0.846,0.384 0.846,0.853 0,0.469 -0.378,0.847 -0.846,0.847l-0.833,0 -0.433,0 -0.247,0 -2.739,0 -0.247,0 -0.433,0 -0.833,0c-0.459,0 -0.832,-0.363 -0.846,-0.82l0,-3.893 0,-0.013c0.021,-0.45 0.391,-0.807 0.846,-0.807l0.833,0 0.433,0 1.293,0l0,0.007L54.207,51.24L54.207,48.667l-4.917,0 -1.692,0 -1.293,0 -2.112,0z"
|
||||||
|
android:fillColor="#e74a45"
|
||||||
|
android:strokeColor="#00000000"
|
||||||
|
android:fillAlpha="1"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M56.133,48.667L56.133,51.238l5.406,0 1.859,0 1.105,0 0.43,0 0.827,0c0.452,0 0.82,0.356 0.84,0.806l0,0.013 0,3.891c-0.014,0.456 -0.384,0.819 -0.84,0.819l-0.827,0 -0.43,0 -1.899,0 -1.065,0 -2.442,0L59.098,52.724L56.133,52.724l0,4.044 0,1.752 0,0.813l5.406,0 1.065,0 1.899,0 2.098,0c1.639,0 2.971,-1.48 2.971,-3.305 0,-0.027 0.001,-0.053 0,-0.08L69.573,52.058c0,-0.004 -0,-0.009 0,-0.013 0,-0.022 0,-0.044 0,-0.067 0,-1.825 -1.332,-3.305 -2.971,-3.305l-2.098,0 -1.105,0l0,-0.007L56.133,48.667Z"
|
||||||
|
android:fillColor="#e74a45"
|
||||||
|
android:strokeColor="#00000000"
|
||||||
|
android:fillAlpha="1"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M69.572,48.667L73.72,48.667L77.787,52.733 81.853,48.667l4.147,0l-5.333,5.333 5.333,5.333L81.853,59.333L77.787,55.267 73.72,59.333l-4.147,0l5.333,-5.333z"
|
||||||
|
android:fillColor="#e74a45"
|
||||||
|
android:strokeColor="#00000000"/>
|
||||||
|
</vector>
|
||||||
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 19 KiB |
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar.Fullscreen">
|
||||||
|
<item name="android:colorBackground">@color/ic_background_color</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="ic_background_color">#FFFFFFFF</color>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<string name="app_name">FlappyBird</string>
|
||||||
|
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar.Fullscreen">
|
||||||
|
<item name="android:windowBackground">@color/ic_background_color</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package ru.samung.gamestudio;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.backends.android.AndroidApplication;
|
||||||
|
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
|
||||||
|
|
||||||
|
import ru.samsung.gamestudiovtim2026.MyGdxGame;
|
||||||
|
|
||||||
|
public class AndroidLauncher extends AndroidApplication {
|
||||||
|
@Override
|
||||||
|
protected void onCreate (Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
|
||||||
|
initialize(new MyGdxGame(), config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 67 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,98 @@
|
|||||||
|
{
|
||||||
|
"com.badlogic.gdx.graphics.g2d.BitmapFont": {
|
||||||
|
"default-font": {
|
||||||
|
"file": "default.fnt"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"com.badlogic.gdx.graphics.Color": {
|
||||||
|
"green": { "a": 1, "b": 0, "g": 1, "r": 0 },
|
||||||
|
"white": { "a": 1, "b": 1, "g": 1, "r": 1 },
|
||||||
|
"red": { "a": 1, "b": 0, "g": 0, "r": 1 },
|
||||||
|
"black": { "a": 1, "b": 0, "g": 0, "r": 0 },
|
||||||
|
"blue": { "a": 1, "b": 1, "g": 0.34, "r": 0.1 }
|
||||||
|
},
|
||||||
|
"com.badlogic.gdx.scenes.scene2d.ui.Skin$TintedDrawable": {
|
||||||
|
"dialogDim": { "name": "white", "color": { "r": 0, "g": 0, "b": 0, "a": 0.45 } }
|
||||||
|
},
|
||||||
|
"com.badlogic.gdx.scenes.scene2d.ui.Button$ButtonStyle": {
|
||||||
|
"default": {
|
||||||
|
"up": "default-round",
|
||||||
|
"down": "default-round-down",
|
||||||
|
"over": "default-round-over"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle": {
|
||||||
|
"default": {
|
||||||
|
"font": "default-font",
|
||||||
|
"fontColor": "white",
|
||||||
|
"downFontColor": "red",
|
||||||
|
"up": "default-round",
|
||||||
|
"down": "default-round-down",
|
||||||
|
"over": "default-round-over"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle": {
|
||||||
|
"default": {
|
||||||
|
"font": "default-font",
|
||||||
|
"fontColor": "white"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"com.badlogic.gdx.scenes.scene2d.ui.TextField$TextFieldStyle": {
|
||||||
|
"default": {
|
||||||
|
"font": "default-font",
|
||||||
|
"fontColor": "white",
|
||||||
|
"background": "textfield",
|
||||||
|
"cursor": "cursor",
|
||||||
|
"selection": "selection"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"com.badlogic.gdx.scenes.scene2d.ui.CheckBox$CheckBoxStyle": {
|
||||||
|
"default": {
|
||||||
|
"checkboxOn": "check-on",
|
||||||
|
"checkboxOff": "check-off",
|
||||||
|
"font": "default-font",
|
||||||
|
"fontColor": "white"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"com.badlogic.gdx.scenes.scene2d.ui.List$ListStyle": {
|
||||||
|
"default": {
|
||||||
|
"font": "default-font",
|
||||||
|
"fontColorSelected": "white",
|
||||||
|
"fontColorUnselected": "white",
|
||||||
|
"selection": "selection"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle": {
|
||||||
|
"default": {
|
||||||
|
"background": "default-scroll",
|
||||||
|
"hScrollKnob": "default-round-large",
|
||||||
|
"vScrollKnob": "default-round-large"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"com.badlogic.gdx.scenes.scene2d.ui.SelectBox$SelectBoxStyle": {
|
||||||
|
"default": {
|
||||||
|
"font": "default-font",
|
||||||
|
"fontColor": "white",
|
||||||
|
"background": "default-select",
|
||||||
|
"scrollStyle": "default",
|
||||||
|
"listStyle": "default"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"com.badlogic.gdx.scenes.scene2d.ui.SplitPane$SplitPaneStyle": {
|
||||||
|
"default-vertical": { "handle": "default-splitpane-vertical" },
|
||||||
|
"default-horizontal": { "handle": "default-splitpane" }
|
||||||
|
},
|
||||||
|
"com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle": {
|
||||||
|
"default": {
|
||||||
|
"background": "default-window",
|
||||||
|
"titleFont": "default-font",
|
||||||
|
"titleFontColor": "white"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"com.badlogic.gdx.scenes.scene2d.ui.Slider$SliderStyle": {
|
||||||
|
"default": {
|
||||||
|
"background": "default-slider",
|
||||||
|
"knob": "default-slider-knob"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
buildscript {
|
||||||
|
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||||
|
google()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:7.2.2'
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
apply plugin: "eclipse"
|
||||||
|
|
||||||
|
version = '1.0'
|
||||||
|
ext {
|
||||||
|
appName = "FlappyBird"
|
||||||
|
gdxVersion = '1.12.0'
|
||||||
|
roboVMVersion = '2.3.19'
|
||||||
|
box2DLightsVersion = '1.5'
|
||||||
|
ashleyVersion = '1.7.4'
|
||||||
|
aiVersion = '1.8.2'
|
||||||
|
gdxControllersVersion = '2.2.1'
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
google()
|
||||||
|
gradlePluginPortal()
|
||||||
|
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||||
|
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
|
||||||
|
maven { url "https://jitpack.io" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
project(":desktop") {
|
||||||
|
apply plugin: "java-library"
|
||||||
|
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation project(":core")
|
||||||
|
api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
|
||||||
|
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||||
|
api "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
project(":android") {
|
||||||
|
apply plugin: "com.android.application"
|
||||||
|
|
||||||
|
configurations { natives }
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation project(":core")
|
||||||
|
api "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
|
||||||
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
|
||||||
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
|
||||||
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
|
||||||
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
|
||||||
|
api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
|
||||||
|
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
|
||||||
|
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
|
||||||
|
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
|
||||||
|
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
project(":core") {
|
||||||
|
apply plugin: "java-library"
|
||||||
|
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
api "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||||
|
api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
sourceCompatibility = 1.8
|
||||||
|
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||||
|
|
||||||
|
sourceSets.main.java.srcDirs = [ "src/" ]
|
||||||
|
|
||||||
|
eclipse.project.name = appName + "-core"
|
||||||
@@ -0,0 +1,237 @@
|
|||||||
|
package ru.samsung.gamestudiovtim2026;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.Screen;
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
|
import com.badlogic.gdx.graphics.Pixmap;
|
||||||
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
|
public class GameScreen implements Screen {
|
||||||
|
private final MyGdxGame game;
|
||||||
|
private OrthographicCamera camera;
|
||||||
|
private SpriteBatch batch;
|
||||||
|
private BitmapFont font;
|
||||||
|
|
||||||
|
private Player player;
|
||||||
|
private Array<Obstacle> obstacles;
|
||||||
|
private float obstacleTimer;
|
||||||
|
private float gameTime;
|
||||||
|
private float distance;
|
||||||
|
private float gameSpeed;
|
||||||
|
|
||||||
|
private int score;
|
||||||
|
private int highScore;
|
||||||
|
|
||||||
|
private Texture lineTexture;
|
||||||
|
|
||||||
|
public GameScreen(MyGdxGame game) {
|
||||||
|
this.game = game;
|
||||||
|
this.batch = game.batch;
|
||||||
|
this.font = game.font;
|
||||||
|
|
||||||
|
camera = new OrthographicCamera();
|
||||||
|
camera.setToOrtho(false, 800, 480);
|
||||||
|
|
||||||
|
highScore = ScoreManager.loadHighScore();
|
||||||
|
lineTexture = createLineTexture();
|
||||||
|
|
||||||
|
restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Texture createLineTexture() {
|
||||||
|
Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
|
||||||
|
pixmap.setColor(Color.GRAY);
|
||||||
|
pixmap.fill();
|
||||||
|
Texture texture = new Texture(pixmap);
|
||||||
|
pixmap.dispose();
|
||||||
|
return texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restart() {
|
||||||
|
player = new Player();
|
||||||
|
obstacles = new Array<>();
|
||||||
|
obstacleTimer = 0;
|
||||||
|
gameTime = 0;
|
||||||
|
distance = 0;
|
||||||
|
gameSpeed = 200;
|
||||||
|
score = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(float delta) {
|
||||||
|
Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
|
||||||
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
update(delta);
|
||||||
|
|
||||||
|
camera.update();
|
||||||
|
batch.setProjectionMatrix(camera.combined);
|
||||||
|
batch.begin();
|
||||||
|
|
||||||
|
drawLines();
|
||||||
|
player.render(batch);
|
||||||
|
|
||||||
|
for (Obstacle obstacle : obstacles) {
|
||||||
|
if (obstacle.isVisible()) {
|
||||||
|
obstacle.render(batch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
drawUI();
|
||||||
|
|
||||||
|
batch.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void update(float delta) {
|
||||||
|
gameTime += delta;
|
||||||
|
distance += gameSpeed * delta;
|
||||||
|
|
||||||
|
player.update(delta);
|
||||||
|
handleInput();
|
||||||
|
generateObstacles(delta);
|
||||||
|
updateObstacles(delta);
|
||||||
|
checkCollisions();
|
||||||
|
|
||||||
|
// Плавное увеличение скорости со временем
|
||||||
|
gameSpeed += delta * 1.5f;
|
||||||
|
score = (int)(distance / 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleInput() {
|
||||||
|
if (Gdx.input.justTouched()) {
|
||||||
|
int touchY = Gdx.input.getY();
|
||||||
|
int screenHeight = Gdx.graphics.getHeight();
|
||||||
|
|
||||||
|
if (touchY < screenHeight / 3) {
|
||||||
|
player.moveUp();
|
||||||
|
} else if (touchY > 2 * screenHeight / 3) {
|
||||||
|
player.moveDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Gdx.input.isKeyJustPressed(com.badlogic.gdx.Input.Keys.UP) ||
|
||||||
|
Gdx.input.isKeyJustPressed(com.badlogic.gdx.Input.Keys.W)) {
|
||||||
|
player.moveUp();
|
||||||
|
}
|
||||||
|
if (Gdx.input.isKeyJustPressed(com.badlogic.gdx.Input.Keys.DOWN) ||
|
||||||
|
Gdx.input.isKeyJustPressed(com.badlogic.gdx.Input.Keys.S)) {
|
||||||
|
player.moveDown();
|
||||||
|
}
|
||||||
|
if (Gdx.input.isKeyJustPressed(com.badlogic.gdx.Input.Keys.SPACE)) {
|
||||||
|
player.jump();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Для тестирования на ПК - выход по ESC
|
||||||
|
if (Gdx.input.isKeyJustPressed(com.badlogic.gdx.Input.Keys.ESCAPE)) {
|
||||||
|
game.switchToMainMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generateObstacles(float delta) {
|
||||||
|
obstacleTimer += delta;
|
||||||
|
|
||||||
|
// Генерируем препятствия с интервалом (интервал уменьшается с увеличением скорости)
|
||||||
|
float spawnInterval = Math.max(0.8f, 2.0f - (gameSpeed / 500));
|
||||||
|
|
||||||
|
if (obstacleTimer > spawnInterval) {
|
||||||
|
obstacleTimer = 0;
|
||||||
|
|
||||||
|
int line = MathUtils.random(0, 2);
|
||||||
|
float spawnX = 800;
|
||||||
|
|
||||||
|
// Проверяем, чтобы препятствия не были слишком близко
|
||||||
|
boolean tooClose = false;
|
||||||
|
float minDistance = 150 + (gameSpeed / 10); // Минимальное расстояние увеличивается со скоростью
|
||||||
|
|
||||||
|
for (Obstacle obstacle : obstacles) {
|
||||||
|
if (obstacle.getLine() == line && obstacle.getBounds().x > 800 - minDistance) {
|
||||||
|
tooClose = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!tooClose) {
|
||||||
|
obstacles.add(new Obstacle(spawnX, line, gameSpeed * 1.2f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateObstacles(float delta) {
|
||||||
|
for (int i = obstacles.size - 1; i >= 0; i--) {
|
||||||
|
Obstacle obstacle = obstacles.get(i);
|
||||||
|
obstacle.update(delta);
|
||||||
|
|
||||||
|
if (!obstacle.isPassed() && obstacle.getBounds().x < player.getBounds().x) {
|
||||||
|
obstacle.setPassed(true);
|
||||||
|
score += 5; // Бонус за прохождение препятствия
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obstacle.isOffScreen()) {
|
||||||
|
obstacles.removeIndex(i);
|
||||||
|
obstacle.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkCollisions() {
|
||||||
|
for (Obstacle obstacle : obstacles) {
|
||||||
|
if (obstacle.isVisible() && obstacle.collidesWith(player.getBounds())) {
|
||||||
|
if (score > highScore) {
|
||||||
|
highScore = score;
|
||||||
|
ScoreManager.saveHighScore(highScore);
|
||||||
|
}
|
||||||
|
ScoreManager.saveLastScore(score);
|
||||||
|
game.switchToMainMenu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawLines() {
|
||||||
|
batch.setColor(Color.GRAY);
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
float y = 400 - i * 160;
|
||||||
|
batch.draw(lineTexture, 0, y, 800, 2);
|
||||||
|
}
|
||||||
|
batch.setColor(Color.WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawUI() {
|
||||||
|
font.setColor(Color.WHITE);
|
||||||
|
font.draw(batch, "Score: " + score, 20, 460);
|
||||||
|
font.draw(batch, "Best: " + highScore, 20, 440);
|
||||||
|
// Убрали Distance и Speed из отображения
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resize(int width, int height) {
|
||||||
|
camera.setToOrtho(false, 800, 480);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hide() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pause() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resume() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
player.dispose();
|
||||||
|
for (Obstacle obstacle : obstacles) {
|
||||||
|
obstacle.dispose();
|
||||||
|
}
|
||||||
|
lineTexture.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
package ru.samsung.gamestudiovtim2026;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.Screen;
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
|
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.ui.Label;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
|
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
||||||
|
|
||||||
|
public class MainMenuScreen implements Screen {
|
||||||
|
private final MyGdxGame game;
|
||||||
|
private Stage stage;
|
||||||
|
private Skin skin;
|
||||||
|
private OrthographicCamera camera;
|
||||||
|
private SpriteBatch batch;
|
||||||
|
private BitmapFont font;
|
||||||
|
|
||||||
|
private Label highScoreLabel;
|
||||||
|
private Label lastScoreLabel;
|
||||||
|
|
||||||
|
public MainMenuScreen(MyGdxGame game) {
|
||||||
|
this.game = game;
|
||||||
|
this.batch = game.batch;
|
||||||
|
this.font = game.font;
|
||||||
|
|
||||||
|
camera = new OrthographicCamera();
|
||||||
|
camera.setToOrtho(false, 800, 480);
|
||||||
|
|
||||||
|
stage = new Stage(new ScreenViewport());
|
||||||
|
Gdx.input.setInputProcessor(stage);
|
||||||
|
|
||||||
|
skin = new Skin();
|
||||||
|
skin.add("default-font", font);
|
||||||
|
|
||||||
|
com.badlogic.gdx.graphics.Pixmap pixmap = new com.badlogic.gdx.graphics.Pixmap(1, 1,
|
||||||
|
com.badlogic.gdx.graphics.Pixmap.Format.RGBA8888);
|
||||||
|
pixmap.setColor(Color.WHITE);
|
||||||
|
pixmap.fill();
|
||||||
|
skin.add("white", new com.badlogic.gdx.graphics.Texture(pixmap));
|
||||||
|
pixmap.dispose();
|
||||||
|
|
||||||
|
TextButton.TextButtonStyle buttonStyle = new TextButton.TextButtonStyle();
|
||||||
|
buttonStyle.font = font;
|
||||||
|
buttonStyle.fontColor = Color.WHITE;
|
||||||
|
buttonStyle.downFontColor = Color.RED;
|
||||||
|
buttonStyle.up = skin.newDrawable("white", Color.DARK_GRAY);
|
||||||
|
buttonStyle.down = skin.newDrawable("white", Color.GRAY);
|
||||||
|
buttonStyle.over = skin.newDrawable("white", Color.LIGHT_GRAY);
|
||||||
|
|
||||||
|
Label.LabelStyle labelStyle = new Label.LabelStyle();
|
||||||
|
labelStyle.font = font;
|
||||||
|
labelStyle.fontColor = Color.WHITE;
|
||||||
|
|
||||||
|
skin.add("default", buttonStyle);
|
||||||
|
skin.add("default", labelStyle);
|
||||||
|
|
||||||
|
createUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createUI() {
|
||||||
|
Table table = new Table();
|
||||||
|
table.setFillParent(true);
|
||||||
|
stage.addActor(table);
|
||||||
|
|
||||||
|
// Английский текст для избежания квадратиков
|
||||||
|
Label title = new Label("RUNNING SMILEY", skin);
|
||||||
|
title.setFontScale(1.5f); // Уменьшаем размер заголовка
|
||||||
|
|
||||||
|
TextButton playButton = new TextButton("PLAY", skin);
|
||||||
|
TextButton exitButton = new TextButton("EXIT", skin);
|
||||||
|
|
||||||
|
int highScore = ScoreManager.loadHighScore();
|
||||||
|
int lastScore = ScoreManager.loadLastScore();
|
||||||
|
|
||||||
|
highScoreLabel = new Label("BEST: " + highScore, skin);
|
||||||
|
lastScoreLabel = new Label("LAST: " + lastScore, skin);
|
||||||
|
|
||||||
|
playButton.addListener(new ClickListener() {
|
||||||
|
@Override
|
||||||
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
|
game.switchToGameScreen();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
exitButton.addListener(new ClickListener() {
|
||||||
|
@Override
|
||||||
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
|
Gdx.app.exit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
table.add(title).padBottom(40).row();
|
||||||
|
table.add(playButton).width(180).height(50).padBottom(15).row();
|
||||||
|
table.add(exitButton).width(180).height(50).padBottom(30).row();
|
||||||
|
table.add(highScoreLabel).padBottom(10).row();
|
||||||
|
table.add(lastScoreLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(float delta) {
|
||||||
|
Gdx.gl.glClearColor(0.1f, 0.1f, 0.2f, 1);
|
||||||
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
camera.update();
|
||||||
|
batch.setProjectionMatrix(camera.combined);
|
||||||
|
|
||||||
|
batch.begin();
|
||||||
|
// Можно добавить простой фон
|
||||||
|
batch.end();
|
||||||
|
|
||||||
|
stage.act(delta);
|
||||||
|
stage.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resize(int width, int height) {
|
||||||
|
stage.getViewport().update(width, height, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
highScoreLabel.setText("BEST: " + ScoreManager.loadHighScore());
|
||||||
|
lastScoreLabel.setText("LAST: " + ScoreManager.loadLastScore());
|
||||||
|
Gdx.input.setInputProcessor(stage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hide() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pause() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resume() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
stage.dispose();
|
||||||
|
skin.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package ru.samsung.gamestudiovtim2026;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Game;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
|
|
||||||
|
public class MyGdxGame extends Game {
|
||||||
|
public static final int SCR_WIDTH = 960;
|
||||||
|
public static final int SCR_HEIGHT = 960;
|
||||||
|
public SpriteBatch batch;
|
||||||
|
public BitmapFont font;
|
||||||
|
|
||||||
|
private GameScreen gameScreen;
|
||||||
|
private MainMenuScreen mainMenuScreen;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create() {
|
||||||
|
batch = new SpriteBatch();
|
||||||
|
|
||||||
|
// Создаем шрифт без FreeType
|
||||||
|
font = createSimpleFont();
|
||||||
|
|
||||||
|
mainMenuScreen = new MainMenuScreen(this);
|
||||||
|
gameScreen = new GameScreen(this);
|
||||||
|
|
||||||
|
setScreen(mainMenuScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
private BitmapFont createSimpleFont() {
|
||||||
|
try {
|
||||||
|
// Пробуем использовать стандартный шрифт, но уменьшим его размер
|
||||||
|
BitmapFont simpleFont = new BitmapFont();
|
||||||
|
simpleFont.getData().setScale(0.8f); // Уменьшаем размер шрифта
|
||||||
|
return simpleFont;
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Если что-то пошло не так, создаем минимальный шрифт
|
||||||
|
return new BitmapFont();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void switchToGameScreen() {
|
||||||
|
gameScreen.restart();
|
||||||
|
setScreen(gameScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void switchToMainMenu() {
|
||||||
|
setScreen(mainMenuScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render() {
|
||||||
|
super.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
batch.dispose();
|
||||||
|
font.dispose();
|
||||||
|
if (gameScreen != null) {
|
||||||
|
gameScreen.dispose();
|
||||||
|
}
|
||||||
|
if (mainMenuScreen != null) {
|
||||||
|
mainMenuScreen.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package ru.samsung.gamestudiovtim2026;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
|
|
||||||
|
public class Obstacle {
|
||||||
|
private Texture texture;
|
||||||
|
private Rectangle bounds;
|
||||||
|
private float speed;
|
||||||
|
private int line; // Линия, на которой находится препятствие
|
||||||
|
private boolean passed;
|
||||||
|
|
||||||
|
public Obstacle(float x, int line, float speed) {
|
||||||
|
texture = new Texture("spike_block.png");
|
||||||
|
this.line = line;
|
||||||
|
this.speed = speed;
|
||||||
|
this.passed = false;
|
||||||
|
|
||||||
|
float[] linePositions = {400, 240, 80};
|
||||||
|
bounds = new Rectangle(x, linePositions[line], 60, 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(float deltaTime) {
|
||||||
|
// Препятствия движутся справа налево
|
||||||
|
bounds.x -= speed * deltaTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(SpriteBatch batch) {
|
||||||
|
// Отрисовываем в мировых координатах
|
||||||
|
batch.draw(texture, bounds.x, bounds.y, bounds.width, bounds.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isOffScreen() {
|
||||||
|
// Препятствие ушло за левый край экрана
|
||||||
|
return bounds.x < -bounds.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVisible() {
|
||||||
|
// Препятствие видимо на экране (не вышло за левый край)
|
||||||
|
return bounds.x > -bounds.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean collidesWith(Rectangle playerBounds) {
|
||||||
|
return bounds.overlaps(playerBounds);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPassed() {
|
||||||
|
return passed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassed(boolean passed) {
|
||||||
|
this.passed = passed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
texture.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rectangle getBounds() {
|
||||||
|
return bounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLine() {
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package ru.samsung.gamestudiovtim2026;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
|
|
||||||
|
public class Player {
|
||||||
|
private Texture texture;
|
||||||
|
private Rectangle bounds;
|
||||||
|
private int currentLine; // 0 - верхняя, 1 - средняя, 2 - нижняя
|
||||||
|
private float[] linePositions = {400, 240, 80}; // Y-позиции линий
|
||||||
|
private boolean isJumping;
|
||||||
|
private float jumpTime;
|
||||||
|
|
||||||
|
public Player() {
|
||||||
|
texture = new Texture("smile.png");
|
||||||
|
// Игрок фиксирован по X (100px от левого края)
|
||||||
|
bounds = new Rectangle(100, linePositions[1], 60, 60);
|
||||||
|
currentLine = 1; // Начинаем со средней линии
|
||||||
|
isJumping = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(float deltaTime) {
|
||||||
|
// Игрок НЕ движется по X, только плавно перемещается по Y между линиями
|
||||||
|
|
||||||
|
// Плавное перемещение между линиями
|
||||||
|
float targetY = linePositions[currentLine];
|
||||||
|
if (Math.abs(bounds.y - targetY) > 1) {
|
||||||
|
bounds.y += (targetY - bounds.y) * 5 * deltaTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработка прыжка
|
||||||
|
if (isJumping) {
|
||||||
|
jumpTime += deltaTime;
|
||||||
|
if (jumpTime > 0.3f) { // Длительность прыжка
|
||||||
|
isJumping = false;
|
||||||
|
jumpTime = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void moveUp() {
|
||||||
|
if (currentLine > 0) {
|
||||||
|
currentLine--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void moveDown() {
|
||||||
|
if (currentLine < 2) {
|
||||||
|
currentLine++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void jump() {
|
||||||
|
if (!isJumping) {
|
||||||
|
isJumping = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(SpriteBatch batch) {
|
||||||
|
float drawY = bounds.y;
|
||||||
|
if (isJumping) {
|
||||||
|
drawY += 50 * (float)Math.sin(jumpTime * 10);
|
||||||
|
}
|
||||||
|
batch.draw(texture, bounds.x, drawY, bounds.width, bounds.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rectangle getBounds() {
|
||||||
|
return bounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurrentLine() {
|
||||||
|
return currentLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
texture.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package ru.samsung.gamestudiovtim2026;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.Preferences;
|
||||||
|
|
||||||
|
public class ScoreManager {
|
||||||
|
private static final String PREFS_NAME = "game_preferences";
|
||||||
|
private static final String HIGH_SCORE_KEY = "high_score";
|
||||||
|
private static final String LAST_SCORE_KEY = "last_score";
|
||||||
|
|
||||||
|
public static void saveHighScore(int score) {
|
||||||
|
Preferences prefs = Gdx.app.getPreferences(PREFS_NAME);
|
||||||
|
prefs.putInteger(HIGH_SCORE_KEY, score);
|
||||||
|
prefs.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int loadHighScore() {
|
||||||
|
Preferences prefs = Gdx.app.getPreferences(PREFS_NAME);
|
||||||
|
return prefs.getInteger(HIGH_SCORE_KEY, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveLastScore(int score) {
|
||||||
|
Preferences prefs = Gdx.app.getPreferences(PREFS_NAME);
|
||||||
|
prefs.putInteger(LAST_SCORE_KEY, score);
|
||||||
|
prefs.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int loadLastScore() {
|
||||||
|
Preferences prefs = Gdx.app.getPreferences(PREFS_NAME);
|
||||||
|
return prefs.getInteger(LAST_SCORE_KEY, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
sourceCompatibility = 1.8
|
||||||
|
sourceSets.main.java.srcDirs = [ "src/" ]
|
||||||
|
sourceSets.main.resources.srcDirs = ["../assets"]
|
||||||
|
|
||||||
|
project.ext.mainClassName = "ru.samung.itschool.DesktopLauncher"
|
||||||
|
project.ext.assetsDir = new File("../assets")
|
||||||
|
|
||||||
|
import org.gradle.internal.os.OperatingSystem
|
||||||
|
|
||||||
|
tasks.register('run', JavaExec) {
|
||||||
|
dependsOn classes
|
||||||
|
mainClass = project.mainClassName
|
||||||
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
|
standardInput = System.in
|
||||||
|
workingDir = project.assetsDir
|
||||||
|
ignoreExitValue = true
|
||||||
|
|
||||||
|
if (OperatingSystem.current() == OperatingSystem.MAC_OS) {
|
||||||
|
// Required to run on macOS
|
||||||
|
jvmArgs += "-XstartOnFirstThread"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register('debug', JavaExec) {
|
||||||
|
dependsOn classes
|
||||||
|
mainClass = project.mainClassName
|
||||||
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
|
standardInput = System.in
|
||||||
|
workingDir = project.assetsDir
|
||||||
|
ignoreExitValue = true
|
||||||
|
debug = true
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register('dist', Jar) {
|
||||||
|
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
||||||
|
manifest {
|
||||||
|
attributes 'Main-Class': project.mainClassName
|
||||||
|
}
|
||||||
|
dependsOn configurations.runtimeClasspath
|
||||||
|
from {
|
||||||
|
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
|
||||||
|
}
|
||||||
|
with jar
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dist.dependsOn classes
|
||||||
|
|
||||||
|
eclipse.project.name = appName + "-desktop"
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package ru.samung.gamestudio;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
|
||||||
|
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
|
||||||
|
|
||||||
|
import ru.samsung.gamestudiovtim2026.MyGdxGame;
|
||||||
|
|
||||||
|
// Please note that on macOS your application needs to be started with the -XstartOnFirstThread JVM argument
|
||||||
|
public class DesktopLauncher {
|
||||||
|
public static void main (String[] arg) {
|
||||||
|
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
|
||||||
|
|
||||||
|
config.setForegroundFPS(60);
|
||||||
|
config.setWindowedMode(MyGdxGame.SCR_WIDTH,MyGdxGame.SCR_HEIGHT);
|
||||||
|
config.setTitle("GeometrySprint4");
|
||||||
|
new Lwjgl3Application(new MyGdxGame(), config);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
org.gradle.daemon=true
|
||||||
|
org.gradle.jvmargs=-Xms128m -Xmx1500m
|
||||||
|
org.gradle.configureondemand=false
|
||||||
|
android.useAndroidX=true
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#Mon Nov 10 16:43:10 NOVT 2025
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
@@ -0,0 +1,240 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$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" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%"=="" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
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 execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
: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 %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
include 'desktop', 'android', 'core'
|
||||||