Prepare for migration to iced

This commit is contained in:
John 2023-03-29 23:37:12 -05:00
parent b7c3e3113d
commit 9195d439e3
4 changed files with 1920 additions and 28 deletions

1918
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@ license = "MIT"
[features] [features]
default = ["unstable"] default = ["unstable"]
unstable = [] unstable = []
iced = ["dep:iced"]
rhexdump = ["dep:rhexdump"] rhexdump = ["dep:rhexdump"]
serde = ["dep:serde"] serde = ["dep:serde"]
@ -26,6 +27,7 @@ overflow-checks = false
[dependencies] [dependencies]
gumdrop = "^0.8.1" gumdrop = "^0.8.1"
iced = {version = "0.8.0", optional = true}
minifb = { version = "^0.24.0", features = ["wayland"] } minifb = { version = "^0.24.0", features = ["wayland"] }
owo-colors = "^3" owo-colors = "^3"
rand = "^0.8.5" rand = "^0.8.5"

26
src/bin/chirp-iced.rs Normal file
View File

@ -0,0 +1,26 @@
#![allow(unused_imports)]
use chirp::prelude::*;
#[cfg(features = "iced")]
use iced::{
executor, time, window, Alignment, Application, Command, Element, Length, Settings,
Subscription,
};
#[cfg(features = "iced")]
fn main() -> iced::Result {
Ok(())
}
#[cfg(not(features = "iced"))]
fn main() -> Result<()> {
Ok(())
}
/// TODO: `impl Application for Emulator {}`
#[derive(Clone, Debug, Default, PartialEq)]
struct Emulator {
mem: Bus,
cpu: CPU,
fps: f64,
ipf: usize,
}

View File

@ -91,7 +91,7 @@ impl State {
ch8: Chip8 { ch8: Chip8 {
bus: bus! { bus: bus! {
// Load the charset into ROM // Load the charset into ROM
Charset [0x0050..0x00A0] = include_bytes!("mem/charset.bin"), Charset [0x0050..0x00A0] = include_bytes!("../mem/charset.bin"),
// Load the ROM file into RAM // Load the ROM file into RAM
Program [0x0200..0x1000] = &read(&options.file)?, Program [0x0200..0x1000] = &read(&options.file)?,
// Create a screen // Create a screen