first commit
@@ -0,0 +1,18 @@
|
||||
# https://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{java,scala,groovy,kt,kts}]
|
||||
indent_size = 4
|
||||
|
||||
[*.gradle]
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
@@ -0,0 +1,2 @@
|
||||
* text=auto eol=lf
|
||||
*.bat text=auto eol=crlf
|
||||
@@ -0,0 +1,164 @@
|
||||
## Gradle:
|
||||
.gradle/
|
||||
gradle-app.setting
|
||||
/build/
|
||||
/android/build/
|
||||
/core/build/
|
||||
/lwjgl2/build/
|
||||
/lwjgl3/build/
|
||||
/html/build/
|
||||
/teavm/build/
|
||||
/ios/build/
|
||||
/ios-moe/build/
|
||||
/headless/build/
|
||||
/server/build/
|
||||
/shared/build/
|
||||
|
||||
## Java:
|
||||
*.class
|
||||
*.war
|
||||
*.ear
|
||||
hs_err_pid*
|
||||
.attach_pid*
|
||||
|
||||
## Android:
|
||||
/android/libs/armeabi-v7a/
|
||||
/android/libs/arm64-v8a/
|
||||
/android/libs/x86/
|
||||
/android/libs/x86_64/
|
||||
/android/gen/
|
||||
/android/out/
|
||||
local.properties
|
||||
com_crashlytics_export_strings.xml
|
||||
|
||||
## Robovm:
|
||||
/ios/robovm-build/
|
||||
|
||||
## iOS:
|
||||
/ios/xcode/*.xcodeproj/*
|
||||
!/ios/xcode/*.xcodeproj/xcshareddata
|
||||
!/ios/xcode/*.xcodeproj/project.pbxproj
|
||||
/ios/xcode/native/
|
||||
/ios/IOSLauncher.app
|
||||
/ios/IOSLauncher.app.dSYM
|
||||
|
||||
## GWT:
|
||||
/html/war/
|
||||
/html/gwt-unitCache/
|
||||
.apt_generated/
|
||||
/html/war/WEB-INF/deploy/
|
||||
/html/war/WEB-INF/classes/
|
||||
.gwt/
|
||||
gwt-unitCache/
|
||||
www-test/
|
||||
.gwt-tmp/
|
||||
|
||||
## TeaVM:
|
||||
# Not sure yet...
|
||||
|
||||
## IntelliJ, Android Studio:
|
||||
.idea/
|
||||
*.ipr
|
||||
*.iws
|
||||
*.iml
|
||||
|
||||
## Eclipse:
|
||||
.classpath
|
||||
.project
|
||||
.metadata/
|
||||
/android/bin/
|
||||
/core/bin/
|
||||
/lwjgl2/bin/
|
||||
/lwjgl3/bin/
|
||||
/html/bin/
|
||||
/teavm/bin/
|
||||
/ios/bin/
|
||||
/ios-moe/bin/
|
||||
/headless/bin/
|
||||
/server/bin/
|
||||
/shared/bin/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
.settings/
|
||||
.loadpath
|
||||
.externalToolBuilders/
|
||||
*.launch
|
||||
|
||||
|
||||
## NetBeans:
|
||||
|
||||
/nbproject/private/
|
||||
/android/nbproject/private/
|
||||
/core/nbproject/private/
|
||||
/lwjgl2/nbproject/private/
|
||||
/lwjgl3/nbproject/private/
|
||||
/html/nbproject/private/
|
||||
/teavm/nbproject/private/
|
||||
/ios/nbproject/private/
|
||||
/ios-moe/nbproject/private/
|
||||
/headless/nbproject/private/
|
||||
/server/nbproject/private/
|
||||
/shared/nbproject/private/
|
||||
|
||||
/nbbuild/
|
||||
/android/nbbuild/
|
||||
/core/nbbuild/
|
||||
/lwjgl2/nbbuild/
|
||||
/lwjgl3/nbbuild/
|
||||
/html/nbbuild/
|
||||
/teavm/nbbuild/
|
||||
/ios/nbbuild/
|
||||
/ios-moe/nbbuild/
|
||||
/headless/nbbuild/
|
||||
/server/nbbuild/
|
||||
/shared/nbbuild/
|
||||
|
||||
/dist/
|
||||
/android/dist/
|
||||
/core/dist/
|
||||
/lwjgl2/dist/
|
||||
/lwjgl3/dist/
|
||||
/html/dist/
|
||||
/teavm/dist/
|
||||
/ios/dist/
|
||||
/ios-moe/dist/
|
||||
/headless/dist/
|
||||
/server/dist/
|
||||
/shared/dist/
|
||||
|
||||
/nbdist/
|
||||
/android/nbdist/
|
||||
/core/nbdist/
|
||||
/lwjgl2/nbdist/
|
||||
/lwjgl3/nbdist/
|
||||
/html/nbdist/
|
||||
/teavm/nbdist/
|
||||
/ios/nbdist/
|
||||
/ios-moe/nbdist/
|
||||
/headless/nbdist/
|
||||
/server/nbdist/
|
||||
/shared/nbdist/
|
||||
|
||||
nbactions.xml
|
||||
nb-configuration.xml
|
||||
|
||||
## OS-Specific:
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
## Miscellaneous:
|
||||
*~
|
||||
*.*#
|
||||
*#*#
|
||||
/.kotlin/
|
||||
/assets/assets.txt
|
||||
|
||||
## Special cases:
|
||||
|
||||
## There is a resource-config.json file generated by nativeimage.gradle if you use Graal Native Image.
|
||||
## Some usage may need extra resource configuration in a different file with the same name.
|
||||
## You could also add that configuration to the text in nativeimage.gradle .
|
||||
## You should delete or comment out the next line if you have configuration in a different resource-config.json .
|
||||
**/resource-config.json
|
||||
@@ -0,0 +1,51 @@
|
||||
# OwnPlanetsWallpaper in libgdx
|
||||
|
||||
|
||||
orignal wallpaper is at
|
||||
https://github.com/ELY3M/OwnPlanetsWallpaper
|
||||
|
||||
|
||||
Here is video of the wallpaper in action
|
||||
https://www.youtube.com/watch?v=-fdXivt3J_k
|
||||
|
||||
|
||||
==================================================================
|
||||
|
||||
|
||||
A [libGDX](https://libgdx.com/) project generated with [gdx-liftoff](https://github.com/libgdx/gdx-liftoff).
|
||||
|
||||
This project was generated with a template that includes Kotlin application launchers and an empty `ApplicationAdapter` implemented in Kotlin.
|
||||
|
||||
## Platforms
|
||||
|
||||
- `core`: Main module with the application logic shared by all platforms.
|
||||
- `lwjgl3`: Primary desktop platform using LWJGL3; was called 'desktop' in older docs.
|
||||
- `android`: Android mobile platform. Needs Android SDK.
|
||||
- `teavm`: Web backend that supports most JVM languages.
|
||||
- `ios-moe`: iOS mobile backend using Multi-OS Engine.
|
||||
|
||||
## Gradle
|
||||
|
||||
This project uses [Gradle](https://gradle.org/) to manage dependencies.
|
||||
The Gradle wrapper was included, so you can run Gradle tasks using `gradlew.bat` or `./gradlew` commands.
|
||||
Useful Gradle tasks and flags:
|
||||
|
||||
- `--continue`: when using this flag, errors will not stop the tasks from running.
|
||||
- `--daemon`: thanks to this flag, Gradle daemon will be used to run chosen tasks.
|
||||
- `--offline`: when using this flag, cached dependency archives will be used.
|
||||
- `--refresh-dependencies`: this flag forces validation of all dependencies. Useful for snapshot versions.
|
||||
- `android:lint`: performs Android project validation.
|
||||
- `build`: builds sources and archives of every project.
|
||||
- `cleanEclipse`: removes Eclipse project data.
|
||||
- `cleanIdea`: removes IntelliJ project data.
|
||||
- `clean`: removes `build` folders, which store compiled classes and built archives.
|
||||
- `eclipse`: generates Eclipse project data.
|
||||
- `idea`: generates IntelliJ project data.
|
||||
- `lwjgl3:jar`: builds application's runnable jar, which can be found at `lwjgl3/build/libs`.
|
||||
- `lwjgl3:run`: starts the application.
|
||||
- `teavm:build`: builds the JavaScript application into the build/dist/webapp folder.
|
||||
- `teavm:run`: serves the JavaScript application at http://localhost:8080 via a local Jetty server.
|
||||
- `test`: runs unit tests (if any).
|
||||
|
||||
Note that most tasks that are not specific to a single project can be run with `name:` prefix, where the `name` should be replaced with the ID of a specific project.
|
||||
For example, `core:clean` removes `build` folder only from the `core` project.
|
||||
@@ -0,0 +1,54 @@
|
||||
<?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"/>
|
||||
<uses-feature android:name="android.hardware.type.pc" android:required="false" />
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:fullBackupContent="true"
|
||||
android:icon="@drawable/element2"
|
||||
android:isGame="true"
|
||||
android:appCategory="game"
|
||||
android:label="@string/app_name"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<service
|
||||
android:label="@string/app_name"
|
||||
android:name=".WallpaperService"
|
||||
android:enabled="true"
|
||||
android:permission="android.permission.BIND_WALLPAPER"
|
||||
android:exported="true">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.service.wallpaper.WallpaperService"/>
|
||||
</intent-filter>
|
||||
|
||||
<meta-data android:name="android.service.wallpaper" android:resource="@xml/wallpaper"/>
|
||||
</service>
|
||||
|
||||
<service android:name="own.planetslivewallpaper.Screensaver"
|
||||
android:label="@string/app_name"
|
||||
android:icon="@drawable/element2"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BIND_DREAM_SERVICE">
|
||||
<intent-filter>
|
||||
<action android:name="android.service.dreams.DreamService" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.service.dream"
|
||||
android:resource="@xml/screensaver" />
|
||||
</service>
|
||||
|
||||
<activity
|
||||
android:name="own.planetslivewallpaper.AndroidLauncher"
|
||||
android:screenOrientation="fullSensor"
|
||||
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,128 @@
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
}
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
namespace = "own.planetslivewallpaper"
|
||||
compileSdk 37
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.setSrcDirs(['src/main/java', 'src/main/kotlin'])
|
||||
aidl.setSrcDirs(['src/main/java', 'src/main/kotlin'])
|
||||
renderscript.setSrcDirs(['src/main/java', 'src/main/kotlin'])
|
||||
res.setSrcDirs(['res'])
|
||||
assets.setSrcDirs(['../assets'])
|
||||
jniLibs.setSrcDirs(['libs'])
|
||||
}
|
||||
}
|
||||
packagingOptions {
|
||||
resources {
|
||||
excludes += ['META-INF/robovm/ios/robovm.xml', 'META-INF/DEPENDENCIES.txt', 'META-INF/DEPENDENCIES',
|
||||
'META-INF/dependencies.txt', '**/*.gwt.xml']
|
||||
pickFirsts += ['META-INF/LICENSE.txt', 'META-INF/LICENSE', 'META-INF/license.txt', 'META-INF/LGPL2.1',
|
||||
'META-INF/NOTICE.txt', 'META-INF/NOTICE', 'META-INF/notice.txt']
|
||||
}
|
||||
}
|
||||
defaultConfig {
|
||||
applicationId 'own.planetslivewallpaper'
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 37
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility "21"
|
||||
targetCompatibility "21"
|
||||
coreLibraryDesugaringEnabled = true
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
kotlin.compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
|
||||
|
||||
}
|
||||
|
||||
repositories {
|
||||
// needed for AAPT2, may be needed for other tools
|
||||
google()
|
||||
}
|
||||
|
||||
configurations { natives }
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
|
||||
implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
|
||||
implementation project(':core')
|
||||
|
||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
|
||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
|
||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
|
||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
|
||||
|
||||
}
|
||||
|
||||
// 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-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
|
||||
if(jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
|
||||
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_SDK_ROOT"
|
||||
}
|
||||
} else {
|
||||
path = "$System.env.ANDROID_SDK_ROOT"
|
||||
}
|
||||
|
||||
def adb = path + "/platform-tools/adb"
|
||||
commandLine "$adb", 'shell', 'am', 'start', '-n', 'own.planetslivewallpaper/own.planetslivewallpaper.android.AndroidLauncher'
|
||||
}
|
||||
|
||||
eclipse.project.name = appName + "-android"
|
||||
@@ -0,0 +1,52 @@
|
||||
# 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
|
||||
# https://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
-verbose
|
||||
|
||||
-dontwarn android.support.**
|
||||
-dontwarn com.badlogic.gdx.backends.android.AndroidFragmentApplication
|
||||
|
||||
# Needed by the gdx-controllers official extension.
|
||||
-keep class com.badlogic.gdx.controllers.android.AndroidControllers
|
||||
|
||||
# Needed by the Box2D official extension.
|
||||
-keepclassmembers class com.badlogic.gdx.physics.box2d.World {
|
||||
boolean contactFilter(long, long);
|
||||
boolean getUseDefaultContactFilter();
|
||||
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);
|
||||
}
|
||||
|
||||
# You will need the next three lines if you use scene2d for UI or gameplay.
|
||||
# If you don't use scene2d at all, you can remove or comment out the next line:
|
||||
-keep public class com.badlogic.gdx.scenes.scene2d.** { *; }
|
||||
# You will need the next two lines if you use BitmapFont or any scene2d.ui text:
|
||||
-keep public class com.badlogic.gdx.graphics.g2d.BitmapFont { *; }
|
||||
# You will probably need this line in most cases:
|
||||
-keep public class com.badlogic.gdx.graphics.Color { *; }
|
||||
|
||||
# These two lines are used with mapping files; see https://developer.android.com/build/shrink-code#retracing
|
||||
-keepattributes LineNumberTable,SourceFile
|
||||
-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,14 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-rules.pro
|
||||
|
||||
# Project target.
|
||||
target=android-21
|
||||
|
After Width: | Height: | Size: 517 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 231 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">Own Planets Wallpaper - libgdx</string>
|
||||
<string name="description">My own aliens and planets live wallpaper :) this wallpaper uses libgdx</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<dream xmlns:android="http://schemas.android.com/apk/res/android" />
|
||||
@@ -0,0 +1,6 @@
|
||||
<wallpaper
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
android:thumbnail="@drawable/element2"
|
||||
android:description="@string/description"
|
||||
/>
|
||||
@@ -0,0 +1,16 @@
|
||||
package own.planetslivewallpaper
|
||||
|
||||
import android.os.Bundle
|
||||
import com.badlogic.gdx.backends.android.AndroidApplication
|
||||
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration
|
||||
|
||||
/** Launches the Android application. */
|
||||
class AndroidLauncher : AndroidApplication() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
initialize(Main(), AndroidApplicationConfiguration().apply {
|
||||
// Configure your application here.
|
||||
useImmersiveMode = true // Recommended, but not required.
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package own.planetslivewallpaper
|
||||
|
||||
/*
|
||||
import com.badlogic.gdx.backends.android.AndroidApplicationBase
|
||||
import com.badlogic.gdx.backends.android.AndroidApplication
|
||||
import android.service.dreams.DreamService
|
||||
import com.badlogic.gdx.ApplicationListener
|
||||
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration
|
||||
import com.badlogic.gdx.backends.android.AndroidGraphics
|
||||
import own.planetslivewallpaper.Main
|
||||
|
||||
|
||||
class Screensaver : DreamService(), ApplicationListener {
|
||||
|
||||
private lateinit var graphics: AndroidGraphics
|
||||
private lateinit var listener: ApplicationListener
|
||||
private val config = AndroidApplicationConfiguration()
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
|
||||
// Enable user interaction if your screensaver is interactive
|
||||
isInteractive = false
|
||||
// Request fullscreen window layout
|
||||
isFullscreen = true
|
||||
|
||||
// Initialize libGDX configuration
|
||||
config.useGL30 = false
|
||||
|
||||
// Initialize the graphics surface manually
|
||||
///graphics = AndroidGraphics(, config, config.resolutionStrategy)
|
||||
|
||||
// Bind the service life cycle into the view hierarchy
|
||||
//setContentView(graphics.view)
|
||||
|
||||
//initialize(Main(), config)
|
||||
val config = AndroidApplicationConfiguration()
|
||||
listener = Main()
|
||||
|
||||
// Manually initialize the view instead of calling initialize()
|
||||
val view = initializeForView(listener, config)
|
||||
setContentView(view)
|
||||
|
||||
}
|
||||
|
||||
override fun onDreamingStarted() {
|
||||
super.onDreamingStarted()
|
||||
// Resume game loops or engines here if needed
|
||||
}
|
||||
|
||||
override fun onDreamingStopped() {
|
||||
super.onDreamingStopped()
|
||||
// Pause resource allocations safely
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
// Clear GL references and contexts safely
|
||||
}
|
||||
|
||||
|
||||
// --- libGDX ApplicationListener Lifecycle Methods ---
|
||||
override fun create() {
|
||||
//val config = AndroidApplicationConfiguration()
|
||||
//initialize(Main(), config)
|
||||
// Initialize shaders, textures, or cameras here
|
||||
}
|
||||
|
||||
override fun resize(width: Int, height: Int) {}
|
||||
|
||||
override fun render() {
|
||||
// Clear screen and draw your canvas
|
||||
// Example: Gdx.gl.glClearColor(0f, 0f, 0f, 1f)
|
||||
}
|
||||
|
||||
override fun pause() {}
|
||||
|
||||
override fun resume() {}
|
||||
|
||||
override fun dispose() {}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
import android.service.dreams.DreamService
|
||||
import android.view.View
|
||||
import com.badlogic.gdx.ApplicationListener
|
||||
import com.badlogic.gdx.backends.android.AndroidApplication
|
||||
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration
|
||||
import own.planetslivewallpaper.Main
|
||||
|
||||
class Screensaver : DreamService() {
|
||||
|
||||
private lateinit var Listener: ApplicationListener
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
|
||||
isInteractive = false
|
||||
isFullscreen = true
|
||||
|
||||
val config = AndroidApplicationConfiguration()
|
||||
Listener = Main() // Replace with your main game class
|
||||
|
||||
// Create an anonymous AndroidApplication delegate to call initializeForView
|
||||
val appDelegate = object : AndroidApplication() {
|
||||
fun createGdxView(): View {
|
||||
// Now initializeForView can be successfully called here
|
||||
return initializeForView(Listener, config)
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch the generated surface view and apply it to the DreamService
|
||||
val gdxView = appDelegate.createGdxView()
|
||||
setContentView(gdxView)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package own.planetslivewallpaper
|
||||
|
||||
import android.util.Log
|
||||
import com.badlogic.gdx.ApplicationListener
|
||||
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration
|
||||
import com.badlogic.gdx.backends.android.AndroidLiveWallpaperService
|
||||
|
||||
class WallpaperService : AndroidLiveWallpaperService() {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "WallpaperService"
|
||||
}
|
||||
|
||||
override fun onCreateApplication() {
|
||||
super.onCreateApplication()
|
||||
|
||||
Log.i( TAG, "onCreateApplication()" )
|
||||
|
||||
val config = AndroidApplicationConfiguration()
|
||||
val listener: ApplicationListener = Main()
|
||||
|
||||
initialize(listener, config)
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
class MyLiveWallpaperListener : AndroidWallpaperListener, ApplicationListener {
|
||||
private var batch: SpriteBatch? = null
|
||||
private var img: Texture? = null
|
||||
|
||||
override fun offsetChange(
|
||||
xOffset: Float,
|
||||
yOffset: Float,
|
||||
xOffsetStep: Float,
|
||||
yOffsetStep: Float,
|
||||
xPixelOffset: Int,
|
||||
yPixelOffset: Int
|
||||
) {
|
||||
Log.i(TAG,"AndroidWallpaperListener: offsetChange(xOffset:$xOffset yOffset:$yOffset xOffsetSteep:$xOffsetStep yOffsetStep:$yOffsetStep xPixelOffset:$xPixelOffset yPixelOffset:$yPixelOffset)")
|
||||
}
|
||||
|
||||
override fun previewStateChange(isPreview: Boolean) {
|
||||
Log.i(TAG, "AndroidWallpaperListener: previewStateChange(isPreview:$isPreview)")
|
||||
}
|
||||
|
||||
override fun iconDropped(x: Int, y: Int) {
|
||||
Log.i(TAG, "AndroidWallpaperListener: iconDropped ($x, $y)")
|
||||
}
|
||||
|
||||
override fun create() {
|
||||
Log.i(TAG, "ApplicationListener: create")
|
||||
|
||||
batch = SpriteBatch()
|
||||
img = Texture("background.png")
|
||||
}
|
||||
|
||||
override fun resize(width: Int, height: Int) {
|
||||
Log.i(TAG, "ApplicationListener: resize")
|
||||
}
|
||||
|
||||
override fun render() {
|
||||
Log.i(TAG, "ApplicationListener: render")
|
||||
|
||||
ScreenUtils.clear(0f, 0f, 1f, 1f)
|
||||
batch!!.begin()
|
||||
batch!!.draw(img, 0f, 0f)
|
||||
batch!!.end()
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun pause() {
|
||||
Log.i(TAG, "ApplicationListener: pause")
|
||||
}
|
||||
|
||||
override fun resume() {
|
||||
Log.i(TAG, "ApplicationListener: resume")
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
Log.i(TAG, "ApplicationListener: dispose")
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 517 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 368 KiB |
|
After Width: | Height: | Size: 199 KiB |
|
After Width: | Height: | Size: 355 KiB |
|
After Width: | Height: | Size: 231 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 9.9 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 464 B |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 812 B |
|
After Width: | Height: | Size: 741 B |
|
After Width: | Height: | Size: 680 B |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 469 B |
@@ -0,0 +1,78 @@
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
mavenLocal()
|
||||
google()
|
||||
maven { url = 'https://central.sonatype.com/repository/maven-snapshots/' }
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:9.3.2"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'idea'
|
||||
|
||||
// This allows you to "Build and run using IntelliJ IDEA", an option in IDEA's Settings.
|
||||
idea {
|
||||
module {
|
||||
outputDir = file('build/classes/java/main')
|
||||
testOutputDir = file('build/classes/java/test')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configure(subprojects - project(':android')) {
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'kotlin'
|
||||
java.sourceCompatibility = 21
|
||||
java.targetCompatibility = 21
|
||||
|
||||
// From https://lyze.dev/2021/04/29/libGDX-Internal-Assets-List/
|
||||
// The article can be helpful when using assets.txt in your project.
|
||||
tasks.register('generateAssetList') {
|
||||
inputs.dir("${project.rootDir}/assets/")
|
||||
// projectFolder/assets
|
||||
File assetsFolder = new File("${project.rootDir}/assets/")
|
||||
// projectFolder/assets/assets.txt
|
||||
File assetsFile = new File(assetsFolder, "assets.txt")
|
||||
// delete that file in case we've already created it
|
||||
assetsFile.delete()
|
||||
|
||||
// iterate through all files inside that folder
|
||||
// convert it to a relative path
|
||||
// and append it to the file assets.txt
|
||||
fileTree(assetsFolder).collect { assetsFolder.relativePath(it) }.sort().each {
|
||||
assetsFile.append(it + "\n")
|
||||
}
|
||||
}
|
||||
processResources.dependsOn 'generateAssetList'
|
||||
|
||||
compileJava {
|
||||
options.incremental = true
|
||||
}
|
||||
compileKotlin.compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
|
||||
compileTestKotlin.compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
|
||||
|
||||
}
|
||||
|
||||
subprojects {
|
||||
version = "$projectVersion"
|
||||
ext.appName = 'OwnPlanetsLiveWallpaper'
|
||||
repositories {
|
||||
mavenCentral()
|
||||
// You may want to remove the following line if you have errors downloading dependencies.
|
||||
mavenLocal()
|
||||
maven { url = 'https://central.sonatype.com/repository/maven-snapshots/' }
|
||||
maven { url = 'https://jitpack.io' }
|
||||
maven { url = 'https://teavm.org/maven/repository/' }
|
||||
}
|
||||
}
|
||||
|
||||
eclipse.project.name = 'OwnPlanetsLiveWallpaper' + '-parent'
|
||||
@@ -0,0 +1,15 @@
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
eclipse.project.name = appName + '-core'
|
||||
|
||||
dependencies {
|
||||
api "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
|
||||
|
||||
if(enableGraalNative == 'true') {
|
||||
implementation "io.github.berstanio:gdx-svmhelper-annotations:$graalHelperVersion"
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||