Skip to content

Commit

Permalink
desktop: Hook up DesktopUiBackend::is_fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
Herschel committed Jan 7, 2021
1 parent 6270156 commit cb9bdcd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion desktop/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ fn run_player(opt: Opt) -> Result<(), Box<dyn std::error::Error>> {
)); //TODO: actually implement this backend type
let input = Box::new(input::WinitInputBackend::new(window.clone()));
let storage = Box::new(DiskStorageBackend::new());
let user_interface = Box::new(ui::DesktopUiBackend::new());
let user_interface = Box::new(ui::DesktopUiBackend::new(window.clone()));
let locale = Box::new(locale::DesktopLocaleBackend::new());
let player = Player::new(
renderer,
Expand Down
22 changes: 9 additions & 13 deletions desktop/src/ui.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
use tinyfiledialogs::{message_box_ok, MessageBoxIcon};

use ruffle_core::backend::ui::UiBackend;
use std::rc::Rc;
use tinyfiledialogs::{message_box_ok, MessageBoxIcon};
use winit::window::Window;

pub struct DesktopUiBackend {}
pub struct DesktopUiBackend {
window: Rc<Window>,
}

impl DesktopUiBackend {
pub fn new() -> Self {
Self {}
pub fn new(window: Rc<Window>) -> Self {
Self { window }
}
}

impl UiBackend for DesktopUiBackend {
fn is_fullscreen(&self) -> bool {
// TODO: Return proper value when fullscreen implemented on desktop.
false
self.window.fullscreen().is_some()
}

fn message(&self, message: &str) {
message_box_ok("Ruffle", message, MessageBoxIcon::Info)
}
}

impl Default for DesktopUiBackend {
fn default() -> Self {
DesktopUiBackend::new()
}
}

0 comments on commit cb9bdcd

Please sign in to comment.