framereceiver type
This commit is contained in:
parent
532f602e77
commit
43d88de1f2
|
@ -25,9 +25,11 @@ struct EmuVars {
|
|||
#[derive(Default)]
|
||||
pub struct GameboyEmu {
|
||||
vars: Option<EmuVars>,
|
||||
frame_receiver: Arc<Mutex<Option<Receiver<Vec<[u8; 4]>>>>>,
|
||||
frame_receiver: Arc<FrameReceiver>,
|
||||
}
|
||||
|
||||
type FrameReceiver = Mutex<Option<Receiver<Vec<[u8; 4]>>>>;
|
||||
|
||||
const ROM: &[u8; 32768] = include_bytes!("../../test-roms/Tetris.gb");
|
||||
|
||||
impl Plugin for GameboyEmu {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::sync::{
|
||||
mpsc::{self, Receiver, Sender},
|
||||
Arc, Mutex,
|
||||
Arc,
|
||||
};
|
||||
|
||||
use baseview::{
|
||||
|
@ -13,12 +13,14 @@ use gb_emu_lib::{
|
|||
use nih_plug::prelude::*;
|
||||
use pixels::{Pixels, SurfaceTexture};
|
||||
|
||||
use crate::FrameReceiver;
|
||||
|
||||
pub struct Emulator {
|
||||
frame_receiver: Arc<Mutex<Option<Receiver<Vec<[u8; 4]>>>>>,
|
||||
frame_receiver: Arc<FrameReceiver>,
|
||||
}
|
||||
|
||||
impl Emulator {
|
||||
pub fn new(frame_receiver: Arc<Mutex<Option<Receiver<Vec<[u8; 4]>>>>>) -> Self {
|
||||
pub fn new(frame_receiver: Arc<FrameReceiver>) -> Self {
|
||||
Self { frame_receiver }
|
||||
}
|
||||
}
|
||||
|
@ -61,14 +63,11 @@ impl Editor for Emulator {
|
|||
pub struct EmulatorWindow {
|
||||
pix: Pixels,
|
||||
scale: usize,
|
||||
frame_receiver: Arc<Mutex<Option<Receiver<Vec<[u8; 4]>>>>>,
|
||||
frame_receiver: Arc<FrameReceiver>,
|
||||
}
|
||||
|
||||
impl EmulatorWindow {
|
||||
fn new(
|
||||
window: &mut Window,
|
||||
frame_receiver: Arc<Mutex<Option<Receiver<Vec<[u8; 4]>>>>>,
|
||||
) -> Self {
|
||||
fn new(window: &mut Window, frame_receiver: Arc<FrameReceiver>) -> Self {
|
||||
let info = WindowInfo::from_logical_size(Size::new(WIDTH as f64, HEIGHT as f64), 1.);
|
||||
|
||||
let (pix, scale) = init_pixbuf(info, window);
|
||||
|
|
Loading…
Reference in a new issue