Created
February 27, 2018 23:56
-
-
Save AnneKitsune/9b2596d00feb802de171437c4ac33810 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
[package] | |
name = "amethyst" | |
version = "0.6.0" | |
authors = ["Eyal Kalderon <[email protected]>"] | |
description = "Data-oriented game engine written in Rust" | |
exclude = ["examples/*", "book/*"] | |
keywords = ["game", "engine", "sdk", "amethyst"] | |
categories = ["game-engines"] | |
documentation = "https://www.amethyst.rs/doc/master/doc/amethyst" | |
homepage = "https://www.amethyst.rs/" | |
repository = "https://github.com/amethyst/amethyst" | |
readme = "README.md" | |
license = "MIT/Apache-2.0" | |
[badges] | |
appveyor = { repository = "amethyst/amethyst", branch = "develop" } | |
travis-ci = { repository = "amethyst/amethyst", branch = "develop" } | |
[features] | |
profiler = ["thread_profiler/thread_profiler"] | |
gfx-vulkan = ["gfx-backend-vulkan"] | |
[dependencies] | |
amethyst_assets = { path = "amethyst_assets", version = "0.2.0" } | |
amethyst_audio = { path = "amethyst_audio", version = "0.1.0" } | |
amethyst_config = { path = "amethyst_config", version = "0.5.0" } | |
amethyst_core = { path = "amethyst_core", version = "0.1.0" } | |
amethyst_renderer = { path = "amethyst_renderer", version = "0.6" } | |
amethyst_input = { path = "amethyst_input", version = "0.2" } | |
amethyst_ui = { path = "amethyst_ui", version = "0.1" } | |
amethyst_utils = { path = "amethyst_utils", version = "0.1" } | |
derivative = "1.0" | |
fern = "0.5" | |
log = "0.4" | |
rayon = "0.8" | |
rustc_version_runtime = "0.1" | |
shred = "0.5" | |
shrev = "0.8" | |
specs = "0.10" | |
winit = "0.10" | |
amethyst_hal = { path = "amethyst_hal", version = "0.1",feature="gfx-vulkan"} | |
[target.'cfg(not(target_os = "macos"))'.dependencies] | |
gfx-backend-vulkan = { version = "0.1", optional = true, git = "https://github.com/gfx-rs/gfx", rev = "68e80eaf"} | |
thread_profiler = { version = "0.1", optional = true } | |
[dev-dependencies] | |
amethyst_gltf = { path = "amethyst_gltf", version = "0.1" } | |
genmesh = "0.4" | |
amethyst_animation = { path = "amethyst_animation", version = "0.1.0" } | |
serde = "1.0" | |
serde_derive = "1.0" | |
[build-dependencies] | |
vergen = "0.1" | |
[[example]] | |
name = "hello_world" | |
path = "examples/hello_world/main.rs" | |
[[example]] | |
name = "window" | |
path = "examples/window/main.rs" | |
[[example]] | |
name = "sphere" | |
path = "examples/sphere/main.rs" | |
[[example]] | |
name = "renderable" | |
path = "examples/renderable/main.rs" | |
[[example]] | |
name = "pong" | |
path = "examples/pong/main.rs" | |
[[example]] | |
name = "asset_loading" | |
path = "examples/asset_loading/main.rs" | |
[[example]] | |
name = "material" | |
path = "examples/material/main.rs" | |
[[example]] | |
name = "separate_sphere" | |
path = "examples/separate_sphere/main.rs" | |
[[example]] | |
name = "gltf" | |
path = "examples/gltf/main.rs" | |
[[example]] | |
name = "ui" | |
path = "examples/ui/main.rs" | |
[[example]] | |
name = "animation" | |
path = "examples/animation/main.rs" | |
[[example]] | |
name = "pong_tutorial_01" | |
path = "examples/pong_tutorial_01/main.rs" | |
[[example]] | |
name = "pong_tutorial_02" | |
path = "examples/pong_tutorial_02/main.rs" | |
[[example]] | |
name = "appendix_a" | |
path = "examples/appendix_a/main.rs" | |
[workspace] | |
#[patch.'https://github.com/omni-viral/xfg-rs'] | |
#xfg = { path = "../xfg-rs" } | |
#[patch.'https://github.com/gfx-rs/gfx'] | |
#gfx-hal = { path = "../gfx/src/hal" } | |
#gfx-backend-metal = { path = "../gfx/src/backend/metal" } | |
#gfx-backend-empty = { path = "../gfx/src/backend/empty" } |
This file contains hidden or 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
//! TODO: Rewrite for new renderer. | |
extern crate amethyst; | |
extern crate gfx_backend_vulkan as back; | |
mod pong; | |
mod systems; | |
mod bundle; | |
mod audio; | |
use std::time::Duration; | |
use amethyst::Result; | |
use amethyst::audio::AudioBundle; | |
use amethyst::core::frame_limiter::FrameRateLimitStrategy; | |
use amethyst::core::transform::TransformBundle; | |
use amethyst::ecs::{Component, DenseVecStorage}; | |
use amethyst::input::InputBundle; | |
use amethyst::prelude::*; | |
use amethyst::hal::*; | |
use amethyst::ui::{DrawUi, UiBundle}; | |
use std::marker::PhantomData; | |
use audio::Music; | |
use bundle::PongBundle; | |
const ARENA_HEIGHT: f32 = 100.0; | |
const ARENA_WIDTH: f32 = 100.0; | |
const PADDLE_HEIGHT: f32 = 15.0; | |
const PADDLE_WIDTH: f32 = 2.5; | |
const PADDLE_VELOCITY: f32 = 75.0; | |
const PADDLE_COLOUR: [f32; 4] = [0.0, 0.0, 1.0, 1.0]; | |
const BALL_VELOCITY_X: f32 = 75.0; | |
const BALL_VELOCITY_Y: f32 = 50.0; | |
const BALL_RADIUS: f32 = 2.5; | |
const BALL_COLOUR: [f32; 4] = [1.0, 0.0, 0.0, 1.0]; | |
const AUDIO_MUSIC: &'static [&'static str] = &[ | |
"audio/Computer_Music_All-Stars_-_Wheres_My_Jetpack.ogg", | |
"audio/Computer_Music_All-Stars_-_Albatross_v2.ogg", | |
]; | |
const AUDIO_BOUNCE: &'static str = "audio/bounce.ogg"; | |
const AUDIO_SCORE: &'static str = "audio/score.ogg"; | |
fn main() { | |
if let Err(e) = run() { | |
println!("Failed to execute example: {}", e); | |
::std::process::exit(1); | |
} | |
} | |
fn run() -> Result<()> { | |
use pong::Pong; | |
let display_config_path = format!( | |
"{}/examples/pong/resources/display.ron", | |
env!("CARGO_MANIFEST_DIR") | |
); | |
let key_bindings_path = format!( | |
"{}/examples/pong/resources/input.ron", | |
env!("CARGO_MANIFEST_DIR") | |
); | |
let assets_dir = format!("{}/examples/assets/", env!("CARGO_MANIFEST_DIR")); | |
let mut game = Application::build(assets_dir, Pong)? | |
.with_frame_limit( | |
FrameRateLimitStrategy::SleepAndYield(Duration::from_millis(2)), | |
144, | |
) | |
.with_bundle( | |
InputBundle::<String, String>::new().with_bindings_from_file(&key_bindings_path), | |
)? | |
.with_bundle(PongBundle)? | |
.with_bundle(TransformBundle::new().with_dep(&["ball_system", "paddle_system"]))? | |
.with_bundle(AudioBundle::new(|music: &mut Music| music.music.next()))? | |
.with_bundle(UiBundle::new())? | |
.with_bundle(RenderBundle::<back::Backend>{ | |
queues: 2, | |
pd: PhantomData, | |
})? | |
.build()?; | |
game.run(); | |
Ok(()) | |
} | |
pub struct Ball { | |
pub velocity: [f32; 2], | |
pub radius: f32, | |
} | |
impl Component for Ball { | |
type Storage = DenseVecStorage<Self>; | |
} | |
#[derive(PartialEq, Eq)] | |
pub enum Side { | |
Left, | |
Right, | |
} | |
pub struct Paddle { | |
pub velocity: f32, | |
pub side: Side, | |
pub width: f32, | |
pub height: f32, | |
} | |
impl Paddle { | |
pub fn new(side: Side) -> Paddle { | |
Paddle { | |
velocity: 1.0, | |
side: side, | |
width: 1.0, | |
height: 1.0, | |
} | |
} | |
} | |
impl Component for Paddle { | |
type Storage = DenseVecStorage<Self>; | |
} | |
pub struct ScoreBoard { | |
score_left: i32, | |
score_right: i32, | |
} | |
impl ScoreBoard { | |
pub fn new() -> ScoreBoard { | |
ScoreBoard { | |
score_left: 0, | |
score_right: 0, | |
} | |
} | |
} |
This file contains hidden or 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
//! 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://www.amethyst.rs/book/ | |
//! | |
//! This project is a work in progress and is very incomplete. Pardon the dust! | |
//! | |
//! # Example | |
//! | |
//! ```rust,no_run | |
//! extern crate amethyst; | |
//! | |
//! use amethyst::prelude::*; | |
//! use amethyst::renderer::{Event, KeyboardInput, VirtualKeyCode, WindowEvent}; | |
//! | |
//! struct GameState; | |
//! | |
//! impl State for GameState { | |
//! fn on_start(&mut self, _: &mut World) { | |
//! println!("Starting game!"); | |
//! } | |
//! | |
//! fn handle_event(&mut self, _: &mut World, event: Event) -> Trans { | |
//! match event { | |
//! Event::WindowEvent { event, .. } => match event { | |
//! WindowEvent::KeyboardInput { | |
//! input: KeyboardInput { virtual_keycode: Some(VirtualKeyCode::Escape), .. }, .. | |
//! } | | |
//! WindowEvent::Closed => Trans::Quit, | |
//! _ => Trans::None, | |
//! }, | |
//! _ => Trans::None, | |
//! } | |
//! } | |
//! | |
//! fn update(&mut self, _: &mut World) -> Trans { | |
//! println!("Computing some more whoop-ass..."); | |
//! Trans::Quit | |
//! } | |
//! } | |
//! | |
//! fn main() { | |
//! let mut game = Application::new("assets/", GameState).expect("Fatal error"); | |
//! game.run(); | |
//! } | |
//! ``` | |
#![deny(missing_docs)] | |
#![doc(html_logo_url = "https://tinyurl.com/jtmm43a")] | |
#[macro_use] | |
#[cfg(feature = "profiler")] | |
pub extern crate thread_profiler; | |
pub extern crate amethyst_assets as assets; | |
pub extern crate amethyst_audio as audio; | |
pub extern crate amethyst_config as config; | |
pub extern crate amethyst_core as core; | |
pub extern crate amethyst_input as input; | |
pub extern crate amethyst_renderer as renderer; | |
pub extern crate amethyst_ui as ui; | |
pub extern crate amethyst_utils as utils; | |
pub extern crate shred; | |
pub extern crate shrev; | |
pub extern crate specs as ecs; | |
pub extern crate winit; | |
pub extern crate amethyst_hal as hal; | |
#[macro_use] | |
extern crate derivative; | |
extern crate fern; | |
#[macro_use] | |
extern crate log; | |
extern crate rayon; | |
extern crate rustc_version_runtime; | |
pub use self::app::{Application, ApplicationBuilder}; | |
pub use self::error::{Error, Result}; | |
pub use self::state::{State, StateMachine, Trans}; | |
pub mod prelude; | |
mod app; | |
mod error; | |
mod state; | |
mod vergen; | |
mod bundle; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment