diff options
author | Ben Bridle <bridle.benjamin@gmail.com> | 2024-10-29 13:58:19 +1300 |
---|---|---|
committer | Ben Bridle <bridle.benjamin@gmail.com> | 2024-10-29 13:59:44 +1300 |
commit | c42e2154d88c23a28f83fe96f4153e821ef00c0e (patch) | |
tree | 152b75b7077b03065696ea8b6bf670c628cea683 /src | |
parent | 41366dea0ee6702f4cb5f9bc12d62530c46c8c12 (diff) | |
download | bedrock-pc-c42e2154d88c23a28f83fe96f4153e821ef00c0e.zip |
Add option to show mouse cursor
This is to assist with debugging, when a program hasn't yet implemented
its own mouse cursor. Phosphor had to be updated to properly support
this.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/br.rs | 9 | ||||
-rw-r--r-- | src/emulators.rs | 1 | ||||
-rw-r--r-- | src/emulators/graphical_emulator.rs | 2 |
3 files changed, 11 insertions, 1 deletions
diff --git a/src/bin/br.rs b/src/bin/br.rs index ce823d9..bf3befe 100644 --- a/src/bin/br.rs +++ b/src/bin/br.rs @@ -56,6 +56,7 @@ fn main_run(args: Run) { fullscreen: args.fullscreen, scale: args.scale(), debug_palette: args.palette(), + show_cursor: args.show_cursor, initial_transmission: None, decode_stdin: args.decode_stdin, encode_stdout: args.encode_stdout, @@ -66,6 +67,10 @@ fn main_run(args: Run) { verbose!("Starting graphical emulator"); let mut phosphor = phosphor.unwrap(); config.dimensions = args.dimensions().unwrap(); + let cursor = match config.show_cursor { + true => Some(CursorIcon::Default), + false => None, + }; let mut graphical = GraphicalEmulator::new(&config, args.debug); graphical.load_program(&bytecode); @@ -83,8 +88,8 @@ fn main_run(args: Run) { fullscreen: graphical.fullscreen, scale: graphical.scale, title: Some(program_name), + cursor, icon: None, - cursor: None, program: Box::new(graphical), }; @@ -326,6 +331,8 @@ xflags::xflags! { optional -z, --zoom factor: u32 /// Set a debug colour palette in the format <rgb>,... (toggle with F2) optional --palette colours: ParsedPalette + /// Show the operating system cursor over the window + optional --show-cursor /// Decode standard input optional -i, --decode-stdin /// Encode standard output diff --git a/src/emulators.rs b/src/emulators.rs index a2e9091..fcebe1d 100644 --- a/src/emulators.rs +++ b/src/emulators.rs @@ -20,6 +20,7 @@ pub struct EmulatorConfig { pub fullscreen: bool, pub scale: u32, pub debug_palette: Option<[Colour; 16]>, + pub show_cursor: bool, pub initial_transmission: Option<Vec<u8>>, pub decode_stdin: bool, diff --git a/src/emulators/graphical_emulator.rs b/src/emulators/graphical_emulator.rs index 1e048de..a183262 100644 --- a/src/emulators/graphical_emulator.rs +++ b/src/emulators/graphical_emulator.rs @@ -107,6 +107,7 @@ pub struct GraphicalEmulator { pub render_mark: Instant, pub debug_palette: Option<[Colour; 16]>, pub show_debug_palette: bool, + pub show_cursor: bool, } impl GraphicalEmulator { @@ -121,6 +122,7 @@ impl GraphicalEmulator { render_mark: Instant::now(), debug_palette: config.debug_palette, show_debug_palette: config.debug_palette.is_some(), + show_cursor: config.show_cursor, } } |