From 646556de5793d3c935b46b1fee4016eae8275f13 Mon Sep 17 00:00:00 2001 From: alloncm Date: Wed, 5 Oct 2022 23:08:41 +0300 Subject: [PATCH 01/11] Move version and authors to the workspace file --- Cargo.lock | 4 ++-- Cargo.toml | 6 +++++- bcm_host/Cargo.toml | 3 ++- gb/Cargo.toml | 4 ++-- image_inter/Cargo.toml | 3 ++- lib_gb/Cargo.toml | 4 ++-- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2df29634..103ac75b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -33,7 +33,7 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "bcm_host" -version = "1.0.0" +version = "2.2.0" dependencies = [ "cfg-if", "libc", @@ -661,7 +661,7 @@ dependencies = [ [[package]] name = "image_inter" -version = "1.0.0" +version = "2.2.0" dependencies = [ "cc", "criterion", diff --git a/Cargo.toml b/Cargo.toml index 15b4c2fd..f1b0509a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,4 +4,8 @@ members = [ "lib_gb", "image_inter", "bcm_host" -] \ No newline at end of file +] + +[workspace.package] +version = "2.2.0" +authors = ["alloncm "] \ No newline at end of file diff --git a/bcm_host/Cargo.toml b/bcm_host/Cargo.toml index b6d3e615..ffbc54b3 100644 --- a/bcm_host/Cargo.toml +++ b/bcm_host/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "bcm_host" -version = "1.0.0" +version.workspace = true +authors.workspace = true edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/gb/Cargo.toml b/gb/Cargo.toml index 0523f3eb..5c2e7fff 100644 --- a/gb/Cargo.toml +++ b/gb/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "gb" -version = "2.2.0" -authors = ["alloncm "] +version.workspace = true +authors.workspace = true edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/image_inter/Cargo.toml b/image_inter/Cargo.toml index 83986ad9..1d4f6756 100644 --- a/image_inter/Cargo.toml +++ b/image_inter/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "image_inter" -version = "1.0.0" +version.workspace = true +authors.workspace = true edition = "2021" description = "A small crate for the image interpolation, I sperated it cause I wanted to benchmark in properly" diff --git a/lib_gb/Cargo.toml b/lib_gb/Cargo.toml index ac5bb76c..19c55e9f 100644 --- a/lib_gb/Cargo.toml +++ b/lib_gb/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lib_gb" -version = "2.2.0" -authors = ["alloncm "] +version.workspace = true +authors.workspace = true edition = "2018" [dependencies] From 2c90eb29c5cd8520a36cdf7e489be2b7bf57feb3 Mon Sep 17 00:00:00 2001 From: alloncm Date: Thu, 6 Oct 2022 04:27:45 +0300 Subject: [PATCH 02/11] Add ili9341 docs to the readme --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index db0f0a13..a928f500 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,8 @@ Curerently there is no Support (support is planned in the future) - [Nitty gritty Gameboy timing](http://blog.kevtris.org/blogfiles/Nitty%20Gritty%20Gameboy%20VRAM%20Timing.xt) - [mgba gbdoc](https://mgba-emu.github.io/gbdoc/) -### RPI +### RaspberryPi - [Raspberry Pi docs](https://www.raspberrypi.com/documentation/computers/processors.html) - [juj/fbcp-ili9341 as a refference](https://github.com/juj/fbcp-ili9341) -- [Raspberry Pi DMA programming in C](https://iosoft.blog/2020/05/25/raspberry-pi-dma-programming/) \ No newline at end of file +- [Raspberry Pi DMA programming in C](https://iosoft.blog/2020/05/25/raspberry-pi-dma-programming/) +- [Ili9341 docs](https://cdn-shop.adafruit.com/datasheets/ILI9341.pdf) \ No newline at end of file From 37342c2d513b673ba72fc92d31e2c3774ebf5a56 Mon Sep 17 00:00:00 2001 From: alloncm Date: Fri, 7 Oct 2022 01:14:00 +0300 Subject: [PATCH 03/11] Add gui menu with joypad alongside the terminal The terminal menu is activated with the `terminal-menu` feature. Since the terminal menu is more friendly its the defualt for now. --- gb/Cargo.toml | 7 +- gb/src/joypad_menu/font.rs | 294 +++++++++++++++++++++ gb/src/joypad_menu/joypad_gfx_menu.rs | 43 +++ gb/src/joypad_menu/joypad_terminal_menu.rs | 43 +++ gb/src/joypad_menu/mod.rs | 67 +++++ gb/src/joypad_terminal_menu.rs | 126 --------- gb/src/main.rs | 52 ++-- 7 files changed, 479 insertions(+), 153 deletions(-) create mode 100644 gb/src/joypad_menu/font.rs create mode 100644 gb/src/joypad_menu/joypad_gfx_menu.rs create mode 100644 gb/src/joypad_menu/joypad_terminal_menu.rs create mode 100644 gb/src/joypad_menu/mod.rs delete mode 100644 gb/src/joypad_terminal_menu.rs diff --git a/gb/Cargo.toml b/gb/Cargo.toml index 5c2e7fff..a8717ce9 100644 --- a/gb/Cargo.toml +++ b/gb/Cargo.toml @@ -20,13 +20,13 @@ sdl2 = {version = "0.35", optional = true} wav = {version = "1.0", optional = true} crossbeam-channel = "0.5" cfg-if = "1.0" -crossterm = "0.23" +crossterm = {version = "0.23", optional = true} rppal = {version = "0.13", optional = true} libc = {version = "0.2", optional = true} nix = {version = "0.24", optional = true} [features] -default = ["static-sdl", "apu"] +default = ["static-sdl", "apu", "terminal-menu"] sdl = ["sdl2"] sdl-resample = ["apu"] push-audio = ["apu"] @@ -35,4 +35,5 @@ static-scale = ["sdl"] u16pixel = ["lib_gb/u16pixel"] apu = ["lib_gb/apu", "sdl", "wav"] rpi = ["rppal", "u16pixel", "image_inter", "nix/signal"] -mmio = ["rpi", "nix/ioctl", "libc", "bcm_host"] # requires sudo \ No newline at end of file +mmio = ["rpi", "nix/ioctl", "libc", "bcm_host"] # requires sudo +terminal-menu = ["crossterm"] \ No newline at end of file diff --git a/gb/src/joypad_menu/font.rs b/gb/src/joypad_menu/font.rs new file mode 100644 index 00000000..12409151 --- /dev/null +++ b/gb/src/joypad_menu/font.rs @@ -0,0 +1,294 @@ +pub const GLYPH_HEIGHT:usize = 8; +pub const GLYPH_WIDTH:usize = 8; + +const __:bool = false; +const XX:bool = true; + +pub const FONT_LUT:[[bool; GLYPH_HEIGHT * GLYPH_WIDTH]; 26] = [ + // A + [ + __,__,XX,XX,XX,XX,__,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,XX,XX,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,__,__,__,__,__,__,__ + ], + // B + [ + __,XX,XX,XX,XX,XX,__,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,XX,XX,XX,__,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,XX,XX,XX,__,__, + __,__,__,__,__,__,__,__ + ], + // C + [ + __,__,__,XX,XX,XX,XX,__, + __,__,XX,XX,__,__,__,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,__,__,__,__,__, + __,__,XX,XX,__,__,__,__, + __,__,__,XX,XX,XX,XX,__, + __,__,__,__,__,__,__,__ + ], + // D + [ + __,XX,XX,XX,XX,__,__,__, + __,XX,XX,__,XX,XX,__,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,XX,XX,__,__, + __,XX,XX,XX,XX,__,__,__, + __,__,__,__,__,__,__,__ + ], + // E + [ + __,XX,XX,XX,XX,XX,XX,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,XX,XX,__,__,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,XX,XX,XX,XX,__, + __,__,__,__,__,__,__,__ + ], + // F + [ + __,XX,XX,XX,XX,XX,XX,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,XX,XX,__,__,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,__,__,__,__,__, + __,__,__,__,__,__,__,__ + ], + // G + [ + __,__,XX,XX,XX,XX,__,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,__,XX,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,__,XX,XX,XX,XX,XX,__, + __,__,__,__,__,__,__,__ + ], + // H + [ + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,XX,XX,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,__,__,__,__,__,__,__ + ], + // I + [ + __,__,XX,XX,XX,XX,__,__, + __,__,__,XX,XX,__,__,__, + __,__,__,XX,XX,__,__,__, + __,__,__,XX,XX,__,__,__, + __,__,__,XX,XX,__,__,__, + __,__,__,XX,XX,__,__,__, + __,__,XX,XX,XX,XX,__,__, + __,__,__,__,__,__,__,__ + ], + // J + [ + __,__,__,__,__,XX,XX,__, + __,__,__,__,__,XX,XX,__, + __,__,__,__,__,XX,XX,__, + __,__,__,__,__,XX,XX,__, + __,__,__,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,__,XX,XX,XX,XX,__,__, + __,__,__,__,__,__,__,__ + ], + // K + [ + XX,XX,__,__,__,XX,XX,__, + XX,XX,__,__,XX,XX,__,__, + XX,XX,__,XX,XX,__,__,__, + XX,XX,XX,XX,__,__,__,__, + XX,XX,__,XX,XX,__,__,__, + XX,XX,__,__,XX,XX,__,__, + XX,XX,__,__,__,XX,XX,__, + __,__,__,__,__,__,__,__ + ], + // L + [ + __,XX,XX,__,__,__,__,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,XX,XX,XX,XX,__, + __,__,__,__,__,__,__,__ + ], + // M + [ + XX,XX,__,__,__,XX,XX,__, + XX,XX,XX,__,XX,XX,XX,__, + XX,XX,XX,XX,XX,XX,XX,__, + XX,XX,__,XX,__,XX,XX,__, + XX,XX,__,__,__,XX,XX,__, + XX,XX,__,__,__,XX,XX,__, + XX,XX,__,__,__,XX,XX,__, + __,__,__,__,__,__,__,__ + ], + // N + [ + XX,XX,__,__,__,XX,XX,__, + XX,XX,XX,__,__,XX,XX,__, + XX,XX,XX,XX,__,XX,XX,__, + XX,XX,__,XX,XX,XX,XX,__, + XX,XX,__,__,XX,XX,XX,__, + XX,XX,__,__,__,XX,XX,__, + XX,XX,__,__,__,XX,XX,__, + __,__,__,__,__,__,__,__ + ], + // O + [ + __,__,XX,XX,XX,XX,__,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,__,XX,XX,XX,XX,__,__, + __,__,__,__,__,__,__,__ + ], + // P + [ + __,XX,XX,XX,XX,XX,__,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,XX,XX,XX,__,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,__,__,__,__,__, + __,XX,XX,__,__,__,__,__, + __,__,__,__,__,__,__,__ + ], + // Q + [ + __,XX,XX,XX,XX,__,__,__, + XX,XX,__,__,XX,XX,__,__, + XX,XX,__,__,XX,XX,__,__, + XX,XX,__,__,XX,XX,__,__, + XX,XX,__,__,XX,XX,__,__, + XX,XX,__,XX,XX,XX,__,__, + __,XX,XX,XX,XX,XX,XX,__, + __,__,__,__,__,__,__,__ + ], + // R + [ + __,XX,XX,XX,XX,XX,__,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,XX,XX,XX,__,__, + __,XX,XX,__,XX,XX,__,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,__,__,__,__,__,__,__ + ], + // S + [ + __,__,XX,XX,XX,XX,__,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,XX,__,__,__,__, + __,__,XX,XX,XX,XX,__,__, + __,__,__,__,XX,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,__,XX,XX,XX,XX,__,__, + __,__,__,__,__,__,__,__ + ], + // T + [ + __,XX,XX,XX,XX,XX,XX,__, + __,__,__,XX,XX,__,__,__, + __,__,__,XX,XX,__,__,__, + __,__,__,XX,XX,__,__,__, + __,__,__,XX,XX,__,__,__, + __,__,__,XX,XX,__,__,__, + __,__,__,XX,XX,__,__,__, + __,__,__,__,__,__,__,__ + ], + // U + [ + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,__,XX,XX,XX,XX,__,__, + __,__,__,__,__,__,__,__ + ], + // V + [ + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,XX,XX,__,__,XX,XX,__, + __,__,XX,XX,XX,XX,__,__, + __,__,XX,XX,XX,XX,__,__, + __,__,__,XX,XX,__,__,__, + __,__,__,__,__,__,__,__ + ], + // W + [ + XX,XX,__,__,__,XX,XX,__, + XX,XX,__,__,__,XX,XX,__, + XX,XX,__,__,__,XX,XX,__, + XX,XX,__,XX,__,XX,XX,__, + XX,XX,XX,XX,XX,XX,XX,__, + XX,XX,XX,__,XX,XX,XX,__, + XX,XX,__,__,__,XX,XX,__, + __,__,__,__,__,__,__,__ + ], + // X + [ + XX,XX,__,__,__,__,XX,XX, + __,XX,XX,__,__,XX,XX,__, + __,__,XX,XX,XX,XX,__,__, + __,__,__,XX,XX,__,__,__, + __,__,XX,XX,XX,XX,__,__, + __,XX,XX,__,__,XX,XX,__, + XX,XX,__,__,__,__,XX,XX, + __,__,__,__,__,__,__,__ + ], + // Y + [ + XX,XX,__,__,__,__,XX,XX, + __,XX,XX,__,__,XX,XX,__, + __,__,XX,XX,XX,XX,__,__, + __,__,__,XX,XX,__,__,__, + __,__,__,XX,XX,__,__,__, + __,__,__,XX,XX,__,__,__, + __,__,__,XX,XX,__,__,__, + __,__,__,__,__,__,__,__ + ], + // Z + [ + XX,XX,XX,XX,XX,XX,XX,__, + __,__,__,__,XX,XX,__,__, + __,__,__,XX,XX,__,__,__, + __,__,XX,XX,__,__,__,__, + __,XX,XX,__,__,__,__,__, + XX,XX,__,__,__,__,__,__, + XX,XX,XX,XX,XX,XX,XX,__, + __,__,__,__,__,__,__,__ + ] +]; \ No newline at end of file diff --git a/gb/src/joypad_menu/joypad_gfx_menu.rs b/gb/src/joypad_menu/joypad_gfx_menu.rs new file mode 100644 index 00000000..e0390b08 --- /dev/null +++ b/gb/src/joypad_menu/joypad_gfx_menu.rs @@ -0,0 +1,43 @@ +use lib_gb::ppu::{gfx_device::*, gb_ppu::{SCREEN_HEIGHT, SCREEN_WIDTH}, colors::{BLACK, WHITE}}; + +use super::{font::{self, GLYPH_HEIGHT, GLYPH_WIDTH}, MenuRenderer}; + +pub struct GfxDeviceMenuRenderer<'a, GFX:GfxDevice>{ + device:&'a mut GFX +} + +impl<'a, GFX: GfxDevice> GfxDeviceMenuRenderer<'a, GFX> { + pub fn new(device: &'a mut GFX) -> Self { Self { device } } +} + +impl<'a, GFX: GfxDevice, T> MenuRenderer for GfxDeviceMenuRenderer<'a, GFX>{ + fn render_menu(&mut self, menu:&Vec>, selection:usize) { + let mut frame_buffer = [0 as Pixel; SCREEN_HEIGHT * SCREEN_WIDTH]; + let mut frame_buffer_height_index = 0; + for option_index in 0..menu.len(){ + let prompt = &menu[option_index].prompt; + let mut width_index = 0; + for char in prompt.as_bytes(){ + // TODO: add support for non alphabetical chars + if !char.is_ascii_alphabetic(){continue;} + // TODO: add support for lower case alphabetical chars + let char = char.to_ascii_uppercase(); + let glyph = font::FONT_LUT[(char - 'A' as u8) as usize]; + for i in 0..GLYPH_HEIGHT{ + for j in 0..GLYPH_WIDTH{ + let pixel = if selection == option_index{ + Pixel::from(if glyph[i * GLYPH_WIDTH + j] {BLACK}else{WHITE}) + } + else{ + Pixel::from(if glyph[i * GLYPH_WIDTH + j] {WHITE}else{BLACK}) + }; + frame_buffer[(frame_buffer_height_index + i) * SCREEN_WIDTH + width_index + j] = pixel; + } + } + width_index += GLYPH_WIDTH; + } + frame_buffer_height_index += GLYPH_HEIGHT; + } + self.device.swap_buffer(&frame_buffer); + } +} \ No newline at end of file diff --git a/gb/src/joypad_menu/joypad_terminal_menu.rs b/gb/src/joypad_menu/joypad_terminal_menu.rs new file mode 100644 index 00000000..2831e000 --- /dev/null +++ b/gb/src/joypad_menu/joypad_terminal_menu.rs @@ -0,0 +1,43 @@ +use std::{io::Write}; +use crossterm::{QueueableCommand, style::{self, Stylize}, cursor, terminal::{self, ClearType}}; +use super::MenuRenderer; + +cfg_if::cfg_if!{ + if #[cfg(windows)]{ + const LINE_ENDING:&'static str = "\r\n"; + } + else{ + const LINE_ENDING:&'static str = "\n"; + } +} + +pub struct TerminalMenuRenderer; + +impl TerminalMenuRenderer{ + fn clear_screen(&self, menu_len:usize){ + let mut stdout = std::io::stdout(); + stdout.queue(cursor::MoveToPreviousLine(menu_len as u16)).unwrap(); + stdout.queue(terminal::Clear(ClearType::FromCursorDown)).unwrap(); + stdout.flush().unwrap(); + } +} + +impl MenuRenderer for TerminalMenuRenderer{ + fn render_menu(&mut self, menu:&Vec>, selection:usize) { + self.clear_screen(menu.len()); + + let mut stdout = std::io::stdout(); + for i in 0..menu.len(){ + let option = &menu[i]; + if i == selection{ + stdout.queue(style::PrintStyledContent(option.prompt.as_str().on_white().black())).unwrap(); + } + else{ + stdout.queue(style::Print(option.prompt.as_str())).unwrap(); + } + stdout.queue(style::Print(LINE_ENDING)).unwrap(); + } + + stdout.flush().unwrap(); + } +} \ No newline at end of file diff --git a/gb/src/joypad_menu/mod.rs b/gb/src/joypad_menu/mod.rs new file mode 100644 index 00000000..95f1d48a --- /dev/null +++ b/gb/src/joypad_menu/mod.rs @@ -0,0 +1,67 @@ +use lib_gb::keypad::{joypad_provider::JoypadProvider, button::Button, joypad::Joypad}; + +cfg_if::cfg_if!{if #[cfg(feature = "terminal-menu")]{ + pub mod joypad_terminal_menu; +} +else{ + mod font; + pub mod joypad_gfx_menu; +}} + +pub struct MenuOption{ + pub prompt:String, + pub value:T +} + +pub trait MenuRenderer{ + fn render_menu(&mut self, menu:&Vec>, selection:usize); +} + +pub struct JoypadMenu>{ + options: Vec>, + selection: usize, + renderer:MR, +} + +impl> JoypadMenu{ + pub fn new(menu_options:Vec>, renderer:MR)->Self{ + JoypadMenu { + options: menu_options, + selection: 0, + renderer + } + } + + pub fn get_menu_selection(&mut self, provider:&mut JP)->&T{ + let mut joypad = Joypad::default(); + let mut redraw = true; + while !joypad.buttons[Button::A as usize]{ + if redraw{ + self.renderer.render_menu(&self.options, self.selection); + redraw = false; + } + let prev_joypad = Joypad{buttons:joypad.buttons.clone()}; + provider.provide(&mut joypad); + if check_button_down_event(&joypad, &prev_joypad, Button::Up){ + if self.selection > 0{ + self.selection -= 1; + redraw = true; + } + } + if check_button_down_event(&joypad, &prev_joypad, Button::Down){ + if self.selection < self.options.len() - 1{ + self.selection += 1; + redraw = true; + } + } + } + + return &&self.options[self.selection].value; + } +} + +// checking the previous state in order to recognize the inital key down event and not the whole time the button is pressed +fn check_button_down_event(joypad: &Joypad, prev_joypad: &Joypad, button:Button) -> bool { + let button_index = button as usize; + return joypad.buttons[button_index] && !prev_joypad.buttons[button_index]; +} \ No newline at end of file diff --git a/gb/src/joypad_terminal_menu.rs b/gb/src/joypad_terminal_menu.rs deleted file mode 100644 index 4330fc93..00000000 --- a/gb/src/joypad_terminal_menu.rs +++ /dev/null @@ -1,126 +0,0 @@ -use std::{io::Write, time::Duration}; -use lib_gb::keypad::{joypad_provider::JoypadProvider, joypad::Joypad, self, button::Button}; - -use crossterm::{QueueableCommand, style::{self, Stylize}, cursor, terminal::{self, ClearType}, event::{self, KeyCode}}; - -cfg_if::cfg_if!{ - if #[cfg(windows)]{ - const LINE_ENDING:&'static str = "\r\n"; - } - else{ - const LINE_ENDING:&'static str = "\n"; - } -} - -pub struct TerminalRawModeJoypadProviderOption