Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //! Pong Tutorial 1
- use amethyst::{
- prelude::*,
- renderer::{
- plugins::{RenderFlat2D, RenderToWindow},
- types::DefaultBackend,
- RenderingBundle,
- },
- utils::application_root_dir,
- };
- pub struct Pong;
- impl SimpleState for Pong {}
- fn main() -> amethyst::Result<()> {
- amethyst::start_logger(Default::default());
- let app_root = application_root_dir()?;
- let display_config_path = app_root.join("config").join("display.ron");
- let asset_dir = app_root.join("assets");
- let mut world = World::new();
- let game_data = GameDataBuilder::default()
- .with_bundle(
- RenderingBundle::<DefaultBackend>::new()
- // The RenderToWindow plugin provides all the scaffolding for opening a window and drawing on it
- .with_plugin(
- RenderToWindow::from_config_path(display_config_path)
- ?.with_clear([0.0, 0.0, 0.0, 1.0]),
- )
- // RenderFlat2D plugin is used to render entities with a `SpriteRender` component.
- .with_plugin(RenderFlat2D::default()),
- )?;
- let mut game = Application::new(asset_dir, Pong, game_data)?;
- game.run();
- Ok(())
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement