commit 571f65e9a0863d974cf12f447174aa8981be2ce3 Author: gallant Date: Fri May 20 19:29:16 2022 -0500 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..bd464fe --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,73 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cat-box" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24bda0d6fb9dc5a286c9afe6286b1de1f3fe7175310b4b0c2c34174fccafbd19" +dependencies = [ + "sdl2", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" + +[[package]] +name = "practice_game" +version = "0.1.0" +dependencies = [ + "cat-box", + "sdl2", +] + +[[package]] +name = "sdl2" +version = "0.35.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7959277b623f1fb9e04aea73686c3ca52f01b2145f8ea16f4ff30d8b7623b1a" +dependencies = [ + "bitflags", + "lazy_static", + "libc", + "sdl2-sys", +] + +[[package]] +name = "sdl2-sys" +version = "0.35.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3586be2cf6c0a8099a79a12b4084357aa9b3e0b0d7980e3b67aaf7a9d55f9f0" +dependencies = [ + "cfg-if", + "libc", + "version-compare", +] + +[[package]] +name = "version-compare" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe88247b92c1df6b6de80ddc290f3976dbdf2f5f5d3fd049a9fb598c6dd5ca73" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..434492c --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "practice_game" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +cat-box = "0.1.6" +sdl2 = "0.35.2" \ No newline at end of file diff --git a/runner_0.png b/runner_0.png new file mode 100644 index 0000000..867346c Binary files /dev/null and b/runner_0.png differ diff --git a/runner_1.png b/runner_1.png new file mode 100644 index 0000000..476047d Binary files /dev/null and b/runner_1.png differ diff --git a/runner_s.png b/runner_s.png new file mode 100644 index 0000000..22228a3 Binary files /dev/null and b/runner_s.png differ diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..089fa9b --- /dev/null +++ b/src/main.rs @@ -0,0 +1,27 @@ +use cat_box::{draw_text, Game, Sprite, SpriteCollection}; +use std::{thread, time}; + +fn main() { + let game = Game::new("Running", 500, 500); + + //main sprite introductions + let mut i = 255u8; + let mut running = SpriteCollection::new(); + let mut run1 = Sprite::new("runner_0.png", 250, 250).unwrap(); + let mut run2 = Sprite::new("runner_1.png", 250, 250).unwrap(); + let mut stand = Sprite::new("runner_s.png", 250, 250).unwrap(); + running.push(run1); + //sleeper agent + let sleep = thread::sleep; + //main game loop + game.run(|ctx|{ + if i<200{ + i = i + 10; + }else if i >= 255{ + i=200; + } + ctx.set_background_colour( 129, 201, i); + running.draw(ctx).unwrap(); + + }).unwrap(); +}