Skip to content

Commit

Permalink
feat(display): Hide the mouse cursor in the presentation window.
Browse files Browse the repository at this point in the history
  • Loading branch information
zedseven committed Jan 17, 2024
1 parent 9648b21 commit 4e1df65
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ fn run_presentation(
let mut renderer = Renderer::new(
&event_loop,
window_builder,
|window| window.set_cursor_visible(false),
font,
foreground_colour,
background_colour,
Expand Down
10 changes: 8 additions & 2 deletions src/renderer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,18 @@ pub struct Renderer<'a> {
}

impl<'a> Renderer<'a> {
pub fn new(
pub fn new<F>(
event_loop: &EventLoop<()>,
window_builder: WindowBuilder,
additional_window_configuration: F,
font: FontArc,
foreground_colour: LinearRgbaColour,
background_colour: LinearRgbaColour,
image_cache: HashMap<&'a String, DynamicImage>,
) -> AnyhowResult<Self> {
) -> AnyhowResult<Self>
where
F: FnOnce(&Window),
{
// I wanted to implement the renderer initialisation myself, but the myriad ways
// to do it without any consistency or documentation led me to just use the same
// approach that the `glyph_brush` examples use. Perhaps this can be revisited
Expand All @@ -137,6 +141,8 @@ impl<'a> Renderer<'a> {
.map_err(|error| anyhow!(error.to_string()))
.with_context(|| "unable to build the window")?;

additional_window_configuration(&window);

let encoder = factory.create_command_buffer().into();

let glyph_brush = GlyphBrushBuilder::using_font(font).build(factory.clone());
Expand Down

0 comments on commit 4e1df65

Please sign in to comment.