- File Changes
- .gitignore
- assets/bardo.png
- assets/darkdimension.png
- assets/reaper.png
- Cargo.toml
- src/main.rs
- assets
-
src
- main.rs
- .gitignore
- Cargo.toml
BIN
(Deleted)
assets.zip
Binary file not shown.
+1
-0
Cargo.toml
| 1 | 1 |
|
| 2 | 2 |
|
| 3 | 3 |
|
| 4 | 4 |
|
| 5 | 5 |
|
| 6 | 6 |
|
| 7 | 7 |
|
| 8 |
|
+42
-2
src/main.rs
| 1 |
|
|
| 2 |
|
|
| 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 |
|
|
| 3 | 43 |
|
BIN
(Deleted)
assets.zip
Binary file not shown.
+1
-0
Cargo.toml
| 1 |
|
1 |
|
| 2 |
|
2 |
|
| 3 |
|
3 |
|
| 4 |
|
4 |
|
| 5 |
|
5 |
|
| 6 |
|
6 |
|
| 7 |
|
7 |
|
| 8 |
|
+42
-2
src/main.rs
| 1 |
|
1 |
|
| 2 |
|
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 |
|
||
| 3 |
|
43 |
|
/target**/*.rs.bk
[package]name = "game-tutorial"version = "0.1.0"authors = ["Sunjay Varma <[email protected]>"]edition = "2018"[dependencies]sdl2 = "0.32.1"
use sdl2::pixels::Color;use sdl2::event::Event;use sdl2::keyboard::Keycode;use std::time::Duration;fn main() -> Result<(), String> {let sdl_context = sdl2::init()?;let video_subsystem = sdl_context.video()?;let window = video_subsystem.window("rust-sdl2 demo", 800, 600).position_centered().build().expect("could not initialize video subsystem");let mut canvas = window.into_canvas().build().expect("could not make a canvas");canvas.set_draw_color(Color::RGB(0, 255, 255));canvas.clear();canvas.present();let mut event_pump = sdl_context.event_pump()?;let mut i = 0;'running: loop {i = (i + 1) % 255;canvas.set_draw_color(Color::RGB(i, 64, 255 - i));canvas.clear();for event in event_pump.poll_iter() {match event {Event::Quit {..} |Event::KeyDown { keycode: Some(Keycode::Escape), .. } => {break 'running;},_ => {}}}// The rest of the game loop goes here...canvas.present();::std::thread::sleep(Duration::new(0, 1_000_000_000u32 / 60));}Ok(())}