-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from thombruce/feat/data-from-files
Data from Files
- Loading branch information
Showing
17 changed files
with
266 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
GameConfig( | ||
window_mode: Windowed, // Windowed, Fullscreen, BorderlessFullscreen, SizedFullscreen | ||
master_volume: 1.0, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
([ | ||
( | ||
section_title: "Developed by", | ||
credits: [(credit_title: "Thom Bruce")] | ||
), | ||
( | ||
section_title: "Title Font", | ||
credits: [( | ||
credit_title: "Edge of the Galaxy by Quinn Davis Type", | ||
credit_meta: Some("FontSpace, Public Domain") | ||
)] | ||
), | ||
( | ||
section_title: "Art", | ||
credits: [ | ||
( | ||
credit_title: "Space Shooter Redux by Kenney", | ||
credit_meta: Some("kenney.nl, CC0") | ||
), | ||
( | ||
credit_title: "Ship Mixer by Kenney", | ||
credit_meta: Some("kenney.nl") | ||
), | ||
( | ||
credit_title: "Pixel Planets by Deep-Fold", | ||
credit_meta: Some("itch.io, MIT") | ||
), | ||
( | ||
credit_title: "Xolonium Typeface by Severin Meyer", | ||
credit_meta: Some("Font Library, OFL (SIL Open Font License)") | ||
), | ||
] | ||
), | ||
( | ||
section_title: "Music", | ||
credits: [ | ||
( | ||
credit_title: "Lightspeed by Beat Mekanik", | ||
credit_meta: Some("Free Music Archive, CC BY") | ||
), | ||
( | ||
credit_title: "Space Dust by Kirk Osamayo", | ||
credit_meta: Some("Free Music Archive, CC BY") | ||
), | ||
] | ||
), | ||
( | ||
section_title: "Audio", | ||
credits: [ | ||
( | ||
credit_title: "Impact Sounds by Kenney", | ||
credit_meta: Some("kenney.nl, CC0") | ||
), | ||
] | ||
), | ||
// ( | ||
// section_title: "Become a Supporter", | ||
// credits: [ | ||
// ( | ||
// credit_title: "ko-fi.com/thombruce" | ||
// ), | ||
// ( | ||
// credit_title: "patreon.com/thombruce" | ||
// ), | ||
// ] | ||
// ), | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use bevy::prelude::*; | ||
use bevy::reflect::{TypePath, TypeUuid}; | ||
use bevy::window::WindowMode; | ||
use bevy_common_assets::ron::RonAssetPlugin; | ||
|
||
use super::{assets::DataAssets, state::GameState}; | ||
|
||
pub struct ConfigPlugin; | ||
impl Plugin for ConfigPlugin { | ||
fn build(&self, app: &mut App) { | ||
app.add_plugins(RonAssetPlugin::<GameConfig>::new(&["config.ron"])); | ||
|
||
app.insert_resource(GameConfig { | ||
window_mode: WindowMode::Fullscreen, | ||
master_volume: 1.0, | ||
}); | ||
|
||
app.add_systems(OnExit(GameState::Loading), load_config); | ||
} | ||
} | ||
|
||
#[derive(serde::Deserialize, TypeUuid, TypePath, Resource)] | ||
#[uuid = "bdb624ed-62bc-447f-9f89-f361ed58748c"] | ||
pub struct GameConfig { | ||
pub(crate) window_mode: WindowMode, | ||
pub(crate) master_volume: f32, | ||
} | ||
|
||
fn load_config( | ||
data: Res<DataAssets>, | ||
mut configs: ResMut<Assets<GameConfig>>, | ||
mut game_config: ResMut<GameConfig>, | ||
) { | ||
if let Some(config) = configs.remove(data.config.id()) { | ||
game_config.window_mode = config.window_mode; | ||
game_config.master_volume = config.master_volume; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod assets; | ||
pub mod config; | ||
pub mod despawn_timer; | ||
pub mod game_time; | ||
pub mod state; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.