mirror of
https://github.com/love2d/love-android.git
synced 2026-08-13 17:11:01 +02:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 667c4750ea | |||
| 38727b5c25 | |||
| 288a851a65 | |||
| 5e3579f680 | |||
| 1dd859c9d1 | |||
| 53d45533e0 | |||
| 3f13dc653f |
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="org.love2d.android"
|
||||
android:versionCode="9"
|
||||
android:versionName="0.9.0-alpha9"
|
||||
android:versionCode="10"
|
||||
android:versionName="0.9.0-beta1"
|
||||
android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
|
||||
@@ -27,11 +27,16 @@ Bugs:
|
||||
-----
|
||||
|
||||
Bugs and feature requests should be reported to the [issue
|
||||
tracker](issues?status=new&status=open).
|
||||
tracker](issues).
|
||||
|
||||
Changelog:
|
||||
----------
|
||||
|
||||
beta1:
|
||||
|
||||
* fixed nasty crash on startup bug
|
||||
* fixed love.filesystem.getDirectoryItems()
|
||||
|
||||
alpha9:
|
||||
|
||||
* Packaged games do not get duplicated for loading, instead are loaded from memory (!!!)
|
||||
|
||||
@@ -32,18 +32,22 @@ namespace android
|
||||
|
||||
double getScreenScale()
|
||||
{
|
||||
JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv();
|
||||
static double result = -1.;
|
||||
|
||||
jclass activity = (jclass) SDL_AndroidGetActivity();
|
||||
jmethodID getMetrics = env->GetStaticMethodID(activity, "getMetrics", "()Landroid/util/DisplayMetrics;");
|
||||
jobject metrics = env->CallStaticObjectMethod(activity, getMetrics);
|
||||
jclass metricsClass = env->GetObjectClass(metrics);
|
||||
if (result == -1.) {
|
||||
JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv();
|
||||
jclass activity = env->FindClass("org/love2d/android/GameActivity");
|
||||
|
||||
double result = env->GetFloatField(metrics, env->GetFieldID(metricsClass, "density", "F"));
|
||||
jmethodID getMetrics = env->GetStaticMethodID(activity, "getMetrics", "()Landroid/util/DisplayMetrics;");
|
||||
jobject metrics = env->CallStaticObjectMethod(activity, getMetrics);
|
||||
jclass metricsClass = env->GetObjectClass(metrics);
|
||||
|
||||
env->DeleteLocalRef (metricsClass);
|
||||
env->DeleteLocalRef (metrics);
|
||||
env->DeleteLocalRef (activity);
|
||||
result = env->GetFloatField(metrics, env->GetFieldID(metricsClass, "density", "F"));
|
||||
|
||||
env->DeleteLocalRef (metricsClass);
|
||||
env->DeleteLocalRef (metrics);
|
||||
env->DeleteLocalRef (activity);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ void Filesystem::init(const char *arg0)
|
||||
throw Exception(PHYSFS_getLastError());
|
||||
|
||||
#ifdef LOVE_ANDROID
|
||||
// PHYSFS_permitSymbolicLinks (1);
|
||||
PHYSFS_permitSymbolicLinks (1);
|
||||
#endif
|
||||
|
||||
initialized = true;
|
||||
@@ -229,19 +229,17 @@ bool Filesystem::setIdentity(const char *ident, bool appendToPath)
|
||||
save_path_full += save_path_relative;
|
||||
|
||||
#ifdef LOVE_ANDROID
|
||||
std::string internal_storage_path = SDL_AndroidGetInternalStoragePath();
|
||||
std::string internal_storage_path = SDL_AndroidGetInternalStoragePath();
|
||||
|
||||
std::string save_directory = internal_storage_path + "/save";
|
||||
std::string save_directory = internal_storage_path + "/save";
|
||||
|
||||
save_path_full = std::string(SDL_AndroidGetInternalStoragePath()) + std::string("/save/") + save_identity;
|
||||
|
||||
|
||||
if (androidDirectoryExists (save_path_full.c_str())) {
|
||||
SDL_Log ("dir exists");
|
||||
} else {
|
||||
SDL_Log ("does not exist");
|
||||
}
|
||||
|
||||
if (androidDirectoryExists (save_path_full.c_str())) {
|
||||
SDL_Log ("dir exists");
|
||||
} else {
|
||||
SDL_Log ("does not exist");
|
||||
}
|
||||
|
||||
if (!androidDirectoryExists (save_path_full.c_str())) {
|
||||
if (!androidMkdir (save_path_full.c_str())) {
|
||||
|
||||
@@ -50,6 +50,9 @@ public class SDLActivity extends Activity {
|
||||
//System.loadLibrary("SDL2_net");
|
||||
//System.loadLibrary("SDL2_ttf");
|
||||
System.loadLibrary("gnustl_shared");
|
||||
System.loadLibrary("devil");
|
||||
System.loadLibrary("mpg123");
|
||||
System.loadLibrary("openal");
|
||||
System.loadLibrary("love");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
package org.love2d.android;
|
||||
|
||||
import org.libsdl.app.SDLActivity;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
|
||||
public class GameActivity extends SDLActivity {
|
||||
|
||||
private static DisplayMetrics metrics = new DisplayMetrics();
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
}
|
||||
|
||||
|
||||
public static DisplayMetrics getMetrics() {
|
||||
return metrics;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user