summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Bridle <bridle.benjamin@gmail.com>2024-10-29 13:58:19 +1300
committerBen Bridle <bridle.benjamin@gmail.com>2024-10-29 13:59:44 +1300
commitc42e2154d88c23a28f83fe96f4153e821ef00c0e (patch)
tree152b75b7077b03065696ea8b6bf670c628cea683
parent41366dea0ee6702f4cb5f9bc12d62530c46c8c12 (diff)
downloadbedrock-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.
-rw-r--r--Cargo.lock4
-rw-r--r--Cargo.toml2
-rw-r--r--src/bin/br.rs9
-rw-r--r--src/emulators.rs1
-rw-r--r--src/emulators/graphical_emulator.rs2
5 files changed, 14 insertions, 4 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 2fddb8a..0b35118 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -889,8 +889,8 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "phosphor"
-version = "3.0.0"
-source = "git+git://benbridle.com/phosphor?tag=v3.0.0#47a754a7beb8741bfe0469236036cb8023043cd8"
+version = "3.1.0"
+source = "git+git://benbridle.com/phosphor?tag=v3.1.0#f69c4065488f792a51641a126ba58ec541819f22"
dependencies = [
"buffer",
"event_queue",
diff --git a/Cargo.toml b/Cargo.toml
index fd5cc08..f65ef48 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,7 +8,7 @@ description = "Emulator for running Bedrock programs"
[dependencies]
bedrock-asm = { git = "git://benbridle.com/bedrock_asm", tag = "v4.0.0" }
bedrock-core = { git = "git://benbridle.com/bedrock_core", tag = "v5.0.0" }
-phosphor = { git = "git://benbridle.com/phosphor", tag = "v3.0.0" }
+phosphor = { git = "git://benbridle.com/phosphor", tag = "v3.1.0" }
geometry = { git = "git://benbridle.com/geometry", tag = "v1.0.0" }
time = { version = "0.3.30", features = [ "local-offset" ] }
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,
}
}