Start submodule to impl the "Get ready" spinner
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
pub mod config;
|
pub mod config;
|
||||||
|
mod preparation_widget;
|
||||||
mod title_screen;
|
mod title_screen;
|
||||||
|
|
||||||
use crate::config::{BACKGROUND_COLOR, PLAYER_SHIP_COLOR, SHIP_ROTATION, SHIP_THRUST, WINDOW_SIZE};
|
use crate::config::{BACKGROUND_COLOR, PLAYER_SHIP_COLOR, SHIP_ROTATION, SHIP_THRUST, WINDOW_SIZE};
|
||||||
@@ -13,7 +14,7 @@ pub struct AsteroidPlugin;
|
|||||||
|
|
||||||
impl Plugin for AsteroidPlugin {
|
impl Plugin for AsteroidPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_plugins(title_screen::GameMenuPlugin)
|
app.add_plugins((title_screen::GameMenuPlugin, preparation_widget::preparation_widget_plugin))
|
||||||
.insert_resource(ClearColor(BACKGROUND_COLOR))
|
.insert_resource(ClearColor(BACKGROUND_COLOR))
|
||||||
.insert_resource(WorldSize {
|
.insert_resource(WorldSize {
|
||||||
width: WINDOW_SIZE.x,
|
width: WINDOW_SIZE.x,
|
||||||
|
|||||||
33
src/preparation_widget.rs
Normal file
33
src/preparation_widget.rs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
use bevy::prelude::*;
|
||||||
|
|
||||||
|
use crate::GameState;
|
||||||
|
|
||||||
|
pub fn preparation_widget_plugin(app: &mut App) {
|
||||||
|
app.add_systems(OnEnter(GameState::GetReady), spawn_get_ready)
|
||||||
|
.add_systems(OnExit(GameState::GetReady), despawn_get_ready)
|
||||||
|
.add_systems(Update, (animate_get_ready_widget).run_if(in_state(GameState::GetReady)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Marker component for things on the get-ready indicator
|
||||||
|
#[derive(Component)]
|
||||||
|
struct OnReadySetGo;
|
||||||
|
|
||||||
|
/// Newtype wrapper for `Timer`. Used to count down during the "get ready" phase.
|
||||||
|
#[derive(Component)]
|
||||||
|
struct ReadySetGoTimer(Timer);
|
||||||
|
|
||||||
|
fn spawn_get_ready(
|
||||||
|
mut commands: Commands,
|
||||||
|
){
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn despawn_get_ready(
|
||||||
|
mut commands: Commands,
|
||||||
|
){
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn animate_get_ready_widget(){
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user