emulator: start supporting Android, this is WIP
Needs storage permissions, probably extra tweaks
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.dsa.emulator">
|
||||
|
||||
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
|
||||
<!-- <uses-permission android:name="android.permission.INTERNET" /> -->
|
||||
|
||||
<application
|
||||
android:label="DSA Emulator"
|
||||
android:hasCode="false">
|
||||
<activity
|
||||
android:name="android.app.NativeActivity"
|
||||
android:label="DSA Emulator"
|
||||
android:exported="true">
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="dsa_rs" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
+17
-1
@@ -22,7 +22,18 @@ use dsa_rs::emulator::{
|
||||
},
|
||||
};
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
#[cfg(target_os = "android")]
|
||||
use winit::platform::android::activity::AndroidApp;
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
#[no_mangle]
|
||||
fn android_main(app: AndroidApp) {
|
||||
main(app);
|
||||
}
|
||||
|
||||
fn main(
|
||||
#[cfg(target_os = "android")] app: AndroidApp,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Initialize channels and read in configuration.
|
||||
let (cmd_sender, cmd_receiver) = std::sync::mpsc::channel();
|
||||
let (state_sender, state_reciever) = std::sync::mpsc::channel();
|
||||
@@ -39,8 +50,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let ui = setup_ui(cmd_sender, state_reciever);
|
||||
|
||||
// Run UI.
|
||||
#[allow(unused_variables)]
|
||||
let options = eframe::NativeOptions {
|
||||
viewport: egui::ViewportBuilder::default().with_inner_size([800.0, 600.0]),
|
||||
event_loop_builder: Some(Box::new(move |builder| {
|
||||
#[cfg(target_os = "android")]
|
||||
builder.with_android_app(app);
|
||||
})),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user