-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
6,182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
def hostBuildDir = new File(rootProject.buildDir, "host") | ||
task configureHostTools(type: Exec) { | ||
workingDir ".." | ||
commandLine "cmake", "-B", hostBuildDir, "-G", "Ninja Multi-Config", "-DHOST_TOOLS_ONLY=1" | ||
// intentionally do not track inputs/outputs - let cmake figure that out. | ||
} | ||
["Debug", "RelWithDebInfo"].each { buildConfig -> | ||
def buildHostToolsTask = tasks.register('buildHostTools' + buildConfig, Exec) { | ||
workingDir ".." | ||
commandLine "cmake", "--build", hostBuildDir, "--target", "HogMaker", "--config", buildConfig | ||
dependsOn configureHostTools | ||
// intentionally do not track inputs/outputs - let cmake figure that out. | ||
} | ||
preBuild.dependsOn buildHostToolsTask | ||
} | ||
|
||
android { | ||
namespace "com.descent3.droid" | ||
compileSdkVersion 32 | ||
defaultConfig { | ||
minSdkVersion 32 | ||
targetSdkVersion 32 | ||
versionCode 1 | ||
versionName "1.0" | ||
externalNativeBuild { | ||
cmake { | ||
arguments "-DANDROID_APP_PLATFORM=android-19", "-DANDROID_STL=c++_static", "-DHogMaker_DIR=" + hostBuildDir | ||
// abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' | ||
abiFilters 'arm64-v8a' | ||
} | ||
} | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
applicationVariants.all { variant -> | ||
tasks["merge${variant.name.capitalize()}Assets"] | ||
.dependsOn("externalNativeBuild${variant.name.capitalize()}") | ||
} | ||
sourceSets { | ||
main { | ||
jniLibs.srcDir 'libs' | ||
java.srcDirs = ['src/main/java'] | ||
} | ||
} | ||
externalNativeBuild { | ||
cmake { | ||
path '../CMakeLists.txt' | ||
} | ||
} | ||
lint { | ||
abortOnError false | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(include: ['*.jar'], dir: 'libs') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in [sdk]/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Replace com.test.game with the identifier of your game below, e.g. | ||
com.gamemaker.game | ||
--> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:versionCode="1" | ||
android:versionName="devel" | ||
android:installLocation="auto"> | ||
|
||
<!-- OpenGL ES 2.0 --> | ||
<uses-feature android:glEsVersion="0x00020000" /> | ||
|
||
<!-- Touchscreen support --> | ||
<uses-feature | ||
android:name="android.hardware.touchscreen" | ||
android:required="false" /> | ||
|
||
<!-- Game controller support --> | ||
<uses-feature | ||
android:name="android.hardware.bluetooth" | ||
android:required="false" /> | ||
<uses-feature | ||
android:name="android.hardware.gamepad" | ||
android:required="false" /> | ||
<uses-feature | ||
android:name="android.hardware.usb.host" | ||
android:required="false" /> | ||
|
||
<!-- External mouse input events --> | ||
<uses-feature | ||
android:name="android.hardware.type.pc" | ||
android:required="false" /> | ||
|
||
<!-- Audio recording support --> | ||
<!-- if you want to capture audio, uncomment this. --> | ||
<!-- <uses-feature | ||
android:name="android.hardware.microphone" | ||
android:required="false" /> --> | ||
<!-- <uses-permission android:name="android.permission.RECORD_AUDIO" /> --> | ||
|
||
<!-- Allow access to Bluetooth devices --> | ||
<!-- Currently this is just for Steam Controller support and requires setting SDL_HINT_JOYSTICK_HIDAPI_STEAM --> | ||
<!-- <uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" /> --> | ||
<!-- <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> --> | ||
|
||
<!-- Allow access to the vibrator --> | ||
<uses-permission android:name="android.permission.VIBRATE" /> | ||
|
||
<!-- Create a Java class extending SDLActivity and place it in a | ||
directory under app/src/main/java matching the package, e.g. app/src/main/java/com/gamemaker/game/MyGame.java | ||
then replace "SDLActivity" with the name of your class (e.g. "MyGame") | ||
in the XML below. | ||
An example Java class can be found in README-android.md | ||
--> | ||
<application android:label="@string/app_name" | ||
android:icon="@mipmap/ic_launcher" | ||
android:allowBackup="true" | ||
android:theme="@style/AppTheme" | ||
android:hardwareAccelerated="true" > | ||
|
||
<!-- Example of setting SDL hints from AndroidManifest.xml: | ||
<meta-data android:name="SDL_ENV.SDL_ACCELEROMETER_AS_JOYSTICK" android:value="0"/> | ||
--> | ||
|
||
<activity android:name="MainActivity" | ||
android:label="@string/app_name" | ||
android:alwaysRetainTaskState="true" | ||
android:launchMode="singleInstance" | ||
android:configChanges="layoutDirection|locale|orientation|uiMode|screenLayout|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation" | ||
android:preferMinimalPostProcessing="true" | ||
android:exported="true" | ||
> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
<!-- Let Android know that we can handle some USB devices and should receive this event --> | ||
<intent-filter> | ||
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
18 changes: 18 additions & 0 deletions
18
android/src/main/java/com/descent3/droid/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.descent3.droid; | ||
|
||
import org.libsdl.app.SDLActivity; | ||
|
||
public class MainActivity extends SDLActivity { | ||
@Override | ||
protected String[] getLibraries() { | ||
return new String[] { | ||
"SDL2", | ||
"Descent3", | ||
}; | ||
} | ||
|
||
@Override | ||
protected String[] getArguments() { | ||
return super.getArguments(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.libsdl.app; | ||
|
||
import android.hardware.usb.UsbDevice; | ||
|
||
interface HIDDevice | ||
{ | ||
public int getId(); | ||
public int getVendorId(); | ||
public int getProductId(); | ||
public String getSerialNumber(); | ||
public int getVersion(); | ||
public String getManufacturerName(); | ||
public String getProductName(); | ||
public UsbDevice getDevice(); | ||
public boolean open(); | ||
public int sendFeatureReport(byte[] report); | ||
public int sendOutputReport(byte[] report); | ||
public boolean getFeatureReport(byte[] report); | ||
public void setFrozen(boolean frozen); | ||
public void close(); | ||
public void shutdown(); | ||
} |
Oops, something went wrong.