first stage of pong tutorial

This commit is contained in:
brad 2019-04-21 17:29:37 -05:00
commit 991a1c3571
5 changed files with 3214 additions and 0 deletions

16
.gitignore vendored Normal file
View File

@ -0,0 +1,16 @@
# Created by https://www.gitignore.io/api/visualstudiocode
# Edit at https://www.gitignore.io/?templates=visualstudiocode
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
# End of https://www.gitignore.io/api/visualstudiocode

3146
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

8
Cargo.toml Normal file
View File

@ -0,0 +1,8 @@
[package]
name = "rust_pong"
version = "0.1.0"
authors = []
edition = "2018"
[dependencies]
amethyst = "0.10.0"

View File

@ -0,0 +1,10 @@
(
title: "Pong!",
dimensions: Some((500, 500)),
max_dimensions: None,
min_dimensions: None,
fullscreen: false,
multisampling: 0,
visibility: true,
vsync: true,
)

34
src/main.rs Normal file
View File

@ -0,0 +1,34 @@
extern crate amethyst;
use amethyst::prelude::*;
use amethyst::renderer::{DisplayConfig, DrawFlat2D, Event, Pipeline,
RenderBundle, Stage, VirtualKeyCode};
use amethyst::utils::application_root_dir;
pub struct Pong;
impl SimpleState for Pong {
}
fn main() -> amethyst::Result<()> {
amethyst::start_logger(Default::default());
let path = format!("{}/resources/display_config.ron", application_root_dir());
let config = DisplayConfig::load(&path);
let pipe = Pipeline::build()
.with_stage(
Stage::with_backbuffer()
.clear_target([0.00196, 0.23726, 0.21765, 1.0], 1.0)
.with_pass(DrawFlat2D::new()),
);
let game_data = GameDataBuilder::default()
.with_bundle(
RenderBundle::new(pipe, Some(config))
.with_sprite_sheet_processor()
)?;
let mut game = Application::new("./", Pong, game_data)?;
Ok(())
}