Skip to content

fix: Add type annotation to Sessions create_with() calls #1050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ use bones_framework::debug::frame_time_diagnostics_plugin;
use bones_framework::networking::debug::network_debug_window;

pub fn game_plugin(game: &mut Game) {
game.sessions.create_with(SessionNames::DEBUG, |builder| {
builder
.install_plugin(session_plugin)
.install_plugin(frame_time_diagnostics_plugin);
});
game.sessions
.create_with(SessionNames::DEBUG, |builder: &mut SessionBuilder| {
builder
.install_plugin(session_plugin)
.install_plugin(frame_time_diagnostics_plugin);
});
}

fn session_plugin(session: &mut SessionBuilder) {
Expand Down
19 changes: 11 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ fn main() {
// Create a new session for the pause menu, which sits in the background by default and only
// does anything while the game is running.
game.sessions
.create_with(SessionNames::PAUSE_MENU, |builder| {
.create_with(SessionNames::PAUSE_MENU, |builder: &mut SessionBuilder| {
builder.install_plugin(ui::pause_menu::session_plugin);
});

Expand All @@ -184,16 +184,19 @@ fn main() {
.unwrap()
.priority = 1;

// Scoring menu plugin, activated by game between round tarnsitions when appropriate
game.sessions.create_with(SessionNames::SCORING, |builder| {
builder.install_plugin(ui::scoring::session_plugin);
});
// Scoring menu plugin, activated by game between round transitions when appropriate
game.sessions
.create_with(SessionNames::SCORING, |builder: &mut SessionBuilder| {
builder.install_plugin(ui::scoring::session_plugin);
});

// session for pop-ups / nofication UI
game.sessions
.create_with(SessionNames::NOTIFICATION, |builder| {
game.sessions.create_with(
SessionNames::NOTIFICATION,
|builder: &mut SessionBuilder| {
builder.install_plugin(ui::notification::session_plugin);
});
},
);

// Create a bevy renderer for the bones game and run it.
BonesBevyRenderer {
Expand Down
2 changes: 1 addition & 1 deletion src/profiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::prelude::*;
pub fn game_plugin(game: &mut Game) {
game.systems.add_before_system(mark_new_frame);
game.sessions
.create_with(SessionNames::PROFILER, |builder| {
.create_with(SessionNames::PROFILER, |builder: &mut SessionBuilder| {
builder.install_plugin(session_plugin);
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/sessions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub trait SessionExt {

impl SessionExt for Sessions {
fn start_menu(&mut self) {
self.create_with(SessionNames::MAIN_MENU, |builder| {
self.create_with(SessionNames::MAIN_MENU, |builder: &mut SessionBuilder| {
builder.install_plugin(crate::ui::main_menu::session_plugin);
});
}
Expand Down Expand Up @@ -74,7 +74,7 @@ impl SessionExt for Sessions {
score
};

self.create_with(SessionNames::GAME, |builder| {
self.create_with(SessionNames::GAME, |builder: &mut SessionBuilder| {
builder.install_plugin(crate::core::MatchPlugin {
maps: map_pool,
player_info,
Expand All @@ -89,7 +89,7 @@ impl SessionExt for Sessions {
}

fn start_game(&mut self, match_plugin: crate::core::MatchPlugin) {
self.create_with(SessionNames::GAME, |builder| {
self.create_with(SessionNames::GAME, |builder: &mut SessionBuilder| {
builder.install_plugin(match_plugin);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/pause_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ fn pause_menu_system(
.deref()
.clone();
sessions.end_game();
sessions.create_with(SessionNames::GAME, |builder| {
sessions.create_with(SessionNames::GAME, |builder: &mut SessionBuilder| {
builder.install_plugin(crate::core::MatchPlugin {
maps,
player_info: std::array::from_fn(|i| PlayerInput {
Expand Down
Loading