mirror of
https://github.com/neogeek23/rust_pong.git
synced 2026-02-04 02:48:17 +00:00
first stage of pong tutorial
This commit is contained in:
commit
991a1c3571
16
.gitignore
vendored
Normal file
16
.gitignore
vendored
Normal 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
3146
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
8
Cargo.toml
Normal file
8
Cargo.toml
Normal file
@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "rust_pong"
|
||||
version = "0.1.0"
|
||||
authors = []
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
amethyst = "0.10.0"
|
||||
10
resources/display_config.ron
Normal file
10
resources/display_config.ron
Normal 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
34
src/main.rs
Normal 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(())
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user