Fixed version issue with Pixels frontend and updated to 0.12

This commit is contained in:
transistor 2023-05-13 15:14:11 -07:00
parent 57f9f93cc9
commit e959b8df1c
5 changed files with 1154 additions and 712 deletions

706
Cargo.lock generated

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,8 +5,8 @@ edition = "2021"
[dependencies]
log = "0.4"
pixels = "0.9"
winit = "0.26"
pixels = "0.12"
winit = "0.28"
moa_core = { path = "../../core" }
moa_common = { path = "../common", features = ["audio"] }
@ -15,12 +15,12 @@ moa_systems_genesis = { path = "../../systems/genesis" }
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1"
console_log = "0.2"
wasm-bindgen = "0.2.78"
console_log = "1.0"
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
web-sys = "0.3"
wgpu = { version = "0.12", features = ["webgl"] }
instant = { version = "0.1", features = [ "stdweb" ] }
wgpu = { version = "0.15", features = ["webgl"] }
instant = { version = "0.1", features = [ "wasm-bindgen" ] }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
env_logger = "0.9"

View File

@ -1,6 +1,4 @@
use std::rc::Rc;
use instant::Instant;
use pixels::{Pixels, SurfaceTexture};
use winit::event::{Event, VirtualKeyCode, WindowEvent, ElementState};
@ -110,7 +108,7 @@ pub async fn run_loop(host: PixelsFrontend) {
pixels.resize_buffer(last_frame.width, last_frame.height);
}
let buffer = pixels.get_frame();
let buffer = pixels.frame_mut();
buffer.copy_from_slice(unsafe { std::slice::from_raw_parts(last_frame.bitmap.as_ptr() as *const u8, last_frame.bitmap.len() * 4) });
}
@ -159,7 +157,7 @@ pub async fn run_loop(host: PixelsFrontend) {
// Check if the run flag is no longer true, and exit the loop
if !settings::get().run {
// Clear the screen
let buffer = pixels.get_frame();
let buffer = pixels.frame_mut();
buffer.iter_mut().for_each(|byte| *byte = 0);
if pixels

View File

@ -150,7 +150,6 @@ pub fn run_system_for(handle: &mut SystemHandle, nanos: u32) -> usize {
pub fn create_window<T>(event_loop: &EventLoop<T>) -> Rc<Window> {
use web_sys::HtmlCanvasElement;
use wasm_bindgen::JsCast;
use winit::platform::web::{WindowExtWebSys, WindowBuilderExtWebSys};
let canvas = web_sys::window()