fix weird shit

This commit is contained in:
Alex Janka 2023-03-24 13:01:39 +11:00
parent 8bdae98992
commit cc27d9eb17

View file

@ -31,6 +31,8 @@ impl Emulator {
} }
const EXTRA_SCALE: usize = 3; const EXTRA_SCALE: usize = 3;
const S_WIDTH: usize = WIDTH * EXTRA_SCALE;
const S_HEIGHT: usize = HEIGHT * EXTRA_SCALE;
impl Editor for Emulator { impl Editor for Emulator {
fn spawn( fn spawn(
@ -40,12 +42,25 @@ impl Editor for Emulator {
) -> Box<dyn std::any::Any + Send> { ) -> Box<dyn std::any::Any + Send> {
let fr_cloned = self.frame_receiver.clone(); let fr_cloned = self.frame_receiver.clone();
let js_cloned = self.joypad_sender.clone(); let js_cloned = self.joypad_sender.clone();
let (size, scale) = if cfg!(target_os = "macos") {
(
Size::new(S_WIDTH as f64, S_HEIGHT as f64),
baseview::WindowScalePolicy::SystemScaleFactor,
)
} else {
(
Size::new(WIDTH as f64, HEIGHT as f64),
baseview::WindowScalePolicy::ScaleFactor(EXTRA_SCALE as f64),
)
};
Window::open_parented( Window::open_parented(
&parent, &parent,
WindowOpenOptions { WindowOpenOptions {
title: String::from("gb-emu"), title: String::from("gb-emu"),
size: Size::new((WIDTH * EXTRA_SCALE) as f64, (HEIGHT * EXTRA_SCALE) as f64), size,
scale: baseview::WindowScalePolicy::SystemScaleFactor, scale,
gl_config: None, gl_config: None,
}, },
|w| EmulatorWindow::new(w, fr_cloned, js_cloned), |w| EmulatorWindow::new(w, fr_cloned, js_cloned),
@ -85,7 +100,10 @@ impl EmulatorWindow {
frame_receiver: Arc<FrameReceiver>, frame_receiver: Arc<FrameReceiver>,
joypad_sender: Arc<JoypadSender>, joypad_sender: Arc<JoypadSender>,
) -> Self { ) -> Self {
let info = WindowInfo::from_logical_size(Size::new(WIDTH as f64, HEIGHT as f64), 1.); let info = WindowInfo::from_logical_size(
Size::new(WIDTH as f64, HEIGHT as f64),
EXTRA_SCALE as f64,
);
let (pix, scale, scaled_buf) = init_pixbuf(info, window); let (pix, scale, scaled_buf) = init_pixbuf(info, window);