forked from xenia-project/xenia
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI] android.app.NativeActivity > WindowedAppActivity + code style
- Loading branch information
Showing
10 changed files
with
377 additions
and
106 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
12 changes: 0 additions & 12 deletions
12
android/android_studio_project/app/src/main/java/jp/xenia/emulator/DemoActivity.java
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
android/android_studio_project/app/src/main/java/jp/xenia/emulator/WindowDemoActivity.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,8 @@ | ||
package jp.xenia.emulator; | ||
|
||
public class WindowDemoActivity extends WindowedAppActivity { | ||
@Override | ||
protected String getWindowedAppIdentifier() { | ||
return "xenia_ui_window_vulkan_demo"; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
android/android_studio_project/app/src/main/java/jp/xenia/emulator/WindowedAppActivity.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,45 @@ | ||
package jp.xenia.emulator; | ||
|
||
import android.app.Activity; | ||
import android.content.res.AssetManager; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
|
||
public abstract class WindowedAppActivity extends Activity { | ||
private static final String TAG = "WindowedAppActivity"; | ||
|
||
static { | ||
// TODO(Triang3l): Move all demos to libxenia.so. | ||
System.loadLibrary("xenia-ui-window-vulkan-demo"); | ||
} | ||
|
||
private long mAppContext; | ||
|
||
private native long initializeWindowedAppOnCreateNative( | ||
String windowedAppIdentifier, AssetManager assetManager); | ||
|
||
private native void onDestroyNative(long appContext); | ||
|
||
protected abstract String getWindowedAppIdentifier(); | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
mAppContext = initializeWindowedAppOnCreateNative(getWindowedAppIdentifier(), getAssets()); | ||
if (mAppContext == 0) { | ||
Log.e(TAG, "Error initializing the windowed app"); | ||
finish(); | ||
return; | ||
} | ||
} | ||
|
||
@Override | ||
protected void onDestroy() { | ||
if (mAppContext != 0) { | ||
onDestroyNative(mAppContext); | ||
} | ||
mAppContext = 0; | ||
super.onDestroy(); | ||
} | ||
} |
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,25 @@ | ||
/** | ||
****************************************************************************** | ||
* Xenia : Xbox 360 Emulator Research Project * | ||
****************************************************************************** | ||
* Copyright 2021 Ben Vanik. All rights reserved. * | ||
* Released under the BSD license - see LICENSE in the root for more details. * | ||
****************************************************************************** | ||
*/ | ||
|
||
#include "xenia/ui/windowed_app.h" | ||
|
||
#include <string> | ||
#include <unordered_map> | ||
|
||
namespace xe { | ||
namespace ui { | ||
|
||
#if XE_UI_WINDOWED_APPS_IN_LIBRARY | ||
// A zero-initialized pointer to remove dependence on the initialization order | ||
// of the map relatively to the app creator proxies. | ||
std::unordered_map<std::string, WindowedApp::Creator>* WindowedApp::creators_; | ||
#endif // XE_UI_WINDOWED_APPS_IN_LIBRARY | ||
|
||
} // namespace ui | ||
} // namespace xe |
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
Oops, something went wrong.