upgrade egui

This commit is contained in:
kirjavascript 2023-03-10 22:17:40 +00:00
parent 08f37d6641
commit 72e0ceca2e
7 changed files with 949 additions and 378 deletions

1296
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -18,8 +18,8 @@ emu = { path = "../emu" }
# rfd = "0.8"
# hqx = { git = "https://github.com/CryZe/wasmboy-rs", branch = "master" }
egui = "0.20.1"
eframe = { version = "0.20.1", features = ["persistence"] }
egui = "0.21.0"
eframe = { version = "0.21.0", features = ["persistence"] }
# serde = { version = "1", features = ["derive"] } # You only need this if you want app persistence
# native:

View file

@ -21,5 +21,8 @@ impl Debug {
cpu::cpu_window(&ctx, &emu);
palette::palette_window(&ctx, &emu);
self.vram.render(&ctx, &emu);
}
}

View file

@ -60,7 +60,7 @@ impl VRAM {
"vram",
egui::ColorImage {
size: [WIDTH*8, (end - start) * 8],
pixels: pixels.to_vec(),
pixels,
},
egui::TextureOptions::NEAREST
);

View file

@ -1,27 +1,27 @@
pub fn dummy_input(ctx: &egui::Context, emu: &mut emu::Megadrive) {
let mut value = 0;
if ctx.input().key_down(egui::Key::Enter) {
if ctx.input(|i| i.key_down(egui::Key::Enter)) {
value += emu::io::Gamepad::START;
}
if ctx.input().key_down(egui::Key::W) {
if ctx.input(|i| i.key_down(egui::Key::W)) {
value += emu::io::Gamepad::U;
}
if ctx.input().key_down(egui::Key::S) {
if ctx.input(|i| i.key_down(egui::Key::S)) {
value += emu::io::Gamepad::D;
}
if ctx.input().key_down(egui::Key::A) {
if ctx.input(|i| i.key_down(egui::Key::A)) {
value += emu::io::Gamepad::L;
}
if ctx.input().key_down(egui::Key::D) {
if ctx.input(|i| i.key_down(egui::Key::D)) {
value += emu::io::Gamepad::R;
}
if ctx.input().key_down(egui::Key::J) {
if ctx.input(|i| i.key_down(egui::Key::J)) {
value += emu::io::Gamepad::A;
}
if ctx.input().key_down(egui::Key::K) {
if ctx.input(|i| i.key_down(egui::Key::K)) {
value += emu::io::Gamepad::B;
}
if ctx.input().key_down(egui::Key::L) {
if ctx.input(|i| i.key_down(egui::Key::L)) {
value += emu::io::Gamepad::C;
}

View file

@ -3,7 +3,7 @@
// When compiling natively:
#[cfg(not(target_arch = "wasm32"))]
fn main() {
fn main() -> eframe::Result<()> {
// Log to stdout (if you run with `RUST_LOG=debug`).
tracing_subscriber::fmt::init();
@ -12,5 +12,5 @@ fn main() {
"trueLMAO",
native_options,
Box::new(|cc| Box::new(frontend::App::new(cc))),
);
)
}

View file

@ -12,7 +12,7 @@ pub fn menu<'a>(fullscreen: &'a mut bool, _frame: &'a mut eframe::Frame) ->
ui.menu_button("Window", |ui| {
if ui.button("Auto-arrange").clicked() {
ui.ctx().memory().reset_areas();
ui.ctx().memory_mut(|mem| mem.reset_areas());
ui.close_menu();
}
if ui.button("Fullscreen").clicked() {