mirror of
https://github.com/JanNeuendorf/SVC16.git
synced 2025-06-04 18:45:27 +00:00
Emulator now prints key-bindings on startup
This commit is contained in:
parent
defac087c7
commit
2a9944038b
16
Cargo.lock
generated
16
Cargo.lock
generated
@ -473,6 +473,15 @@ version = "1.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
||||
|
||||
[[package]]
|
||||
name = "pad"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2ad9b889f1b12e0b9ee24db044b5129150d5eada288edc800f789928dc8c0e3"
|
||||
dependencies = [
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.31"
|
||||
@ -546,6 +555,7 @@ dependencies = [
|
||||
"flate2",
|
||||
"gilrs",
|
||||
"macroquad",
|
||||
"pad",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
@ -592,6 +602,12 @@ version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.2.2"
|
||||
|
@ -12,6 +12,7 @@ clap = { version = "4.5.21", features = ["derive"] }
|
||||
flate2 = "1.0.35"
|
||||
gilrs = { version = "0.11.0",optional=true}
|
||||
macroquad = "0.4.13"
|
||||
pad = "0.1.6"
|
||||
thiserror = "2.0.3"
|
||||
|
||||
[features]
|
||||
|
@ -32,6 +32,7 @@ fn window_conf() -> Conf {
|
||||
#[macroquad::main(window_conf)]
|
||||
async fn main() -> Result<()> {
|
||||
let mut cli = Cli::parse();
|
||||
print_keybinds();
|
||||
|
||||
let mut buffer = [Color::from_rgba(255, 255, 255, 255); 256 * 256];
|
||||
let mut image = Image::gen_image_color(256, 256, Color::from_rgba(0, 0, 0, 255));
|
||||
|
33
src/utils.rs
33
src/utils.rs
@ -4,6 +4,7 @@ use anyhow::Result;
|
||||
use flate2::read::GzDecoder;
|
||||
use macroquad::color::Color;
|
||||
use macroquad::prelude::*;
|
||||
use pad::PadStr;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
const RES: usize = 256;
|
||||
@ -152,3 +153,35 @@ pub fn get_input_code_no_gamepad(layout: &Layout) -> (u16, u16) {
|
||||
|
||||
(pos_code, key_code)
|
||||
}
|
||||
|
||||
pub fn print_keybinds() {
|
||||
let options = vec![
|
||||
("Input A", "Space / Mouse-Left"),
|
||||
("Input B", "B / Mouse-Right"),
|
||||
("Input Up", "Up / W"),
|
||||
("Input Down", "Down / S"),
|
||||
("Input Left", "Left / A"),
|
||||
("Input Right", "Right / D"),
|
||||
("Input Select", "N"),
|
||||
("Input Start", "M"),
|
||||
("Toggle Pause", "P"),
|
||||
("Reload", "R"),
|
||||
("Toggle Cursor", "C"),
|
||||
("Toggle Verbose", "V"),
|
||||
];
|
||||
|
||||
let left_width = options
|
||||
.iter()
|
||||
.map(|(left, _)| left.len())
|
||||
.max()
|
||||
.unwrap_or(0);
|
||||
|
||||
let linewidth = 40;
|
||||
println!("{}", "-".repeat(linewidth));
|
||||
|
||||
for (left, right) in options {
|
||||
let padded_left = left.pad_to_width(left_width);
|
||||
println!("{} --- {}", padded_left, right);
|
||||
}
|
||||
println!("{}", "-".repeat(linewidth));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user