mirror of https://github.com/auygun/kaliber.git
Update android build
Upgrade to gradle 8.0 Compile and target sdk 33 Min sdk 24 Upgrade to Google Mobile Ads SDK 22.0 Enable c++20 and fix compilation issues
This commit is contained in:
parent
97271835b0
commit
655c0a7b71
|
@ -1,5 +1,6 @@
|
|||
build/android/.gradle
|
||||
build/android/*.apk
|
||||
build/android/*.idsig
|
||||
build/android/app/.cxx
|
||||
build/android/app/build
|
||||
build/android/build
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
A simple, cross-platform 2D game engine with OpenGL and Vulkan renderers.
|
||||
Supports Linux and Android (lolipop+) platforms.
|
||||
Supports Linux and Android platforms.
|
||||
This is a personal hobby project. I've published a little game on
|
||||
[Google Play](https://play.google.com/store/apps/details?id=com.woom.game)
|
||||
based on this engine. Full game code and assets are included in this repository.
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.4.1)
|
||||
cmake_minimum_required(VERSION 3.22.1)
|
||||
project(kaliber)
|
||||
|
||||
# OBOE Library
|
||||
set (OBOE_DIR ../../../src/third_party/oboe)
|
||||
|
@ -36,9 +37,9 @@ add_library(native_app_glue STATIC
|
|||
|
||||
# now build app's shared lib
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Werror -D_DEBUG -DVK_USE_PLATFORM_ANDROID_KHR")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20 -Wall -Werror -Wno-unused-but-set-variable -Wno-deprecated-enum-enum-conversion -Wno-unused-parameter -Wno-unsequenced -D_DEBUG -DVK_USE_PLATFORM_ANDROID_KHR")
|
||||
else ()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Werror -DVK_USE_PLATFORM_ANDROID_KHR")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20 -Wall -Werror -Wno-unused-but-set-variable -Wno-deprecated-enum-enum-conversion -Wno-unused-parameter -Wno-unsequenced -DVK_USE_PLATFORM_ANDROID_KHR")
|
||||
endif ()
|
||||
|
||||
|
||||
|
@ -141,6 +142,7 @@ add_library(kaliber SHARED
|
|||
../../../src/third_party/minizip/ioapi.c
|
||||
../../../src/third_party/minizip/unzip.c
|
||||
../../../src/third_party/spirv-reflect/spirv_reflect.c
|
||||
../../../src/third_party/stb/stb_image.c
|
||||
../../../src/third_party/texture_compressor/dxt_encoder_internals.cc
|
||||
../../../src/third_party/texture_compressor/dxt_encoder.cc
|
||||
../../../src/third_party/texture_compressor/texture_compressor_etc1.cc
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
ndkVersion '21.3.6528147'
|
||||
compileSdk 33
|
||||
ndkVersion '25.1.8937393'
|
||||
|
||||
defaultConfig {
|
||||
applicationId = 'com.woom.game'
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
minSdk 24
|
||||
targetSdk 33
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments '-DANDROID_STL=c++_static'
|
||||
|
@ -29,7 +29,7 @@ android {
|
|||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version '3.10.2'
|
||||
version '3.22.1'
|
||||
path 'CMakeLists.txt'
|
||||
}
|
||||
}
|
||||
|
@ -39,11 +39,12 @@ android {
|
|||
assets.srcDirs = ['../../../assets']
|
||||
}
|
||||
}
|
||||
namespace 'com.woom.game'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation 'androidx.appcompat:appcompat:1.0.2'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
implementation 'com.google.android.gms:play-services-ads:19.1.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'com.google.android.gms:play-services-ads:22.0.0'
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.woom.game"
|
||||
android:versionCode="16"
|
||||
android:versionName="1.0.1">
|
||||
|
||||
|
@ -20,6 +19,7 @@
|
|||
android:configChanges="orientation|keyboardHidden"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
|
|
@ -5,7 +5,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
||||
classpath 'com.android.tools.build:gradle:8.0.1'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,9 +9,13 @@
|
|||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
android.defaults.buildfeatures.buildconfig=true
|
||||
android.enableJetifier=true
|
||||
android.nonFinalResIds=false
|
||||
android.nonTransitiveRClass=false
|
||||
android.useAndroidX=true
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
android.native.buildOutput=verbose
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
|
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
jarsigner -keystore ~/key_store/apk_key_store.jks -storepass xxx -keypass xxx -signedjar app-release.apk ./app/build/outputs/apk/release/app-release-unsigned.apk upload
|
||||
zipalign -f 4 ./app-release.apk ./app-release-aligned.apk
|
||||
~/Android/Sdk/build-tools/31.0.0/zipalign -p -f 4 ./app/build/outputs/apk/release/app-release-unsigned.apk ./app-release-aligned.apk
|
||||
~/Android/Sdk/build-tools/31.0.0/apksigner sign -ks ~/key_store/apk_key_store.jks --ks-key-alias upload --ks-pass stdin ./app-release-aligned.apk
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "animator.h"
|
||||
#include "engine/animator.h"
|
||||
|
||||
#include "base/interpolation.h"
|
||||
#include "base/log.h"
|
||||
|
|
|
@ -11,11 +11,18 @@ import android.util.Log;
|
|||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import com.google.android.gms.ads.AdListener;
|
||||
import com.google.android.gms.ads.AdError;
|
||||
import com.google.android.gms.ads.AdRequest;
|
||||
import com.google.android.gms.ads.InterstitialAd;
|
||||
import com.google.android.gms.ads.FullScreenContentCallback;
|
||||
import com.google.android.gms.ads.LoadAdError;
|
||||
import com.google.android.gms.ads.MobileAds;
|
||||
import com.google.android.gms.ads.initialization.InitializationStatus;
|
||||
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
|
||||
import com.google.android.gms.ads.interstitial.InterstitialAd;
|
||||
import com.google.android.gms.ads.interstitial.InterstitialAdLoadCallback;
|
||||
import com.woom.game.R;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -35,7 +42,13 @@ public class KaliberActivity extends NativeActivity {
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mInterstitialAd = newInterstitialAd();
|
||||
|
||||
MobileAds.initialize(this, new OnInitializationCompleteListener() {
|
||||
@Override
|
||||
public void onInitializationComplete(InitializationStatus initializationStatus) {
|
||||
Log.d("kaliber", "MobileAds initialization complete.");
|
||||
}
|
||||
});
|
||||
loadInterstitialAd();
|
||||
}
|
||||
|
||||
|
@ -52,44 +65,13 @@ public class KaliberActivity extends NativeActivity {
|
|||
});
|
||||
}
|
||||
|
||||
private InterstitialAd newInterstitialAd() {
|
||||
InterstitialAd interstitialAd = new InterstitialAd(this);
|
||||
interstitialAd.setAdUnitId(getString(R.string.interstitial_ad_unit_id));
|
||||
interstitialAd.setAdListener(new AdListener() {
|
||||
@Override
|
||||
public void onAdLoaded() {
|
||||
Log.w("kaliber", "Ad loaded.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdFailedToLoad(int errorCode) {
|
||||
Log.w("kaliber", "Ad failed to load. errorCode: " + errorCode);
|
||||
sHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!mInterstitialAd.isLoaded())
|
||||
loadInterstitialAd();
|
||||
}
|
||||
}, 1000 * 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdClosed() {
|
||||
loadInterstitialAd();
|
||||
onShowAdResult(true);
|
||||
}
|
||||
});
|
||||
return interstitialAd;
|
||||
}
|
||||
|
||||
public void showInterstitialAd() {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mInterstitialAd.isLoaded()) {
|
||||
mInterstitialAd.show();
|
||||
if (mInterstitialAd != null) {
|
||||
mInterstitialAd.show(KaliberActivity.this);
|
||||
} else {
|
||||
loadInterstitialAd();
|
||||
onShowAdResult(false);
|
||||
}
|
||||
}
|
||||
|
@ -123,10 +105,49 @@ public class KaliberActivity extends NativeActivity {
|
|||
}
|
||||
|
||||
private void loadInterstitialAd() {
|
||||
if (!mInterstitialAd.isLoading()) {
|
||||
AdRequest adRequest = new AdRequest.Builder()
|
||||
.setRequestAgent("android_studio:ad_template").build();
|
||||
mInterstitialAd.loadAd(adRequest);
|
||||
}
|
||||
AdRequest adRequest = new AdRequest.Builder().build();
|
||||
InterstitialAd.load(this, getString(R.string.interstitial_ad_unit_id), adRequest,
|
||||
new InterstitialAdLoadCallback() {
|
||||
@Override
|
||||
public void onAdLoaded(@NonNull InterstitialAd interstitialAd) {
|
||||
Log.d("kaliber", "Ad loaded.");
|
||||
mInterstitialAd = interstitialAd;
|
||||
interstitialAd.setFullScreenContentCallback(
|
||||
new FullScreenContentCallback() {
|
||||
@Override
|
||||
public void onAdDismissedFullScreenContent() {
|
||||
Log.d("kaliber", "The ad was dismissed.");
|
||||
mInterstitialAd = null;
|
||||
loadInterstitialAd();
|
||||
onShowAdResult(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdFailedToShowFullScreenContent(AdError adError) {
|
||||
Log.d("kaliber", "The ad failed to show.");
|
||||
mInterstitialAd = null;
|
||||
loadInterstitialAd();
|
||||
onShowAdResult(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdShowedFullScreenContent() {
|
||||
Log.d("kaliber", "The ad was shown.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
|
||||
Log.d("kaliber", "Ad failed to load. errorCode: " + loadAdError);
|
||||
mInterstitialAd = null;
|
||||
sHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
loadInterstitialAd();
|
||||
}
|
||||
}, 1000 * 10);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include "IntegerRatio.h"
|
||||
#include "PolyphaseResampler.h"
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include "PolyphaseResamplerMono.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace resampler;
|
||||
|
||||
#define MONO 1
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include "PolyphaseResamplerStereo.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace resampler;
|
||||
|
||||
#define STEREO 2
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include "SincResampler.h"
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include "SincResamplerStereo.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace resampler;
|
||||
|
||||
#define STEREO 2
|
||||
|
|
Loading…
Reference in New Issue