mirror of
https://github.com/love2d/love-android.git
synced 2026-08-16 08:11:44 +02:00
Initial work of the game selector.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/love"
|
||||
android:label="LÖVE for Android">
|
||||
<!-- You don't have to change the activity class unless you have special needs! !-->
|
||||
<activity
|
||||
android:name="org.love2d.android.GameActivity"
|
||||
android:exported="true"
|
||||
|
||||
@@ -90,9 +90,10 @@ public class GameActivity extends SDLActivity {
|
||||
}
|
||||
|
||||
currentGameInfo = new GameInfo();
|
||||
Intent intent = getIntent();
|
||||
|
||||
handleIntent(getIntent());
|
||||
super.onCreate(savedInstanceState);
|
||||
handleIntent(intent);
|
||||
|
||||
// Set low-latency audio values
|
||||
nativeSetDefaultStreamValues(getAudioFreq(), getAudioSMP());
|
||||
@@ -105,7 +106,7 @@ public class GameActivity extends SDLActivity {
|
||||
|
||||
if (delayedFd != -1) {
|
||||
// This delayed fd is only sent if an embedded game is present.
|
||||
SDLActivity.onNativeDropFile("love2d://fd/" + delayedFd);
|
||||
sendFileDescriptorAsDroppedFile(delayedFd);
|
||||
delayedFd = -1;
|
||||
}
|
||||
}
|
||||
@@ -302,6 +303,12 @@ public class GameActivity extends SDLActivity {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendFileDescriptorAsDroppedFile(int fd) {
|
||||
if (fd != -1) {
|
||||
SDLActivity.onNativeDropFile("love2d://fd/" + fd);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleIntent(Intent intent) {
|
||||
Uri game = intent.getData();
|
||||
if (game == null) {
|
||||
@@ -321,9 +328,7 @@ public class GameActivity extends SDLActivity {
|
||||
} else {
|
||||
// Game is already running. Send it as dropped file.
|
||||
int fd = convertToFileDescriptor(game);
|
||||
if (fd != -1) {
|
||||
SDLActivity.onNativeDropFile("love2d://fd/" + fd);
|
||||
}
|
||||
sendFileDescriptorAsDroppedFile(fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user