1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2024-11-16 02:43:02 +00:00

Fix warnings from #141

This commit is contained in:
dawnDus 2022-06-30 11:39:56 -04:00
parent 18a7670248
commit 69fdc7d3d2
No known key found for this signature in database
GPG key ID: 972AABDE81848F21
3 changed files with 19 additions and 23 deletions

View file

@ -1,10 +1,8 @@
use crate::framework::context::Context; use crate::framework::context::Context;
use crate::framework::error::GameResult; use crate::framework::error::GameResult;
use crate::framework::filesystem;
use crate::input::combined_menu_controller::CombinedMenuController; use crate::input::combined_menu_controller::CombinedMenuController;
use crate::menu::MenuEntry; use crate::menu::MenuEntry;
use crate::menu::{Menu, MenuSelectionResult}; use crate::menu::{Menu, MenuSelectionResult};
use crate::profile::GameProfile;
use crate::shared_game_state::{PlayerCount, SharedGameState}; use crate::shared_game_state::{PlayerCount, SharedGameState};
pub enum CurrentMenu { pub enum CurrentMenu {
@ -26,7 +24,7 @@ impl PlayerCountMenu {
current_menu: CurrentMenu::CoopMenu, current_menu: CurrentMenu::CoopMenu,
} }
} }
pub fn init(&mut self, state: &mut SharedGameState, ctx: &Context) -> GameResult { pub fn init(&mut self, state: &mut SharedGameState) -> GameResult {
self.coop_menu = Menu::new(0, 0, 130, 0); self.coop_menu = Menu::new(0, 0, 130, 0);
self.skin_menu = Menu::new(0, 0, 130, 0); self.skin_menu = Menu::new(0, 0, 130, 0);
@ -52,14 +50,12 @@ impl PlayerCountMenu {
self.coop_menu.update_width(state); self.coop_menu.update_width(state);
self.coop_menu.update_height(); self.coop_menu.update_height();
self.coop_menu.x = ((state.canvas_size.0 - self.coop_menu.width as f32) / 2.3).floor() as isize; self.coop_menu.x = ((state.canvas_size.0 - self.coop_menu.width as f32) / 2.3).floor() as isize;
self.coop_menu.y = self.coop_menu.y = 30 + ((state.canvas_size.1 - self.coop_menu.height as f32) / 2.0).floor() as isize;
30 + ((state.canvas_size.1 - self.coop_menu.height as f32) / 2.0).floor() as isize;
self.skin_menu.update_width(state); self.skin_menu.update_width(state);
self.skin_menu.update_height(); self.skin_menu.update_height();
self.skin_menu.x = ((state.canvas_size.0 - self.coop_menu.width as f32) / 2.3).floor() as isize; self.skin_menu.x = ((state.canvas_size.0 - self.coop_menu.width as f32) / 2.3).floor() as isize;
self.skin_menu.y = self.skin_menu.y = 30 + ((state.canvas_size.1 - self.coop_menu.height as f32) / 2.0).floor() as isize;
30 + ((state.canvas_size.1 - self.coop_menu.height as f32) / 2.0).floor() as isize;
} }
pub fn tick( pub fn tick(

View file

@ -2,11 +2,11 @@ use crate::framework::context::Context;
use crate::framework::error::GameResult; use crate::framework::error::GameResult;
use crate::framework::filesystem; use crate::framework::filesystem;
use crate::input::combined_menu_controller::CombinedMenuController; use crate::input::combined_menu_controller::CombinedMenuController;
use crate::menu::MenuEntry;
use crate::menu::coop_menu::PlayerCountMenu; use crate::menu::coop_menu::PlayerCountMenu;
use crate::menu::MenuEntry;
use crate::menu::{Menu, MenuSelectionResult}; use crate::menu::{Menu, MenuSelectionResult};
use crate::profile::GameProfile; use crate::profile::GameProfile;
use crate::shared_game_state::{GameDifficulty, PlayerCount, SharedGameState}; use crate::shared_game_state::{GameDifficulty, SharedGameState};
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
pub struct MenuSaveInfo { pub struct MenuSaveInfo {
@ -63,7 +63,7 @@ impl SaveSelectMenu {
pub fn init(&mut self, state: &mut SharedGameState, ctx: &Context) -> GameResult { pub fn init(&mut self, state: &mut SharedGameState, ctx: &Context) -> GameResult {
self.save_menu = Menu::new(0, 0, 230, 0); self.save_menu = Menu::new(0, 0, 230, 0);
self.save_detailed = Menu::new(0, 0, 230, 0); self.save_detailed = Menu::new(0, 0, 230, 0);
self.coop_menu.init(state, ctx)?; self.coop_menu.init(state)?;
self.difficulty_menu = Menu::new(0, 0, 130, 0); self.difficulty_menu = Menu::new(0, 0, 130, 0);
self.delete_confirm = Menu::new(0, 0, 75, 0); self.delete_confirm = Menu::new(0, 0, 75, 0);
self.load_confirm = Menu::new(0, 0, 75, 0); self.load_confirm = Menu::new(0, 0, 75, 0);
@ -212,7 +212,7 @@ impl SaveSelectMenu {
state, state,
ctx, ctx,
)?; )?;
}, }
CurrentMenu::DeleteConfirm => match self.delete_confirm.tick(controller, state) { CurrentMenu::DeleteConfirm => match self.delete_confirm.tick(controller, state) {
MenuSelectionResult::Selected(1, _) => { MenuSelectionResult::Selected(1, _) => {
state.sound_manager.play_sfx(17); // Player Death sfx state.sound_manager.play_sfx(17); // Player Death sfx

View file

@ -8,8 +8,8 @@ use crate::framework::error::GameResult;
use crate::input::combined_menu_controller::CombinedMenuController; use crate::input::combined_menu_controller::CombinedMenuController;
use crate::input::touch_controls::TouchControlType; use crate::input::touch_controls::TouchControlType;
use crate::map::Map; use crate::map::Map;
use crate::menu::save_select_menu::SaveSelectMenu;
use crate::menu::coop_menu::PlayerCountMenu; use crate::menu::coop_menu::PlayerCountMenu;
use crate::menu::save_select_menu::SaveSelectMenu;
use crate::menu::settings_menu::SettingsMenu; use crate::menu::settings_menu::SettingsMenu;
use crate::menu::{Menu, MenuEntry, MenuSelectionResult}; use crate::menu::{Menu, MenuEntry, MenuSelectionResult};
use crate::scene::jukebox_scene::JukeboxScene; use crate::scene::jukebox_scene::JukeboxScene;
@ -175,7 +175,7 @@ impl Scene for TitleScene {
self.save_select_menu.init(state, ctx)?; self.save_select_menu.init(state, ctx)?;
self.coop_menu.init(state, ctx)?; self.coop_menu.init(state)?;
let mut selected: usize = 0; let mut selected: usize = 0;
let mut mutate_selection = true; let mut mutate_selection = true;
@ -357,7 +357,7 @@ impl Scene for TitleScene {
self.current_menu = CurrentMenu::ChallengesMenu; self.current_menu = CurrentMenu::ChallengesMenu;
} }
_ => (), _ => (),
} },
CurrentMenu::PlayerCountMenu => { CurrentMenu::PlayerCountMenu => {
let cm = &mut self.current_menu; let cm = &mut self.current_menu;
let rm = CurrentMenu::ChallengeConfirmMenu; let rm = CurrentMenu::ChallengeConfirmMenu;
@ -369,7 +369,7 @@ impl Scene for TitleScene {
state, state,
ctx, ctx,
)?; )?;
}, }
} }
self.confirm_menu.update_width(state); self.confirm_menu.update_width(state);