diff --git a/.gitmodules b/.gitmodules index 08b8ce25..a25d66a8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,3 @@ [submodule "raylib-sys/raylib"] path = raylib-sys/raylib url = https://github.com/raysan5/raylib - branch = "5.0" diff --git a/Cargo.toml b/Cargo.toml index 8b9afcf3..978c0e2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,3 @@ [workspace] members = ["raylib", "raylib-sys"] -exclude = ["raylib-test"] +exclude = ["raylib-test", "samples"] diff --git a/README.md b/README.md index 8a666eb0..602a788e 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ # raylib-rs -raylib-rs is a Rust binding for [raylib](http://www.raylib.com/) 5.0. It currently targets the _stable_ Rust toolchain, version 1.77 or higher. +raylib-rs is a Rust binding for [raylib](http://www.raylib.com/) 5.0. It currently targets the _stable_ Rust toolchain, version 1.78 or higher. Please checkout the showcase directory to find usage examples! diff --git a/raylib-sys/Cargo.toml b/raylib-sys/Cargo.toml index 714fcc25..ec764e76 100644 --- a/raylib-sys/Cargo.toml +++ b/raylib-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "raylib-sys" -version = "5.0.0" +version = "5.0.1" authors = ["DeltaPHC "] license = "Zlib" description = "Raw FFI bindings for Raylib" diff --git a/raylib-test/Cargo.toml b/raylib-test/Cargo.toml index 206650b0..14fe4b17 100644 --- a/raylib-test/Cargo.toml +++ b/raylib-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "raylib-test" -version = "5.0.0" +version = "5.0.1" authors = ["David Ayeke"] edition = "2018" license = "Zlib" diff --git a/raylib/Cargo.toml b/raylib/Cargo.toml index 36b46b3c..3a5cb773 100644 --- a/raylib/Cargo.toml +++ b/raylib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "raylib" -version = "5.0.0" +version = "5.0.1" authors = ["DeltaPHC "] license = "Zlib" readme = "../README.md" diff --git a/samples/.gitignore b/samples/.gitignore new file mode 100644 index 00000000..ea8c4bf7 --- /dev/null +++ b/samples/.gitignore @@ -0,0 +1 @@ +/target diff --git a/samples/3d_camera_first_person.rs b/samples/3d_camera_first_person.rs index cd980036..bf603232 100644 --- a/samples/3d_camera_first_person.rs +++ b/samples/3d_camera_first_person.rs @@ -14,13 +14,13 @@ struct Column { impl Column { fn create_random() -> Column { let mut rng = rand::thread_rng(); - let height: f32 = rng.gen_range(1.0..12.0); + let height: f32 = rng.gen_range(1.0, 12.0); let position = Vector3::new( - rng.gen_range(-15.0..15.0), + rng.gen_range(-15.0, 15.0), height / 2.0, - rng.gen_range(-15.0..15.0), + rng.gen_range(-15.0, 15.0), ); - let color = Color::new(rng.gen_range(20..255), rng.gen_range(10..55), 30, 255); + let color = Color::new(rng.gen_range(20, 255), rng.gen_range(10, 55), 30, 255); Column { height, diff --git a/samples/Cargo.toml b/samples/Cargo.toml index fc2ea0a1..03e18c9f 100644 --- a/samples/Cargo.toml +++ b/samples/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "raylib-examples" -version = "3.7.0" +version = "5.0.1" authors = ["David Ayeke"] edition = "2018" license = "Zlib" @@ -9,11 +9,11 @@ repository = "https://github.com/raylib-rs/raylib-rs" [dependencies] -raylib = { version = "3.7", path = "../raylib" } +raylib = { version = "5.0", path = "../raylib" } structopt = "0.2" specs-derive = "0.4.1" rand = "0.7" -tcod = "0.15" +#tcod = "0.14" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" arr_macro = "0.1.3" @@ -64,10 +64,6 @@ path = "./texture.rs" name = "yaw_pitch_roll" path = "yaw_pitch_roll.rs" -[[bin]] -name = "roguelike" -path = "roguelike.rs" - [[bin]] name = "input" path = "input.rs" diff --git a/samples/raymarch.rs b/samples/raymarch.rs index 6241ca5d..c2a272a9 100644 --- a/samples/raymarch.rs +++ b/samples/raymarch.rs @@ -4,7 +4,7 @@ use structopt::StructOpt; mod options; -const SHADER: &str = include_str!("../../static/raymarching.fs"); +const SHADER: &str = include_str!("static/raymarching.fs"); pub fn main() { let opt = options::Opt::from_args(); diff --git a/samples/roguelike.rs b/samples/roguelike.rs index 72bd286d..7d19852b 100644 --- a/samples/roguelike.rs +++ b/samples/roguelike.rs @@ -1,3 +1,7 @@ +/** + * 2024 NOTE: this is currently disabled because tcod is considered a broken crate. + */ + /// Code almost verbatim from here: http://tomassedovic.github.io/roguelike-tutorial/index.html /// This only covers up to Part 9 because I'm a human being who needs sleep. Feel free to submit a /// PR to extend it. @@ -589,10 +593,10 @@ fn make_map(objects: &mut Vec, level: u32) -> Map { let mut rooms = vec![]; for _ in 0..MAX_ROOMS { - let w = rand::thread_rng().gen_range(ROOM_MIN_SIZE..ROOM_MAX_SIZE + 1); - let h = rand::thread_rng().gen_range(ROOM_MIN_SIZE..ROOM_MAX_SIZE + 1); - let x = rand::thread_rng().gen_range(0..MAP_WIDTH - w); - let y = rand::thread_rng().gen_range(0..MAP_HEIGHT - h); + let w = rand::thread_rng().gen_range::(ROOM_MIN_SIZE..ROOM_MAX_SIZE + 1); + let h = rand::thread_rng().gen_range::(ROOM_MIN_SIZE..ROOM_MAX_SIZE + 1); + let x = rand::thread_rng().gen_range::(0..MAP_WIDTH - w); + let y = rand::thread_rng().gen_range::(0..MAP_HEIGHT - h); let new_room = Rectangle::new(x as f32, y as f32, w as f32, h as f32); let failed = rooms @@ -646,11 +650,11 @@ fn place_objects(room: Rectangle, map: &Map, objects: &mut Vec, level: u ); // choose random number of monsters - let num_monsters = rand::thread_rng().gen_range(0..max_monsters + 1); + let num_monsters = rand::thread_rng().gen_range::(0..max_monsters + 1); for _ in 0..num_monsters { - let x = rand::thread_rng().gen_range(room.x + 1.0..room.x + room.width) as i32; - let y = rand::thread_rng().gen_range(room.y + 1.0..room.y + room.height) as i32; + let x = rand::thread_rng().gen_range::(room.x + 1.0..room.x + room.width) as i32; + let y = rand::thread_rng().gen_range::(room.y + 1.0..room.y + room.height) as i32; // monster random table let troll_chance = from_dungeon_level( @@ -767,11 +771,13 @@ fn place_objects(room: Rectangle, map: &Map, objects: &mut Vec, level: u ]; // choose random number of items - let num_items = rand::thread_rng().gen_range(0..max_items + 1); + let num_items = rand::thread_rng().gen_range::(0..max_items + 1); for _ in 0..num_items { // choose random spot for this item - let x = rand::thread_rng().gen_range(room.x as i32 + 1..(room.x + room.width) as i32); - let y = rand::thread_rng().gen_range(room.y as i32 + 1..(room.y + room.height) as i32); + let x = + rand::thread_rng().gen_range::(room.x as i32 + 1..(room.x + room.width) as i32); + let y = + rand::thread_rng().gen_range::(room.y as i32 + 1..(room.y + room.height) as i32); // only place it if the tile is not blocked if !is_blocked(x, y, map, objects) { @@ -1411,8 +1417,8 @@ fn ai_confused( // move in a random direction, and decrease the number of turns confused move_by( monster_id, - rand::thread_rng().gen_range(-1..2), - rand::thread_rng().gen_range(-1..2), + rand::thread_rng().gen_range::(-1..2), + rand::thread_rng().gen_range::(-1..2), &game.map, objects, ); diff --git a/raylib/static/alagard.png b/samples/static/alagard.png similarity index 100% rename from raylib/static/alagard.png rename to samples/static/alagard.png diff --git a/raylib/static/angle_gauge.png b/samples/static/angle_gauge.png similarity index 100% rename from raylib/static/angle_gauge.png rename to samples/static/angle_gauge.png diff --git a/raylib/static/background.png b/samples/static/background.png similarity index 100% rename from raylib/static/background.png rename to samples/static/background.png diff --git a/raylib/static/billboard.png b/samples/static/billboard.png similarity index 100% rename from raylib/static/billboard.png rename to samples/static/billboard.png diff --git a/raylib/static/exists.txt b/samples/static/exists.txt similarity index 100% rename from raylib/static/exists.txt rename to samples/static/exists.txt diff --git a/raylib/static/guy/guy.blend b/samples/static/guy/guy.blend similarity index 100% rename from raylib/static/guy/guy.blend rename to samples/static/guy/guy.blend diff --git a/raylib/static/guy/guy.iqm b/samples/static/guy/guy.iqm similarity index 100% rename from raylib/static/guy/guy.iqm rename to samples/static/guy/guy.iqm diff --git a/raylib/static/guy/guyanim.iqm b/samples/static/guy/guyanim.iqm similarity index 100% rename from raylib/static/guy/guyanim.iqm rename to samples/static/guy/guyanim.iqm diff --git a/raylib/static/guy/guytex.png b/samples/static/guy/guytex.png similarity index 100% rename from raylib/static/guy/guytex.png rename to samples/static/guy/guytex.png diff --git a/raylib/static/logo.png b/samples/static/logo.png similarity index 100% rename from raylib/static/logo.png rename to samples/static/logo.png diff --git a/raylib/static/menu_background.png b/samples/static/menu_background.png similarity index 100% rename from raylib/static/menu_background.png rename to samples/static/menu_background.png diff --git a/raylib/static/model_shader/grayscale.fs b/samples/static/model_shader/grayscale.fs similarity index 100% rename from raylib/static/model_shader/grayscale.fs rename to samples/static/model_shader/grayscale.fs diff --git a/raylib/static/model_shader/watermill.obj b/samples/static/model_shader/watermill.obj similarity index 100% rename from raylib/static/model_shader/watermill.obj rename to samples/static/model_shader/watermill.obj diff --git a/raylib/static/model_shader/watermill_diffuse.png b/samples/static/model_shader/watermill_diffuse.png similarity index 100% rename from raylib/static/model_shader/watermill_diffuse.png rename to samples/static/model_shader/watermill_diffuse.png diff --git a/raylib/static/pbr/trooper.obj b/samples/static/pbr/trooper.obj similarity index 100% rename from raylib/static/pbr/trooper.obj rename to samples/static/pbr/trooper.obj diff --git a/raylib/static/pbr/trooper_albedo.png b/samples/static/pbr/trooper_albedo.png similarity index 100% rename from raylib/static/pbr/trooper_albedo.png rename to samples/static/pbr/trooper_albedo.png diff --git a/raylib/static/pbr/trooper_ao.png b/samples/static/pbr/trooper_ao.png similarity index 100% rename from raylib/static/pbr/trooper_ao.png rename to samples/static/pbr/trooper_ao.png diff --git a/raylib/static/pbr/trooper_metalness.png b/samples/static/pbr/trooper_metalness.png similarity index 100% rename from raylib/static/pbr/trooper_metalness.png rename to samples/static/pbr/trooper_metalness.png diff --git a/raylib/static/pbr/trooper_normals.png b/samples/static/pbr/trooper_normals.png similarity index 100% rename from raylib/static/pbr/trooper_normals.png rename to samples/static/pbr/trooper_normals.png diff --git a/raylib/static/pbr/trooper_roughness.png b/samples/static/pbr/trooper_roughness.png similarity index 100% rename from raylib/static/pbr/trooper_roughness.png rename to samples/static/pbr/trooper_roughness.png diff --git a/raylib/static/pitch.png b/samples/static/pitch.png similarity index 100% rename from raylib/static/pitch.png rename to samples/static/pitch.png diff --git a/raylib/static/plane.obj b/samples/static/plane.obj similarity index 100% rename from raylib/static/plane.obj rename to samples/static/plane.obj diff --git a/raylib/static/plane.png b/samples/static/plane.png similarity index 100% rename from raylib/static/plane.png rename to samples/static/plane.png diff --git a/raylib/static/plane_diffuse.png b/samples/static/plane_diffuse.png similarity index 100% rename from raylib/static/plane_diffuse.png rename to samples/static/plane_diffuse.png diff --git a/raylib/static/raylib-rust_16x16.png b/samples/static/raylib-rust_16x16.png similarity index 100% rename from raylib/static/raylib-rust_16x16.png rename to samples/static/raylib-rust_16x16.png diff --git a/raylib/static/raymarching.fs b/samples/static/raymarching.fs similarity index 100% rename from raylib/static/raymarching.fs rename to samples/static/raymarching.fs diff --git a/raylib/static/shader/pbr.fs b/samples/static/shader/pbr.fs similarity index 100% rename from raylib/static/shader/pbr.fs rename to samples/static/shader/pbr.fs diff --git a/raylib/static/shader/pbr.vs b/samples/static/shader/pbr.vs similarity index 100% rename from raylib/static/shader/pbr.vs rename to samples/static/shader/pbr.vs diff --git a/raylib/static/wave.ogg b/samples/static/wave.ogg similarity index 100% rename from raylib/static/wave.ogg rename to samples/static/wave.ogg diff --git a/raylib/static/white_noise.mp3 b/samples/static/white_noise.mp3 similarity index 100% rename from raylib/static/white_noise.mp3 rename to samples/static/white_noise.mp3 diff --git a/showcase/Cargo.toml b/showcase/Cargo.toml index 55e8ab87..f13c6e92 100644 --- a/showcase/Cargo.toml +++ b/showcase/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "raylib-showcase" -version = "5.0.0" +version = "5.0.1" authors = ["David Ayeke"] edition = "2018" license = "Zlib"