Skip to content

Commit

Permalink
Reorganize according to amethyst#191, minor reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ebkalderon committed Aug 2, 2017
1 parent a66fb05 commit c115c3d
Show file tree
Hide file tree
Showing 45 changed files with 1,037 additions and 99 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ before_script:

# Format the codebase, generate documentation, compile the engine, run tests.
script: |
# cargo fmt -- --write-mode=diff &&
cargo local-pkgs doc --no-deps -v &&
cargo local-pkgs build -v &&
# Build and test without profiler
Expand Down
45 changes: 4 additions & 41 deletions amethyst_config/examples/main.rs
Original file line number Diff line number Diff line change
@@ -1,52 +1,15 @@

#[macro_use]
extern crate amethyst_config;

use amethyst_config::Config;

config! {
#[derive(Debug)]
pub struct DisplayConfig {
pub title: String = "Amethyst game".to_string(),
pub brightness: f64 = 1.0,
pub fullscreen: bool = false,
pub dimensions: (u16, u16) = (1024, 768),
pub min_dimensions: Option<(u16, u16)> = None,
pub max_dimensions: Option<(u16, u16)> = None,
pub vsync: bool = true,
pub multisampling: u16 = 0,
pub visibility: bool = true,
}
}

config! {
#[derive(Debug)]
pub struct LoggingConfig {
pub file_path: String = "new_project.log".to_string(),
pub output_level: String = "warn".to_string(),
pub logging_level: String = "debug".to_string(),
}
}

config! {
#[derive(Debug)]
pub struct ExampleConfig {
/// Configuration for display and graphics
pub display: DisplayConfig = DisplayConfig::default(),
/// Configuration for output
pub logging: LoggingConfig = LoggingConfig::default(),
}
}
use amethyst_config::{Config, Element};

fn main() {
let path = format!("{}/examples/config.yml", env!("CARGO_MANIFEST_DIR"));
let res = ExampleConfig::load_no_fallback(&path);
let res = Config::from_file("../../config/config.yml");

match res {
Ok(cfg) => {
println!("{:#?}", cfg);
println!("{}", cfg.to_string());

if let Err(e) = cfg.write(&path) {
if let Err(e) = cfg.write_file() {
println!("{}", e);
}
},
Expand Down
Loading

0 comments on commit c115c3d

Please sign in to comment.