initial files
No files matched your search
@@ -0,0 +1,15 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
@@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
@@ -0,0 +1,123 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<JetCodeStyleSettings>
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</JetCodeStyleSettings>
|
||||
<codeStyleSettings language="XML">
|
||||
<option name="FORCE_REARRANGE_MODE" value="1" />
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
</indentOptions>
|
||||
<arrangement>
|
||||
<rules>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:android</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:id</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:name</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>name</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>style</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>ANDROID_ATTRIBUTE_ORDER</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
</rules>
|
||||
</arrangement>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="kotlin">
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
||||
@@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="$USER_HOME$/.android/avd/6.7_Horizontal_Fold-in_API_30.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2022-05-23T01:30:50.296221Z" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,23 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewMultipleParameterProviders" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DesignSurface">
|
||||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="../../../../layout/compose-model-1653085351752.xml" value="0.375" />
|
||||
<entry key="../../../../layout/compose-model-1653085541745.xml" value="2.0" />
|
||||
<entry key="../../../../layout/compose-model-1653085956106.xml" value="0.33" />
|
||||
<entry key="../../../../layout/compose-model-1653125149886.xml" value="0.33" />
|
||||
<entry key="../../../../layout/compose-model-1653260606908.xml" value="0.2690033783783784" />
|
||||
<entry key="../../../../layout/compose-model-1653262716326.xml" value="0.25" />
|
||||
<entry key="../../../../layout/compose-model-1653262789080.xml" value="0.33" />
|
||||
<entry key="app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.304" />
|
||||
<entry key="app/src/main/res/drawable/ic_launcher_background.xml" value="0.304" />
|
||||
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.3525" />
|
||||
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.3525" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="EntryPointsManager">
|
||||
<list size="1">
|
||||
<item index="0" class="java.lang.String" itemvalue="android.annotation.SuppressLint" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,12 @@
|
||||
# Geode Android Launcher
|
||||
|
||||
Launches a vanilla copy of Geometry Dash with the Geode loader added.
|
||||
|
||||
## TODO:
|
||||
|
||||
* Implement remaining Java methods (text editing)
|
||||
* Figure out better way of packaging libgeode
|
||||
* Fix android_asset references in FMOD
|
||||
* Back button support
|
||||
* (seems to be a focus issue? pressing a key on keyboard allows for the back button to be used)
|
||||
* Fix icon in launcher
|
||||
@@ -0,0 +1 @@
|
||||
/build
|
||||
@@ -0,0 +1,65 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk 32
|
||||
|
||||
defaultConfig {
|
||||
applicationId "dev.xyze.geodelauncher"
|
||||
minSdk 23
|
||||
targetSdk 32
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
useSupportLibrary true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
buildFeatures {
|
||||
compose true
|
||||
}
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion compose_version
|
||||
}
|
||||
packagingOptions {
|
||||
resources {
|
||||
excludes += '/META-INF/{AL2.0,LGPL2.1}'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.7.0'
|
||||
implementation "androidx.compose.ui:ui:$compose_version"
|
||||
implementation 'androidx.compose.material3:material3:1.0.0-alpha12'
|
||||
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
|
||||
implementation 'androidx.activity:activity-compose:1.4.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||
implementation 'com.google.android.material:material:1.6.0'
|
||||
implementation files('../libs/fmod.jar')
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
|
||||
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
|
||||
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# 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 *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="dev.xyze.geodelauncher">
|
||||
|
||||
<queries>
|
||||
<package android:name="com.robtopx.geometryjump" />
|
||||
</queries>
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.wifi"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00020000"
|
||||
android:required="true" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:theme="@style/Theme.Geodelauncher"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".GeometryDashActivity"
|
||||
android:exported="false"
|
||||
android:hardwareAccelerated="true"
|
||||
android:screenOrientation="landscape"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:windowSoftInputMode="stateAlwaysHidden">
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="cocos2dcpp" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:theme="@style/Theme.Geodelauncher">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
After Width: | Height: | Size: 50 KiB |
@@ -0,0 +1,112 @@
|
||||
package com.customRobTop
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.net.ConnectivityManager
|
||||
import android.net.NetworkCapabilities
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
import java.util.*
|
||||
|
||||
|
||||
@Suppress("unused", "UNUSED_PARAMETER")
|
||||
open class BaseRobTopActivity : DefaultRobTopActivity() {
|
||||
companion object {
|
||||
private var isLoaded_ = false
|
||||
lateinit var me: Activity
|
||||
var blockBackButton_ = false
|
||||
private var keyboardActive_ = false
|
||||
|
||||
fun setCurrentActivity(currentActivity: Activity) {
|
||||
me = currentActivity
|
||||
}
|
||||
|
||||
@SuppressLint("HardwareIds")
|
||||
@JvmStatic
|
||||
fun getUserID(): String {
|
||||
// this is how RobTop does it in 2.2, based on the meltdown leaks
|
||||
val androidId = Settings.Secure.getString(me.contentResolver, Settings.Secure.ANDROID_ID)
|
||||
return if ("9774d56d682e549c" != androidId) {
|
||||
UUID.nameUUIDFromBytes(androidId.toByteArray()).toString()
|
||||
} else return UUID.randomUUID().toString()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isNetworkAvailable(): Boolean {
|
||||
val connectivityManager = me.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||
|
||||
val activeNetwork = connectivityManager.activeNetwork
|
||||
val networkCapabilities = connectivityManager.getNetworkCapabilities(activeNetwork) ?: return false
|
||||
|
||||
if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun setKeyboardState(value: Boolean) {
|
||||
keyboardActive_ = value
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun setBlockBackButton(value: Boolean) {
|
||||
blockBackButton_ = value
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun loadingFinished() {
|
||||
isLoaded_ = true
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun gameServicesIsSignedIn(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
// everyplay doesn't even exist anymore lol
|
||||
@JvmStatic
|
||||
fun isEveryplaySupported(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isRecordingSupported(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun stopRecording() { }
|
||||
|
||||
@JvmStatic
|
||||
fun unlockAchievement(id: String) {}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
me = this
|
||||
|
||||
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
|
||||
|
||||
hideSystemUi()
|
||||
}
|
||||
|
||||
private fun hideSystemUi() {
|
||||
val windowInsetsController =
|
||||
ViewCompat.getWindowInsetsController(window.decorView) ?: return
|
||||
|
||||
windowInsetsController.systemBarsBehavior =
|
||||
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
windowInsetsController.hide(WindowInsetsCompat.Type.systemBars())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.customRobTop
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
|
||||
open class DefaultRobTopActivity : Activity() {
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.customRobTop
|
||||
|
||||
object JniToCpp {
|
||||
@JvmStatic
|
||||
external fun didCacheInterstitial(str: String?)
|
||||
|
||||
@JvmStatic
|
||||
external fun didClickInterstitial()
|
||||
|
||||
@JvmStatic
|
||||
external fun didCloseInterstitial()
|
||||
|
||||
@JvmStatic
|
||||
external fun didDismissInterstitial()
|
||||
|
||||
@JvmStatic
|
||||
external fun everyplayRecordingStopped()
|
||||
|
||||
@JvmStatic
|
||||
external fun googlePlaySignedIn()
|
||||
|
||||
@JvmStatic
|
||||
external fun hideLoadingCircle()
|
||||
|
||||
@JvmStatic
|
||||
external fun itemPurchased(str: String)
|
||||
|
||||
@JvmStatic
|
||||
external fun itemRefunded(str: String)
|
||||
|
||||
@JvmStatic
|
||||
external fun promoImageDownloaded()
|
||||
|
||||
@JvmStatic
|
||||
external fun resumeSound()
|
||||
|
||||
@JvmStatic
|
||||
external fun rewardedVideoAdFinished(i: Int)
|
||||
|
||||
@JvmStatic
|
||||
external fun rewardedVideoAdHidden()
|
||||
|
||||
@JvmStatic
|
||||
external fun setupHSSAssets(str: String?, str2: String?)
|
||||
|
||||
@JvmStatic
|
||||
external fun showInterstitialFailed()
|
||||
|
||||
@JvmStatic
|
||||
external fun userDidAttemptToRateApp()
|
||||
|
||||
@JvmStatic
|
||||
external fun videoAdHidden()
|
||||
|
||||
@JvmStatic
|
||||
external fun videoAdShowed()
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.robtopx.geometryjump
|
||||
|
||||
object GJConstants {
|
||||
const val PACKAGE_NAME = "com.robtopx.geometryjump"
|
||||
|
||||
const val COCOS_LIB_NAME = "cocos2dcpp"
|
||||
const val FMOD_LIB_NAME = "fmod"
|
||||
const val MOD_CORE_LIB_NAME = "geode"
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.robtopx.geometryjump
|
||||
|
||||
import dalvik.system.BaseDexClassLoader
|
||||
import java.io.File
|
||||
|
||||
object LaunchUtils {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun addDirectoryToClassPath(directory: String, classLoader: ClassLoader) {
|
||||
// uses code from zhuowei/MCPELauncher
|
||||
try {
|
||||
val clazz = classLoader.javaClass
|
||||
val plField = clazz.superclass.getDeclaredField("pathList")
|
||||
plField.isAccessible = true
|
||||
|
||||
val pathListInst = plField.get(classLoader)
|
||||
val pathListClazz = pathListInst.javaClass
|
||||
val nldField = pathListClazz.getDeclaredField("nativeLibraryDirectories")
|
||||
nldField.isAccessible = true
|
||||
|
||||
val pathList = nldField.get(pathListInst)
|
||||
|
||||
println(pathList)
|
||||
|
||||
if (pathList is ArrayList<*>) {
|
||||
// no safe way to check this type afaik, so casting is needed
|
||||
(pathList as ArrayList<File>).add(
|
||||
File(directory)
|
||||
)
|
||||
}
|
||||
|
||||
if (classLoader is BaseDexClassLoader && classLoader.findLibrary(GJConstants.COCOS_LIB_NAME) == null) {
|
||||
val anpMethod = pathListClazz.getDeclaredMethod("addNativePath", Collection::class.java)
|
||||
|
||||
anpMethod.invoke(
|
||||
pathListInst,
|
||||
listOf(directory)
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package dev.xyze.geodelauncher
|
||||
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import android.util.Log
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.material3.SnackbarHost
|
||||
import androidx.compose.material3.SnackbarHostState
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
import com.customRobTop.BaseRobTopActivity
|
||||
import com.customRobTop.JniToCpp
|
||||
import com.robtopx.geometryjump.GJConstants
|
||||
import com.robtopx.geometryjump.LaunchUtils
|
||||
import dev.xyze.geodelauncher.ui.theme.GeodeLauncherTheme
|
||||
import org.cocos2dx.lib.Cocos2dxGLSurfaceView
|
||||
import org.cocos2dx.lib.Cocos2dxHelper
|
||||
import org.cocos2dx.lib.Cocos2dxRenderer
|
||||
import org.fmod.FMOD
|
||||
|
||||
class GeometryDashActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
setupUIState()
|
||||
|
||||
val gdPackageInfo = packageManager.getPackageInfo(GJConstants.PACKAGE_NAME, 0)
|
||||
val gdNativeLibraryPath = "${gdPackageInfo.applicationInfo.nativeLibraryDir}/"
|
||||
|
||||
LaunchUtils.addDirectoryToClassPath(gdNativeLibraryPath, classLoader)
|
||||
|
||||
System.loadLibrary(GJConstants.FMOD_LIB_NAME)
|
||||
System.loadLibrary(GJConstants.COCOS_LIB_NAME)
|
||||
|
||||
val loadSuccess = try {
|
||||
System.loadLibrary(GJConstants.MOD_CORE_LIB_NAME)
|
||||
true
|
||||
} catch (e: UnsatisfiedLinkError) {
|
||||
false
|
||||
}
|
||||
|
||||
FMOD.init(this)
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
setContent {
|
||||
val snackbarHostState = remember { SnackbarHostState() }
|
||||
|
||||
GeodeLauncherTheme {
|
||||
AndroidView(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
factory = {
|
||||
Cocos2dxGLSurfaceView(this).apply {
|
||||
setEGLConfigChooser(5, 6, 5, 0, 16, 8)
|
||||
initView()
|
||||
setCocos2dxRenderer(Cocos2dxRenderer())
|
||||
}
|
||||
}
|
||||
)
|
||||
SnackbarHost(
|
||||
hostState = snackbarHostState,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
|
||||
if (!loadSuccess) {
|
||||
LaunchedEffect(snackbarHostState) {
|
||||
snackbarHostState.showSnackbar("Failed to load mod core.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JniToCpp.setupHSSAssets(
|
||||
applicationInfo.sourceDir,
|
||||
Environment.getExternalStorageDirectory().absolutePath
|
||||
)
|
||||
Cocos2dxHelper.nativeSetApkPath(gdPackageInfo.applicationInfo.sourceDir)
|
||||
|
||||
BaseRobTopActivity.setCurrentActivity(this)
|
||||
}
|
||||
|
||||
private fun setupUIState() {
|
||||
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
|
||||
|
||||
hideSystemUi()
|
||||
}
|
||||
|
||||
private fun hideSystemUi() {
|
||||
val windowInsetsController =
|
||||
ViewCompat.getWindowInsetsController(window.decorView) ?: return
|
||||
|
||||
windowInsetsController.systemBarsBehavior =
|
||||
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
windowInsetsController.hide(WindowInsetsCompat.Type.systemBars())
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
FMOD.close()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package dev.xyze.geodelauncher
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.PlayArrow
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.robtopx.geometryjump.GJConstants
|
||||
import dev.xyze.geodelauncher.ui.theme.GeodeLauncherTheme
|
||||
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val gdInstalled = isGeometryDashInstalled(packageManager)
|
||||
|
||||
setContent {
|
||||
GeodeLauncherTheme {
|
||||
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
|
||||
MainScreen(gdInstalled)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun onLaunch(context: Context) {
|
||||
val launchIntent = Intent(context, GeometryDashActivity::class.java)
|
||||
launchIntent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
|
||||
context.startActivity(launchIntent)
|
||||
}
|
||||
|
||||
fun onSettings(context: Context) {
|
||||
Toast.makeText(context, "Settings are not implemented yet!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
fun isGeometryDashInstalled(packageManager: PackageManager): Boolean {
|
||||
return try {
|
||||
packageManager.getPackageInfo(GJConstants.PACKAGE_NAME, 0)
|
||||
true
|
||||
} catch (e: PackageManager.NameNotFoundException) {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun MainScreen(gdInstalled: Boolean = true) {
|
||||
val context = LocalContext.current
|
||||
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.geode_logo),
|
||||
contentDescription = "Geode Logo",
|
||||
modifier = Modifier.size(136.dp, 136.dp)
|
||||
)
|
||||
Text(
|
||||
"Geode",
|
||||
fontSize = 32.sp,
|
||||
modifier = Modifier.padding(12.dp)
|
||||
)
|
||||
if (gdInstalled) {
|
||||
Row {
|
||||
Button(onClick = { onLaunch(context) }, enabled = gdInstalled) {
|
||||
Icon(
|
||||
Icons.Filled.PlayArrow,
|
||||
contentDescription = "Play Icon"
|
||||
)
|
||||
Spacer(Modifier.size(ButtonDefaults.IconSpacing))
|
||||
Text("Launch")
|
||||
}
|
||||
IconButton(onClick = { onSettings(context) }) {
|
||||
Icon(
|
||||
Icons.Filled.Settings,
|
||||
contentDescription = "Settings Icon"
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Text(
|
||||
"Geometry Dash cannot be found.",
|
||||
modifier = Modifier.padding(12.dp)
|
||||
)
|
||||
Button(onClick = { onSettings(context) }) {
|
||||
Icon(
|
||||
Icons.Filled.Settings,
|
||||
contentDescription = "Settings Icon"
|
||||
)
|
||||
Spacer(Modifier.size(ButtonDefaults.IconSpacing))
|
||||
Text("Settings")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showSystemUi = true)
|
||||
@Composable
|
||||
fun MainScreenLightPreview() {
|
||||
GeodeLauncherTheme {
|
||||
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
|
||||
MainScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Preview(showSystemUi = true)
|
||||
@Composable
|
||||
fun MainScreenDarkPreview() {
|
||||
GeodeLauncherTheme(darkTheme = true) {
|
||||
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
|
||||
MainScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun MainScreenNoGeometryDashPreview() {
|
||||
GeodeLauncherTheme {
|
||||
MainScreen(gdInstalled = false)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package dev.xyze.geodelauncher.ui.theme
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
val Purple80 = Color(0xFFD0BCFF)
|
||||
val PurpleGrey80 = Color(0xFFCCC2DC)
|
||||
val Pink80 = Color(0xFFEFB8C8)
|
||||
|
||||
val Purple40 = Color(0xFF6650a4)
|
||||
val PurpleGrey40 = Color(0xFF625b71)
|
||||
val Pink40 = Color(0xFF7D5260)
|
||||
@@ -0,0 +1,75 @@
|
||||
package dev.xyze.geodelauncher.ui.theme
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.Build
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.material3.dynamicDarkColorScheme
|
||||
import androidx.compose.material3.dynamicLightColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.SideEffect
|
||||
import androidx.compose.ui.graphics.toArgb
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import androidx.core.view.ViewCompat
|
||||
|
||||
private val DarkColorScheme = darkColorScheme(
|
||||
primary = Purple80,
|
||||
secondary = PurpleGrey80,
|
||||
tertiary = Pink80
|
||||
)
|
||||
|
||||
private val LightColorScheme = lightColorScheme(
|
||||
primary = Purple40,
|
||||
secondary = PurpleGrey40,
|
||||
tertiary = Pink40
|
||||
|
||||
/* Other default colors to override
|
||||
background = Color(0xFFFFFBFE),
|
||||
surface = Color(0xFFFFFBFE),
|
||||
onPrimary = Color.White,
|
||||
onSecondary = Color.White,
|
||||
onTertiary = Color.White,
|
||||
onBackground = Color(0xFF1C1B1F),
|
||||
onSurface = Color(0xFF1C1B1F),
|
||||
*/
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun GeodeLauncherTheme(
|
||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||
// Dynamic color is available on Android 12+
|
||||
dynamicColor: Boolean = true,
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
val colorScheme = when {
|
||||
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
|
||||
val context = LocalContext.current
|
||||
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
|
||||
}
|
||||
darkTheme -> DarkColorScheme
|
||||
else -> LightColorScheme
|
||||
}
|
||||
|
||||
val view = LocalView.current
|
||||
if (!view.isInEditMode) {
|
||||
SideEffect {
|
||||
with ((view.context as Activity).window) {
|
||||
statusBarColor = colorScheme.background.toArgb()
|
||||
navigationBarColor = colorScheme.background.toArgb()
|
||||
}
|
||||
with (ViewCompat.getWindowInsetsController(view)) {
|
||||
this?.isAppearanceLightStatusBars = !darkTheme
|
||||
this?.isAppearanceLightNavigationBars = !darkTheme
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MaterialTheme(
|
||||
colorScheme = colorScheme,
|
||||
typography = Typography,
|
||||
content = content
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package dev.xyze.geodelauncher.ui.theme
|
||||
|
||||
import androidx.compose.material3.Typography
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
// Set of Material typography styles to start with
|
||||
val Typography = Typography(
|
||||
bodyLarge = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.5.sp
|
||||
)
|
||||
/* Other default text styles to override
|
||||
titleLarge = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 22.sp,
|
||||
lineHeight = 28.sp,
|
||||
letterSpacing = 0.sp
|
||||
),
|
||||
labelSmall = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 11.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.5.sp
|
||||
)
|
||||
*/
|
||||
)
|
||||
@@ -0,0 +1,116 @@
|
||||
package org.cocos2dx.lib
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import com.customRobTop.BaseRobTopActivity
|
||||
|
||||
|
||||
open class Cocos2dxActivity : BaseRobTopActivity(), Cocos2dxHelper.Cocos2dxHelperListener {
|
||||
private val sTag = Cocos2dxActivity::class.java.simpleName
|
||||
private lateinit var mGLSurfaceView: Cocos2dxGLSurfaceView
|
||||
private var hasWindowFocus = false
|
||||
private var mIsOnPause = false
|
||||
private var mIsRunning = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
init()
|
||||
Cocos2dxHelper.init(this, this)
|
||||
}
|
||||
|
||||
private fun resumeGame() {
|
||||
this.mIsRunning = true
|
||||
mGLSurfaceView.onResume()
|
||||
}
|
||||
|
||||
private fun pauseGame() {
|
||||
this.mIsRunning = false
|
||||
mGLSurfaceView.onPause()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
this.mIsOnPause = false
|
||||
if (this.hasWindowFocus && !this.mIsRunning) {
|
||||
resumeGame()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
this.mIsOnPause = true
|
||||
if (this.mIsRunning) {
|
||||
pauseGame()
|
||||
}
|
||||
}
|
||||
|
||||
override fun showDialog(pTitle: String, pMessage: String) {
|
||||
/*
|
||||
val msg = Message()
|
||||
msg.what = 1
|
||||
msg.obj = DialogMessage(pTitle, pMessage)
|
||||
this.mHandler.sendMessage(msg)
|
||||
*/
|
||||
}
|
||||
|
||||
override fun showEditTextDialog(
|
||||
pTitle: String,
|
||||
pMessage: String,
|
||||
pInputMode: Int,
|
||||
pInputFlag: Int,
|
||||
pReturnType: Int,
|
||||
pMaxLength: Int
|
||||
) {
|
||||
/*
|
||||
val msg = Message()
|
||||
msg.what = 2
|
||||
msg.obj = EditBoxMessage(pTitle, pContent, pInputMode, pInputFlag, pReturnType, pMaxLength)
|
||||
this.mHandler.sendMessage(msg)
|
||||
*/
|
||||
}
|
||||
|
||||
override fun runOnGLThread(pRunnable: Runnable) {
|
||||
mGLSurfaceView.queueEvent(pRunnable)
|
||||
}
|
||||
|
||||
private fun init() {
|
||||
val frameLayoutParams = ViewGroup.LayoutParams(-1, -1)
|
||||
val frameLayout = FrameLayout(this)
|
||||
frameLayout.layoutParams = frameLayoutParams
|
||||
// val edittextLayoutParams = ViewGroup.LayoutParams(-1, -2)
|
||||
// val edittext = Cocos2dxEditText(this)
|
||||
// edittext.setLayoutParams(edittextLayoutParams)
|
||||
// frameLayout.addView(edittext)
|
||||
this.mGLSurfaceView = onCreateView()
|
||||
frameLayout.addView(this.mGLSurfaceView)
|
||||
if (isAndroidEmulator()) {
|
||||
this.mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0)
|
||||
}
|
||||
this.mGLSurfaceView.setCocos2dxRenderer(Cocos2dxRenderer())
|
||||
// edittext.setInputType(145)
|
||||
// this.mGLSurfaceView.setCocos2dxEditText(edittext)
|
||||
setContentView(frameLayout)
|
||||
}
|
||||
|
||||
|
||||
open fun onCreateView(): Cocos2dxGLSurfaceView {
|
||||
val glSurfaceView = Cocos2dxGLSurfaceView(this)
|
||||
glSurfaceView.initView()
|
||||
return glSurfaceView
|
||||
}
|
||||
|
||||
private fun isAndroidEmulator(): Boolean {
|
||||
Log.d(sTag, "model=" + Build.MODEL)
|
||||
val product = Build.PRODUCT
|
||||
Log.d(sTag, "product=$product")
|
||||
var isEmulator = false
|
||||
if (product != null) {
|
||||
isEmulator = product == "sdk" || product.contains("_sdk") || product.contains("sdk_")
|
||||
}
|
||||
Log.d(sTag, "isEmulator=$isEmulator")
|
||||
return isEmulator
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,395 @@
|
||||
package org.cocos2dx.lib
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.*
|
||||
import android.graphics.Paint.FontMetricsInt
|
||||
import android.text.TextPaint
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.MotionEvent
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
import java.util.*
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.ceil
|
||||
|
||||
@Suppress("unused")
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object Cocos2dxBitmap {
|
||||
private lateinit var sContext: Context
|
||||
private external fun nativeInitBitmapDC(i: Int, i2: Int, bArr: ByteArray)
|
||||
fun setContext(pContext: Context) {
|
||||
sContext = pContext
|
||||
}
|
||||
|
||||
fun createTextBitmap(
|
||||
pString: String,
|
||||
pFontName: String,
|
||||
pFontSize: Int,
|
||||
pAlignment: Int,
|
||||
pWidth: Int,
|
||||
pHeight: Int
|
||||
) {
|
||||
createTextBitmapShadowStroke(
|
||||
pString,
|
||||
pFontName,
|
||||
pFontSize,
|
||||
1.0f,
|
||||
1.0f,
|
||||
1.0f,
|
||||
pAlignment,
|
||||
pWidth,
|
||||
pHeight,
|
||||
false,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
false,
|
||||
1.0f,
|
||||
1.0f,
|
||||
1.0f,
|
||||
1.0f
|
||||
)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun createTextBitmapShadowStroke(
|
||||
pString: String,
|
||||
pFontName: String,
|
||||
pFontSize: Int,
|
||||
fontTintR: Float,
|
||||
fontTintG: Float,
|
||||
fontTintB: Float,
|
||||
pAlignment: Int,
|
||||
pWidth: Int,
|
||||
pHeight: Int,
|
||||
shadow: Boolean,
|
||||
shadowDX: Float,
|
||||
shadowDY: Float,
|
||||
shadowBlur: Float,
|
||||
stroke: Boolean,
|
||||
strokeR: Float,
|
||||
strokeG: Float,
|
||||
strokeB: Float,
|
||||
strokeSize: Float
|
||||
) {
|
||||
val bitmapTotalHeight: Int
|
||||
val horizontalAlignment = pAlignment and 15
|
||||
val verticalAlignment = pAlignment shr 4 and 15
|
||||
val pString2 = refactorString(pString)
|
||||
val paint = newPaint(pFontName, pFontSize, horizontalAlignment)
|
||||
paint.setARGB(
|
||||
MotionEvent.ACTION_MASK,
|
||||
(255.0 * fontTintR.toDouble()).toInt(),
|
||||
(255.0 * fontTintG.toDouble()).toInt(),
|
||||
(255.0 * fontTintB.toDouble()).toInt()
|
||||
)
|
||||
val textProperty = computeTextProperty(pString2, pWidth, pHeight, paint)
|
||||
bitmapTotalHeight = if (pHeight == 0) {
|
||||
textProperty.mTotalHeight
|
||||
} else {
|
||||
pHeight
|
||||
}
|
||||
var bitmapPaddingX = 0.0f
|
||||
var bitmapPaddingY = 0.0f
|
||||
var renderTextDeltaX = 0.0f
|
||||
var renderTextDeltaY = 0.0f
|
||||
if (shadow) {
|
||||
paint.setShadowLayer(shadowBlur, shadowDX, shadowDY, -8553091)
|
||||
bitmapPaddingX = abs(shadowDX)
|
||||
bitmapPaddingY = abs(shadowDY)
|
||||
if (shadowDX.toDouble() < 0.0) {
|
||||
renderTextDeltaX = bitmapPaddingX
|
||||
}
|
||||
if (shadowDY.toDouble() < 0.0) {
|
||||
renderTextDeltaY = bitmapPaddingY
|
||||
}
|
||||
}
|
||||
val bitmap = Bitmap.createBitmap(
|
||||
textProperty.mMaxWidth + bitmapPaddingX.toInt(),
|
||||
bitmapPaddingY.toInt() + bitmapTotalHeight,
|
||||
Bitmap.Config.ARGB_8888
|
||||
)
|
||||
val canvas = Canvas(bitmap)
|
||||
val fontMetricsInt = paint.fontMetricsInt
|
||||
var y = computeY(fontMetricsInt, pHeight, textProperty.mTotalHeight, verticalAlignment)
|
||||
val lines = textProperty.mLines
|
||||
val length = lines.size
|
||||
for (i in 0 until length) {
|
||||
val line = lines[i]
|
||||
canvas.drawText(
|
||||
line!!,
|
||||
computeX(
|
||||
line,
|
||||
textProperty.mMaxWidth,
|
||||
horizontalAlignment
|
||||
).toFloat() + renderTextDeltaX,
|
||||
y.toFloat() + renderTextDeltaY,
|
||||
paint
|
||||
)
|
||||
y += textProperty.mHeightPerLine
|
||||
}
|
||||
if (stroke) {
|
||||
val paintStroke = newPaint(pFontName, pFontSize, horizontalAlignment)
|
||||
paintStroke.style = Paint.Style.STROKE
|
||||
paintStroke.strokeWidth = 0.5f * strokeSize
|
||||
paintStroke.setARGB(
|
||||
MotionEvent.ACTION_MASK,
|
||||
strokeR.toInt() * MotionEvent.ACTION_MASK,
|
||||
strokeG.toInt() * MotionEvent.ACTION_MASK,
|
||||
strokeB.toInt() * MotionEvent.ACTION_MASK
|
||||
)
|
||||
var y2 = computeY(fontMetricsInt, pHeight, textProperty.mTotalHeight, verticalAlignment)
|
||||
val lines2 = textProperty.mLines
|
||||
val length2 = lines2.size
|
||||
for (i2 in 0 until length2) {
|
||||
val line2 = lines2[i2]
|
||||
canvas.drawText(
|
||||
line2!!,
|
||||
computeX(
|
||||
line2,
|
||||
textProperty.mMaxWidth,
|
||||
horizontalAlignment
|
||||
).toFloat() + renderTextDeltaX,
|
||||
y2.toFloat() + renderTextDeltaY,
|
||||
paintStroke
|
||||
)
|
||||
y2 += textProperty.mHeightPerLine
|
||||
}
|
||||
}
|
||||
initNativeObject(bitmap)
|
||||
}
|
||||
|
||||
private fun newPaint(pFontName: String, pFontSize: Int, pHorizontalAlignment: Int): Paint {
|
||||
val paint = Paint()
|
||||
paint.color = -1
|
||||
paint.textSize = pFontSize.toFloat()
|
||||
paint.isAntiAlias = true
|
||||
if (pFontName.endsWith(".ttf")) {
|
||||
try {
|
||||
paint.typeface = Cocos2dxTypefaces[sContext, pFontName]
|
||||
} catch (e: Exception) {
|
||||
Log.e("Cocos2dxBitmap", "error to create ttf type face: $pFontName")
|
||||
paint.typeface = Typeface.create(pFontName, Typeface.NORMAL)
|
||||
}
|
||||
} else {
|
||||
paint.typeface = Typeface.create(pFontName, Typeface.NORMAL)
|
||||
}
|
||||
when (pHorizontalAlignment) {
|
||||
2 -> paint.textAlign = Paint.Align.RIGHT
|
||||
3 -> paint.textAlign = Paint.Align.CENTER
|
||||
else -> paint.textAlign = Paint.Align.LEFT
|
||||
}
|
||||
return paint
|
||||
}
|
||||
|
||||
private fun computeTextProperty(
|
||||
pString: String,
|
||||
pWidth: Int,
|
||||
pHeight: Int,
|
||||
pPaint: Paint
|
||||
): TextProperty {
|
||||
val fm = pPaint.fontMetricsInt
|
||||
val h = ceil((fm.bottom - fm.top).toDouble()).toInt()
|
||||
var maxContentWidth = 0
|
||||
val lines = splitString(pString, pWidth, pHeight, pPaint)
|
||||
if (pWidth != 0) {
|
||||
maxContentWidth = pWidth
|
||||
} else {
|
||||
for (line in lines) {
|
||||
val temp = ceil(pPaint.measureText(line, 0, line!!.length).toDouble()).toInt()
|
||||
if (temp > maxContentWidth) {
|
||||
maxContentWidth = temp
|
||||
}
|
||||
}
|
||||
}
|
||||
return TextProperty(maxContentWidth, h, lines)
|
||||
}
|
||||
|
||||
private fun computeX(@Suppress("UNUSED_PARAMETER") pText: String?, pMaxWidth: Int, pHorizontalAlignment: Int): Int {
|
||||
return when (pHorizontalAlignment) {
|
||||
2 -> pMaxWidth
|
||||
3 -> pMaxWidth / 2
|
||||
else -> 0
|
||||
}
|
||||
}
|
||||
|
||||
private fun computeY(
|
||||
pFontMetricsInt: FontMetricsInt,
|
||||
pConstrainHeight: Int,
|
||||
pTotalHeight: Int,
|
||||
pVerticalAlignment: Int
|
||||
): Int {
|
||||
val y = -pFontMetricsInt.top
|
||||
return if (pConstrainHeight <= pTotalHeight) {
|
||||
y
|
||||
} else when (pVerticalAlignment) {
|
||||
1 -> -pFontMetricsInt.top
|
||||
2 -> -pFontMetricsInt.top + (pConstrainHeight - pTotalHeight)
|
||||
3 -> -pFontMetricsInt.top + (pConstrainHeight - pTotalHeight) / 2
|
||||
else -> y
|
||||
}
|
||||
}
|
||||
|
||||
private fun splitString(
|
||||
pString: String,
|
||||
pMaxWidth: Int,
|
||||
pMaxHeight: Int,
|
||||
pPaint: Paint
|
||||
): Array<String?> {
|
||||
val lines: Array<String?> = pString.split("\\n").toTypedArray()
|
||||
val fm = pPaint.fontMetricsInt
|
||||
val maxLines = pMaxHeight / ceil((fm.bottom - fm.top).toDouble()).toInt()
|
||||
return if (pMaxWidth != 0) {
|
||||
val strList = LinkedList<String?>()
|
||||
for (line in lines) {
|
||||
if (ceil(pPaint.measureText(line).toDouble()).toInt() > pMaxWidth) {
|
||||
strList.addAll(divideStringWithMaxWidth(line, pMaxWidth, pPaint))
|
||||
} else {
|
||||
strList.add(line)
|
||||
}
|
||||
if (maxLines > 0 && strList.size >= maxLines) {
|
||||
break
|
||||
}
|
||||
}
|
||||
if (maxLines > 0 && strList.size > maxLines) {
|
||||
while (strList.size > maxLines) {
|
||||
strList.removeLast()
|
||||
}
|
||||
}
|
||||
val ret = arrayOfNulls<String>(strList.size)
|
||||
strList.toArray(ret)
|
||||
ret
|
||||
} else if (pMaxHeight == 0 || lines.size <= maxLines) {
|
||||
lines
|
||||
} else {
|
||||
val strList2 = LinkedList<String?>()
|
||||
for (i in 0 until maxLines) {
|
||||
strList2.add(lines[i])
|
||||
}
|
||||
val ret2 = arrayOfNulls<String>(strList2.size)
|
||||
strList2.toArray(ret2)
|
||||
ret2
|
||||
}
|
||||
}
|
||||
|
||||
private fun divideStringWithMaxWidth(
|
||||
pString: String?,
|
||||
pMaxWidth: Int,
|
||||
pPaint: Paint
|
||||
): LinkedList<String?> {
|
||||
val charLength = pString!!.length
|
||||
var start = 0
|
||||
val strList = LinkedList<String?>()
|
||||
var i = 1
|
||||
while (i <= charLength) {
|
||||
val tempWidth = ceil(pPaint.measureText(pString, start, i).toDouble()).toInt()
|
||||
if (tempWidth >= pMaxWidth) {
|
||||
val lastIndexOfSpace = pString.substring(0, i).lastIndexOf(" ")
|
||||
if (lastIndexOfSpace != -1 && lastIndexOfSpace > start) {
|
||||
strList.add(pString.substring(start, lastIndexOfSpace))
|
||||
i = lastIndexOfSpace + 1
|
||||
} else if (tempWidth > pMaxWidth) {
|
||||
strList.add(pString.substring(start, i - 1))
|
||||
i--
|
||||
} else {
|
||||
strList.add(pString.substring(start, i))
|
||||
}
|
||||
while (i < charLength && pString[i] == ' ') {
|
||||
i++
|
||||
}
|
||||
start = i
|
||||
}
|
||||
i++
|
||||
}
|
||||
if (start < charLength) {
|
||||
strList.add(pString.substring(start))
|
||||
}
|
||||
return strList
|
||||
}
|
||||
|
||||
private fun refactorString(pString: String): String {
|
||||
if (pString.compareTo("") == 0) {
|
||||
return " "
|
||||
}
|
||||
val strBuilder = StringBuilder(pString)
|
||||
var start = 0
|
||||
var index = strBuilder.indexOf("\n")
|
||||
while (index != -1) {
|
||||
start = if (index == 0 || strBuilder[index - 1].code == 10) {
|
||||
strBuilder.insert(start, " ")
|
||||
index + 2
|
||||
} else {
|
||||
index + 1
|
||||
}
|
||||
if (start > strBuilder.length || index == strBuilder.length) {
|
||||
break
|
||||
}
|
||||
index = strBuilder.indexOf("\n", start)
|
||||
}
|
||||
return strBuilder.toString()
|
||||
}
|
||||
|
||||
private fun initNativeObject(pBitmap: Bitmap) {
|
||||
val pixels = getPixels(pBitmap)
|
||||
if (pixels != null) {
|
||||
nativeInitBitmapDC(pBitmap.width, pBitmap.height, pixels)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getPixels(pBitmap: Bitmap?): ByteArray? {
|
||||
if (pBitmap == null) {
|
||||
return null
|
||||
}
|
||||
val pixels = ByteArray(pBitmap.width * pBitmap.height * 4)
|
||||
val buf = ByteBuffer.wrap(pixels)
|
||||
buf.order(ByteOrder.nativeOrder())
|
||||
pBitmap.copyPixelsToBuffer(buf)
|
||||
return pixels
|
||||
}
|
||||
|
||||
private fun getFontSizeAccordingHeight(height: Int): Int {
|
||||
val paint = Paint()
|
||||
val bounds = Rect()
|
||||
paint.typeface = Typeface.DEFAULT
|
||||
var incrTextSize = 1
|
||||
var foundDesiredSize = false
|
||||
while (!foundDesiredSize) {
|
||||
paint.textSize = incrTextSize.toFloat()
|
||||
paint.getTextBounds("SghMNy", 0, "SghMNy".length, bounds)
|
||||
incrTextSize++
|
||||
if (height - bounds.height() <= 2) {
|
||||
foundDesiredSize = true
|
||||
}
|
||||
Log.d("font size", "incr size:$incrTextSize")
|
||||
}
|
||||
return incrTextSize
|
||||
}
|
||||
|
||||
private fun getStringWithEllipsis(pString: String, width: Float, fontSize: Float): String {
|
||||
if (TextUtils.isEmpty(pString)) {
|
||||
return ""
|
||||
}
|
||||
val paint = TextPaint()
|
||||
paint.typeface = Typeface.DEFAULT
|
||||
paint.textSize = fontSize
|
||||
return TextUtils.ellipsize(pString, paint, width, TextUtils.TruncateAt.END).toString()
|
||||
}
|
||||
|
||||
private class TextProperty constructor(/* access modifiers changed from: private */
|
||||
val mMaxWidth: Int, /* access modifiers changed from: private */
|
||||
val mHeightPerLine: Int, pLines: Array<String?>
|
||||
) {
|
||||
/* access modifiers changed from: private */
|
||||
val mLines: Array<String?>
|
||||
|
||||
/* access modifiers changed from: private */
|
||||
val mTotalHeight: Int
|
||||
|
||||
init {
|
||||
mTotalHeight = pLines.size * mHeightPerLine
|
||||
mLines = pLines
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
package org.cocos2dx.lib
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.opengl.GLSurfaceView
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import android.view.KeyEvent
|
||||
import android.view.MotionEvent
|
||||
import com.customRobTop.BaseRobTopActivity
|
||||
|
||||
|
||||
class Cocos2dxGLSurfaceView(context: Context) : GLSurfaceView(context) {
|
||||
companion object {
|
||||
lateinit var mCocos2dxGLSurfaceView: Cocos2dxGLSurfaceView
|
||||
private var sHandler: Handler? = null
|
||||
}
|
||||
|
||||
private lateinit var mCocos2dxRenderer: Cocos2dxRenderer
|
||||
|
||||
fun initView() {
|
||||
setEGLContextClientVersion(2)
|
||||
isFocusableInTouchMode = true
|
||||
// if (Build.VERSION.SDK_INT >= 11) {
|
||||
preserveEGLContextOnPause = true
|
||||
// }
|
||||
mCocos2dxGLSurfaceView = this
|
||||
// sCocos2dxTextInputWraper = Cocos2dxTextInputWraper(this)
|
||||
sHandler = @SuppressLint("HandlerLeak")
|
||||
object : Handler(Looper.getMainLooper()) {
|
||||
override fun handleMessage(msg: Message) {
|
||||
/* when (msg.what) {
|
||||
2 -> {
|
||||
if (this@Cocos2dxGLSurfaceView.mCocos2dxEditText != null && this@Cocos2dxGLSurfaceView.mCocos2dxEditText.requestFocus()) {
|
||||
this@Cocos2dxGLSurfaceView.mCocos2dxEditText.removeTextChangedListener(
|
||||
Cocos2dxGLSurfaceView.sCocos2dxTextInputWraper
|
||||
)
|
||||
this@Cocos2dxGLSurfaceView.mCocos2dxEditText.setText("")
|
||||
val text = msg.obj as String
|
||||
this@Cocos2dxGLSurfaceView.mCocos2dxEditText.append(text)
|
||||
Cocos2dxGLSurfaceView.sCocos2dxTextInputWraper.setOriginText(text)
|
||||
this@Cocos2dxGLSurfaceView.mCocos2dxEditText.addTextChangedListener(
|
||||
Cocos2dxGLSurfaceView.sCocos2dxTextInputWraper
|
||||
)
|
||||
(Cocos2dxGLSurfaceView.mCocos2dxGLSurfaceView.getContext()
|
||||
.getSystemService("input_method") as InputMethodManager).showSoftInput(
|
||||
this@Cocos2dxGLSurfaceView.mCocos2dxEditText,
|
||||
0
|
||||
)
|
||||
Log.d("GLSurfaceView", "showSoftInput")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
3 -> {
|
||||
if (this@Cocos2dxGLSurfaceView.mCocos2dxEditText != null) {
|
||||
this@Cocos2dxGLSurfaceView.mCocos2dxEditText.removeTextChangedListener(
|
||||
Cocos2dxGLSurfaceView.sCocos2dxTextInputWraper
|
||||
)
|
||||
(Cocos2dxGLSurfaceView.mCocos2dxGLSurfaceView.getContext()
|
||||
.getSystemService("input_method") as InputMethodManager).hideSoftInputFromWindow(
|
||||
this@Cocos2dxGLSurfaceView.mCocos2dxEditText.getWindowToken(),
|
||||
0
|
||||
)
|
||||
this@Cocos2dxGLSurfaceView.requestFocus()
|
||||
Log.d("GLSurfaceView", "HideSoftInput")
|
||||
this@Cocos2dxGLSurfaceView.mCocos2dxRenderer.handleTextClosed()
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
else -> return
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onTouchEvent(pMotionEvent: MotionEvent): Boolean {
|
||||
val pointerNumber = pMotionEvent.pointerCount
|
||||
val ids = IntArray(pointerNumber)
|
||||
val xs = FloatArray(pointerNumber)
|
||||
val ys = FloatArray(pointerNumber)
|
||||
for (i in 0 until pointerNumber) {
|
||||
ids[i] = pMotionEvent.getPointerId(i)
|
||||
xs[i] = pMotionEvent.getX(i)
|
||||
ys[i] = pMotionEvent.getY(i)
|
||||
}
|
||||
return when (pMotionEvent.action and MotionEvent.ACTION_MASK) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
val idDown = pMotionEvent.getPointerId(0)
|
||||
val xDown = xs[0]
|
||||
val f = ys[0]
|
||||
queueEvent {
|
||||
mCocos2dxRenderer.handleActionDown(
|
||||
idDown,
|
||||
xDown,
|
||||
f
|
||||
)
|
||||
}
|
||||
true
|
||||
}
|
||||
MotionEvent.ACTION_UP -> {
|
||||
val idUp = pMotionEvent.getPointerId(0)
|
||||
val f2 = xs[0]
|
||||
val f3 = ys[0]
|
||||
queueEvent { mCocos2dxRenderer.handleActionUp(idUp, f2, f3) }
|
||||
true
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
queueEvent {
|
||||
mCocos2dxRenderer.handleActionMove(
|
||||
ids,
|
||||
xs,
|
||||
ys
|
||||
)
|
||||
}
|
||||
true
|
||||
}
|
||||
MotionEvent.ACTION_CANCEL -> {
|
||||
queueEvent {
|
||||
mCocos2dxRenderer.handleActionCancel(
|
||||
ids,
|
||||
xs,
|
||||
ys
|
||||
)
|
||||
}
|
||||
true
|
||||
}
|
||||
MotionEvent.ACTION_POINTER_DOWN -> {
|
||||
val indexPointerDown = pMotionEvent.action shr 8
|
||||
val idPointerDown = pMotionEvent.getPointerId(indexPointerDown)
|
||||
val xPointerDown = pMotionEvent.getX(indexPointerDown)
|
||||
val y = pMotionEvent.getY(indexPointerDown)
|
||||
queueEvent {
|
||||
mCocos2dxRenderer.handleActionDown(
|
||||
idPointerDown,
|
||||
xPointerDown,
|
||||
y
|
||||
)
|
||||
}
|
||||
true
|
||||
}
|
||||
MotionEvent.ACTION_POINTER_UP -> {
|
||||
val indexPointUp = pMotionEvent.action shr 8
|
||||
val idPointerUp = pMotionEvent.getPointerId(indexPointUp)
|
||||
val xPointerUp = pMotionEvent.getX(indexPointUp)
|
||||
val y2 = pMotionEvent.getY(indexPointUp)
|
||||
queueEvent {
|
||||
mCocos2dxRenderer.handleActionUp(
|
||||
idPointerUp,
|
||||
xPointerUp,
|
||||
y2
|
||||
)
|
||||
}
|
||||
true
|
||||
}
|
||||
else -> true
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSizeChanged(
|
||||
pNewSurfaceWidth: Int,
|
||||
pNewSurfaceHeight: Int,
|
||||
pOldSurfaceWidth: Int,
|
||||
pOldSurfaceHeight: Int
|
||||
) {
|
||||
if (!isInEditMode) {
|
||||
mCocos2dxRenderer.setScreenWidthAndHeight(pNewSurfaceWidth, pNewSurfaceHeight)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onKeyDown(pKeyCode: Int, pKeyEvent: KeyEvent): Boolean {
|
||||
return when (pKeyCode) {
|
||||
KeyEvent.KEYCODE_BACK, KeyEvent.KEYCODE_MENU -> {
|
||||
if (pKeyEvent.repeatCount != 0 || BaseRobTopActivity.blockBackButton_) {
|
||||
return true
|
||||
}
|
||||
queueEvent { mCocos2dxRenderer.handleKeyDown(pKeyCode) }
|
||||
true
|
||||
}
|
||||
else -> super.onKeyDown(pKeyCode, pKeyEvent)
|
||||
}
|
||||
}
|
||||
|
||||
fun setCocos2dxRenderer(renderer: Cocos2dxRenderer) {
|
||||
this.mCocos2dxRenderer = renderer
|
||||
setRenderer(this.mCocos2dxRenderer)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package org.cocos2dx.lib
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.pm.ApplicationInfo
|
||||
|
||||
|
||||
@Suppress("unused")
|
||||
class Cocos2dxHelper {
|
||||
companion object {
|
||||
// private val sCocos2dMusic: Cocos2dxMusic? = null
|
||||
// private val sCocos2dSound: Cocos2dxSound? = null
|
||||
// private val sAssetManager: AssetManager? = null
|
||||
// private val sCocos2dxAccelerometer: Cocos2dxAccelerometer? = null
|
||||
// private val sAccelerometerEnabled = false
|
||||
private var sPackageName: String? = null
|
||||
private var sFileDirectory: String? = null
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private var sContext: Context? = null
|
||||
private var sCocos2dxHelperListener: Cocos2dxHelperListener? = null
|
||||
|
||||
@JvmStatic
|
||||
external fun nativeSetApkPath(pApkPath: String)
|
||||
|
||||
@JvmStatic
|
||||
fun getCocos2dxWritablePath(): String? {
|
||||
return sFileDirectory
|
||||
}
|
||||
|
||||
fun init(pContext: Context, pCocos2dxHelperListener: Cocos2dxHelperListener) {
|
||||
val applicationInfo: ApplicationInfo = pContext.applicationInfo
|
||||
sContext = pContext
|
||||
sCocos2dxHelperListener = pCocos2dxHelperListener
|
||||
sPackageName = applicationInfo.packageName
|
||||
sFileDirectory = pContext.filesDir.absolutePath
|
||||
|
||||
nativeSetApkPath(applicationInfo.sourceDir)
|
||||
// Cocos2dxHelper.sCocos2dxAccelerometer = Cocos2dxAccelerometer(pContext)
|
||||
// Cocos2dxHelper.sCocos2dMusic = Cocos2dxMusic(pContext)
|
||||
// var simultaneousStreams: Int = Cocos2dxSound.MAX_SIMULTANEOUS_STREAMS_DEFAULT
|
||||
// if (Cocos2dxHelper.getDeviceModel().indexOf("GT-I9100") !== -1) {
|
||||
// simultaneousStreams = Cocos2dxSound.MAX_SIMULTANEOUS_STREAMS_I9100
|
||||
// }
|
||||
// Cocos2dxHelper.sCocos2dSound = Cocos2dxSound(pContext, simultaneousStreams)
|
||||
// Cocos2dxHelper.sAssetManager = pContext.getAssets()
|
||||
Cocos2dxBitmap.setContext(pContext)
|
||||
// Cocos2dxETCLoader.setContext(pContext)
|
||||
}
|
||||
}
|
||||
|
||||
interface Cocos2dxHelperListener {
|
||||
fun runOnGLThread(pRunnable: Runnable)
|
||||
|
||||
fun showDialog(pTitle: String, pMessage: String)
|
||||
|
||||
fun showEditTextDialog(
|
||||
pTitle: String,
|
||||
pMessage: String,
|
||||
pInputMode: Int,
|
||||
pInputFlag: Int,
|
||||
pReturnType: Int,
|
||||
pMaxLength: Int
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package org.cocos2dx.lib
|
||||
|
||||
import android.opengl.GLSurfaceView
|
||||
import javax.microedition.khronos.egl.EGLConfig
|
||||
import javax.microedition.khronos.opengles.GL10
|
||||
|
||||
@Suppress("unused")
|
||||
class Cocos2dxRenderer : GLSurfaceView.Renderer {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun setAnimationInterval(@Suppress("UNUSED_PARAMETER") pAnimationInterval: Double) {
|
||||
// this function is useless for gd
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
private external fun nativeRender()
|
||||
|
||||
@JvmStatic
|
||||
private external fun nativeKeyDown(pKeyCode: Int): Boolean
|
||||
|
||||
@JvmStatic
|
||||
private external fun nativeTouchesBegin(pID: Int, pX: Float, pY: Float)
|
||||
|
||||
@JvmStatic
|
||||
private external fun nativeTouchesCancel(
|
||||
pIDs: IntArray,
|
||||
pXs: FloatArray,
|
||||
pYs: FloatArray
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
private external fun nativeTouchesEnd(pID: Int, pX: Float, pY: Float)
|
||||
|
||||
@JvmStatic
|
||||
private external fun nativeTouchesMove(pIDs: IntArray, pXs: FloatArray, pYs: FloatArray)
|
||||
}
|
||||
|
||||
private var mLastTickInNanoSeconds: Long = 0
|
||||
private var mScreenWidth = 0
|
||||
private var mScreenHeight = 0
|
||||
private external fun nativeInit(pWidth: Int, pHeight: Int)
|
||||
|
||||
fun setScreenWidthAndHeight(pSurfaceWidth: Int, pSurfaceHeight: Int) {
|
||||
mScreenWidth = pSurfaceWidth
|
||||
mScreenHeight = pSurfaceHeight
|
||||
}
|
||||
|
||||
override fun onSurfaceCreated(pGL10: GL10?, pEGLConfig: EGLConfig?) {
|
||||
nativeInit(this.mScreenWidth, this.mScreenHeight)
|
||||
this.mLastTickInNanoSeconds = System.nanoTime()
|
||||
}
|
||||
|
||||
override fun onSurfaceChanged(pGL10: GL10?, pWidth: Int, pHeight: Int) {}
|
||||
|
||||
override fun onDrawFrame(gl: GL10?) {
|
||||
nativeRender()
|
||||
}
|
||||
|
||||
fun handleActionDown(pID: Int, pX: Float, pY: Float) {
|
||||
nativeTouchesBegin(pID, pX, pY)
|
||||
}
|
||||
|
||||
fun handleActionUp(pID: Int, pX: Float, pY: Float) {
|
||||
nativeTouchesEnd(pID, pX, pY)
|
||||
}
|
||||
|
||||
fun handleActionCancel(pIDs: IntArray, pXs: FloatArray, pYs: FloatArray) {
|
||||
nativeTouchesCancel(pIDs, pXs, pYs)
|
||||
}
|
||||
|
||||
fun handleActionMove(pIDs: IntArray, pXs: FloatArray, pYs: FloatArray) {
|
||||
nativeTouchesMove(pIDs, pXs, pYs)
|
||||
}
|
||||
|
||||
fun handleKeyDown(pKeyCode: Int) {
|
||||
nativeKeyDown(pKeyCode)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.cocos2dx.lib
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Typeface
|
||||
import kotlin.jvm.Synchronized
|
||||
import java.util.HashMap
|
||||
|
||||
object Cocos2dxTypefaces {
|
||||
private val sTypefaceCache = HashMap<String, Typeface>()
|
||||
|
||||
@Synchronized
|
||||
operator fun get(pContext: Context, pAssetName: String): Typeface? {
|
||||
var typeface: Typeface?
|
||||
var typeface2: Typeface
|
||||
synchronized(Cocos2dxTypefaces::class.java) {
|
||||
if (!sTypefaceCache.containsKey(pAssetName)) {
|
||||
typeface2 = if (pAssetName.startsWith("/")) {
|
||||
Typeface.createFromFile(pAssetName)
|
||||
} else {
|
||||
Typeface.createFromAsset(pContext.assets, pAssetName)
|
||||
}
|
||||
sTypefaceCache[pAssetName] = typeface2
|
||||
}
|
||||
typeface = sTypefaceCache[pAssetName]
|
||||
}
|
||||
return typeface
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 187 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 7.4 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#282828</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<resources>
|
||||
<string name="app_name">Geode</string>
|
||||
<string name="title_activity_geometry_dash">GeometryDash</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="Theme.Geodelauncher" parent="android:Theme.Material.Light.NoActionBar" />
|
||||
</resources>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older that API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample data extraction rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||
for details.
|
||||
-->
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
||||
@@ -0,0 +1,14 @@
|
||||
buildscript {
|
||||
ext {
|
||||
compose_version = '1.1.1'
|
||||
}
|
||||
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id 'com.android.application' version '7.2.0' apply false
|
||||
id 'com.android.library' version '7.2.0' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app"s APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Kotlin code style for this project: "official" or "obsolete":
|
||||
kotlin.code.style=official
|
||||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
||||
@@ -0,0 +1,6 @@
|
||||
#Fri May 20 15:20:06 MST 2022
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
@@ -0,0 +1,185 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# 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 UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
@@ -0,0 +1,89 @@
|
||||
@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%" == "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%"=="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
|
||||
@@ -0,0 +1,16 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
rootProject.name = "geodelauncher"
|
||||
include ':app'
|
||||