mirror of
https://github.com/ruffle-rs/ruffle-android.git
synced 2024-11-23 05:39:38 +00:00
native: Remove custom resize method, rely on event loop (for now?)
This commit is contained in:
parent
dd1b8882b2
commit
a4ab39340c
@ -71,8 +71,6 @@ public class FullscreenNativeActivity extends GameActivity {
|
||||
private native void keydown(byte key_code, char key_char);
|
||||
private native void keyup(byte key_code, char key_char);
|
||||
|
||||
private native void resized();
|
||||
|
||||
private native void requestContextMenu();
|
||||
private native void runContextMenuCallback(int index);
|
||||
private native void clearContextMenu();
|
||||
@ -182,10 +180,6 @@ public class FullscreenNativeActivity extends GameActivity {
|
||||
layout.requestFocus();
|
||||
this.mSurfaceView.getHolder().addCallback(this);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(this.mSurfaceView, this);
|
||||
|
||||
this.mSurfaceView.addOnLayoutChangeListener((vw, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
|
||||
resized();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,7 +1,6 @@
|
||||
//! Custom event type for Ruffle on Android
|
||||
|
||||
use ruffle_core::events::KeyCode;
|
||||
use ruffle_core::ViewportDimensions;
|
||||
|
||||
/// User-defined events.
|
||||
#[derive(Debug)]
|
||||
@ -15,6 +14,5 @@ pub enum RuffleEvent {
|
||||
},
|
||||
RunContextMenuCallback(usize),
|
||||
ClearContextMenu,
|
||||
Resize(ViewportDimensions),
|
||||
RequestContextMenu,
|
||||
}
|
||||
|
@ -367,12 +367,6 @@ fn run(app: AndroidApp) {
|
||||
|
||||
match receiver.try_recv() {
|
||||
Err(_) => {}
|
||||
Ok(RuffleEvent::Resize(size)) => {
|
||||
if let Some(player) = playerbox.as_ref() {
|
||||
player.player.lock().unwrap().set_viewport_dimensions(size);
|
||||
needs_redraw = true;
|
||||
}
|
||||
}
|
||||
Ok(RuffleEvent::TaskPoll) => {
|
||||
if let Some(player) = playerbox.as_ref() {
|
||||
player
|
||||
@ -524,26 +518,6 @@ pub unsafe extern "C" fn Java_rs_ruffle_FullscreenNativeActivity_keyup(
|
||||
});
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
#[allow(clippy::missing_safety_doc)]
|
||||
pub unsafe extern "C" fn Java_rs_ruffle_FullscreenNativeActivity_resized(
|
||||
mut env: JNIEnv,
|
||||
this: JObject,
|
||||
) {
|
||||
let event_loop: MutexGuard<Sender<RuffleEvent>> =
|
||||
env.get_rust_field(this, "eventLoopHandle").unwrap();
|
||||
let size = get_view_size();
|
||||
if let Ok((w, h)) = size {
|
||||
let viewport_scale_factor = 1.0; //window.scale_factor();
|
||||
let _ = event_loop.send(RuffleEvent::Resize(ViewportDimensions {
|
||||
width: w as u32,
|
||||
height: h as u32,
|
||||
scale_factor: viewport_scale_factor,
|
||||
}));
|
||||
}
|
||||
log::warn!("resized!");
|
||||
}
|
||||
|
||||
pub fn get_jvm<'a>() -> Result<(jni::JavaVM, JObject<'a>), Box<dyn std::error::Error>> {
|
||||
// Create a VM for executing Java calls
|
||||
let context = ndk_context::android_context();
|
||||
|
Loading…
Reference in New Issue
Block a user