forked from amethyst/amethyst
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.rs
118 lines (111 loc) · 3.69 KB
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//! Amethyst is a free and open source game engine written in idiomatic
//! [Rust][rs] for building video games and interactive multimedia applications.
//! The source code is available for download on [GitHub][gh]. See the
//! [online book][bk] for a complete guide to using Amethyst.
//!
//! [rs]: https://www.rust-lang.org/
//! [gh]: https://github.com/amethyst/amethyst
//! [bk]: https://book.amethyst.rs/master/
//!
//! This project is a work in progress and is very incomplete. Pardon the dust!
//!
//! # Example
//!
//! ```rust,no_run
//! use amethyst::prelude::*;
//! use amethyst::winit::{Event, KeyboardInput, VirtualKeyCode, WindowEvent};
//!
//! struct GameState;
//!
//! impl SimpleState for GameState {
//! fn on_start(&mut self, _: StateData<'_, GameData<'_, '_>>) {
//! println!("Starting game!");
//! }
//!
//! fn handle_event(&mut self, _: StateData<'_, GameData<'_, '_>>, event: StateEvent) -> SimpleTrans {
//! if let StateEvent::Window(event) = &event {
//! match event {
//! Event::WindowEvent { event, .. } => match event {
//! WindowEvent::KeyboardInput {
//! input: KeyboardInput { virtual_keycode: Some(VirtualKeyCode::Escape), .. }, ..
//! } |
//! WindowEvent::CloseRequested => Trans::Quit,
//! _ => Trans::None,
//! },
//! _ => Trans::None,
//! }
//! } else {
//! Trans::None
//! }
//! }
//!
//! fn update(&mut self, _: &mut StateData<'_, GameData<'_, '_>>) -> SimpleTrans {
//! println!("Computing some more whoop-ass...");
//! Trans::Quit
//! }
//! }
//!
//! fn main() -> amethyst::Result<()> {
//! let assets_dir = "assets/";
//! let mut game = Application::new(assets_dir, GameState, GameDataBuilder::default())?;
//! game.run();
//! Ok(())
//! }
//! ```
#![doc(html_logo_url = "https://amethyst.rs/brand/logo-standard.svg")]
#![warn(
missing_debug_implementations,
missing_docs,
rust_2018_idioms,
rust_2018_compatibility
)]
#![warn(clippy::all)]
#![allow(clippy::new_without_default)]
#[cfg(feature = "animation")]
pub use amethyst_animation as animation;
pub use amethyst_assets as assets;
#[cfg(feature = "audio")]
pub use amethyst_audio as audio;
pub use amethyst_config as config;
pub use amethyst_controls as controls;
pub use amethyst_core as core;
pub use amethyst_derive as derive;
pub use amethyst_error as error;
#[cfg(feature = "gltf")]
pub use amethyst_gltf as gltf;
pub use amethyst_input as input;
#[cfg(feature = "locale")]
pub use amethyst_locale as locale;
#[cfg(feature = "network")]
pub use amethyst_network as network;
pub use amethyst_rendy as renderer;
#[cfg(feature = "tiles")]
pub use amethyst_tiles as tiles;
pub use amethyst_ui as ui;
pub use amethyst_utils as utils;
pub use amethyst_window as window;
pub use winit;
pub use crate::core::{ecs, shred, shrev};
#[doc(hidden)]
pub use crate::derive::*;
pub use self::{
app::{Application, ApplicationBuilder, CoreApplication},
callback_queue::{Callback, CallbackQueue},
error::Error,
game_data::{DataDispose, DataInit, GameData, GameDataBuilder},
logger::{start_logger, LevelFilter as LogLevelFilter, Logger, LoggerConfig, StdoutLog},
state::{
EmptyState, EmptyTrans, SimpleState, SimpleTrans, State, StateData, StateMachine, Trans,
TransEvent,
},
state_event::{StateEvent, StateEventReader},
};
/// Convenience alias for use in main functions that uses Amethyst.
pub type Result<T> = std::result::Result<T, error::Error>;
pub mod prelude;
mod app;
mod callback_queue;
mod game_data;
mod logger;
mod state;
mod state_event;