You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.4 KiB
68 lines
1.4 KiB
//! RST Node game client
|
|
|
|
// Remove the warning spam
|
|
#![allow(warnings)]
|
|
|
|
#[macro_use]
|
|
extern crate tracing;
|
|
|
|
mod assets;
|
|
mod cli;
|
|
mod color;
|
|
mod constants;
|
|
mod ctx;
|
|
mod editor;
|
|
mod error;
|
|
mod event;
|
|
mod graphics;
|
|
mod input;
|
|
mod log;
|
|
mod settings;
|
|
mod state;
|
|
mod ui;
|
|
mod viewport;
|
|
mod window;
|
|
|
|
pub(crate) use editor::*;
|
|
pub(crate) use event::*;
|
|
#[allow(unused)]
|
|
pub(crate) use settings::{GameSettings, GraphicsSettings, WindowSettings};
|
|
pub(crate) use state::*;
|
|
|
|
#[async_std::main]
|
|
async fn main() {
|
|
// Initialise default game settings
|
|
let mut settings = settings::default();
|
|
|
|
// Parse commandline arguments
|
|
cli::parse(&mut settings);
|
|
|
|
// Initialise logging mechanism
|
|
log::initialise();
|
|
|
|
// Initialise window context
|
|
let mut window = window::create(&settings);
|
|
|
|
// Load assets tree
|
|
let assets =
|
|
assets::load_tree(window.ctx(), &settings).unwrap_or_else(|e| fatal!("LoadError: {}!", e));
|
|
|
|
// Either create client state or editor state
|
|
if settings.editor {
|
|
let state = EditorState::new(settings, assets);
|
|
|
|
// Initialise the viewport first!
|
|
// state.viewport().init(window.ctx());
|
|
|
|
// Window goes brrrr
|
|
window.run(state)
|
|
} else {
|
|
let mut state = ClientState::new(settings, assets);
|
|
|
|
// Initialise the viewport first!
|
|
state.viewport().init(window.ctx());
|
|
|
|
// Window goes brrrr
|
|
window.run(state)
|
|
}
|
|
}
|
|
|