You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-13Lines changed: 14 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,3 @@
1
-
If you like Rusty Engine, please sponsor me [on GitHub] or [on Patreon], or [take one of my courses](https://agileperception.com). 💖
2
-
3
1
# Rusty Engine
4
2
5
3
Rusty Engine is a simple, 2D game engine for those who are learning Rust. Create simple game prototypes using straightforward Rust code without needing to learning difficult game engine concepts! It works on macOS, Linux, and Windows. Rusty Engine is a simplification wrapper over [Bevy], which I encourage you to use directly for more serious game engine needs.
@@ -8,6 +6,13 @@ Rusty Engine is a simple, 2D game engine for those who are learning Rust. Create
If you like Rusty Engine, please sponsor me [on GitHub] or [on Patreon], or take one of my courses below!
35
+
29
36
The following courses use Rusty Engine in their curriculum:
30
37
31
38
-[Ultimate Rust 2: Intermediate Concepts](https://www.udemy.com/course/ultimate-rust-2/?referralCode=8ED694EBE5637F954414) on Udemy (the sequel to [Ultimate Rust Crash Course](https://www.udemy.com/course/ultimate-rust-crash-course/?referralCode=AF30FAD8C6CCCC2C94F0))
32
39
-[Rust in 3 Weeks](https://agileperception.com) conducted live on O'Reilly Online approximately once each quarter.
If you are using Linux or Windows Subsystem for Linux 2, please visit Bevy's [Installing Linux Dependencies](https://github.com/bevyengine/bevy/blob/main/docs/linux_dependencies.md) page and follow the instructions to install needed dependencies.
43
44
44
45
## Quick Start
45
46
46
47
### You MUST download the assets separately!!!
48
+
47
49
Here are three different ways to download the assets (pick any of them--it should end up the same in the end):
48
50
- Clone the `rusty_engine` repository and copy/move the `assets/` directory over to your own project
49
51
- Download a [zip file](https://github.com/CleanCut/rusty_engine/archive/refs/heads/main.zip) or [tarball](https://github.com/CleanCut/rusty_engine/archive/refs/heads/main.tar.gz) of the `rusty_engine` repository, extract it, and copy/move the `assets/` directory over to your own project.
50
-
- On a posix compatible shell, run this command inside your project directory:
52
+
-(My favorite!) On a posix compatible shell, run this command inside your project directory:
51
53
```shell
52
54
curl -L https://github.com/CleanCut/rusty_engine/archive/refs/heads/main.tar.gz | tar -zxv --strip-components=1 rusty_engine-main/assets
53
55
```
@@ -73,7 +75,7 @@ Write your game!
73
75
fnmain() {
74
76
// Create a game
75
77
letmutgame=Game::new();
76
-
// Set up your game. `Game` exposes all of the methods (but not fields) of `Engine` as well.
78
+
// Set up your game. `Game` exposes all of the methods and fields of `Engine`.
See also the [game scenarios](https://github.com/CleanCut/rusty_engine/tree/main/scenarios), [code examples](https://github.com/CleanCut/rusty_engine/tree/main/examples) and the [API documentation](https://docs.rs/rusty_engine/latest/rusty_engine/)
113
+
See also the [tutorial](https://cleancut.github.io/rusty_engine/), [game scenarios](https://github.com/CleanCut/rusty_engine/tree/main/scenarios), [code examples](https://github.com/CleanCut/rusty_engine/tree/main/examples) and the [API documentation](https://docs.rs/rusty_engine/latest/rusty_engine/)
Copy file name to clipboardExpand all lines: src/audio.rs
+12-9Lines changed: 12 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
//! Facilities for interacting with audio, including: [`AudioManager`], [`MusicPreset`], and
2
2
//! [`SfxPreset`]
3
3
//!
4
-
//! You may add your own sound files to the `assets/audio` directory or any of its subdirectories
4
+
//! You may add your own sound files to the `assets/` directory or any of its subdirectories
5
5
//! and play them as sound effects or music by providing the relative path to the file. For example,
6
-
//! if you place a file named `my_sound_effect.mp3` in this directory, you could play it with:
6
+
//! if you place a file named `my_sound_effect.mp3` in `assets/`, you can play it with:
7
7
//!
8
8
//! ```rust,no_run
9
9
//! # use rusty_engine::prelude::*;
@@ -16,7 +16,8 @@
16
16
//! # }
17
17
//! ```
18
18
//!
19
-
//! Or, if you create a `my_game/` subdirectory and place a file named `spooky_loop.ogg`, you could play it as continuous music with:
19
+
//! Or, if you create a `assets/my_game/` subdirectory and place a file named `spooky_loop.ogg`, you
20
+
//! could play it as continuous music with:
20
21
//!
21
22
//! ```rust,no_run
22
23
//! # use rusty_engine::prelude::*;
@@ -29,7 +30,8 @@
29
30
//! # }
30
31
//! ```
31
32
//!
32
-
//! The sound effects provided in this asset pack have convenient `enum`s defined that you can use instead of a path to the file: `SfxPreset` and `MusicPreset`. For example:
33
+
//! The sound effects provided in this asset pack have convenient `enum`s defined that you can use
34
+
//! instead of a path to the file: `SfxPreset` and `MusicPreset`. For example:
33
35
//!
34
36
//! ```rust,no_run
35
37
//! // Import the enums into scope first
@@ -60,9 +62,10 @@ impl Plugin for AudioManagerPlugin {
60
62
}
61
63
}
62
64
63
-
/// You will interact with a [`AudioManager`] for all audio needs in Rusty Engine. It is exposed
65
+
/// You will interact with the [`AudioManager`] for all audio needs in Rusty Engine. It is exposed
64
66
/// through the [`Engine`](crate::prelude::Engine) struct provided to your logic function
65
-
/// each frame as the [`audio_manager`](crate::prelude::Engine::audio_manager) field.
67
+
/// each frame as the [`audio_manager`](crate::prelude::Engine::audio_manager) field. It is also
68
+
/// accessible through the [`Game`](crate::prelude::Game) struct in your `main` function.
66
69
#[derive(Default)]
67
70
pubstructAudioManager{
68
71
sfx_queue:Vec<(String,f32)>,
@@ -83,7 +86,7 @@ impl Debug for AudioManager {
83
86
84
87
implAudioManager{
85
88
/// Play a sound effect. `volume` ranges from `0.0` to `1.0`. `sfx` can be an [`SfxPreset`] or a
86
-
/// string containing the relative path/filename of a sound file within the `assets/audio`
89
+
/// string containing the relative path/filename of a sound file within the `assets/`
87
90
/// directory. Sound effects are "fire and forget". They will play to completion and then stop.
88
91
/// Multiple sound effects will be mixed and play simultaneously.
/// Create an empty [`Game`] with an empty [`Engine`]
278
+
/// Create an new, empty [`Game`] with an empty [`Engine`]
275
279
pubfnnew() -> Self{
276
280
if std::fs::read_dir("assets").is_err(){
277
281
println!("FATAL: Could not find assets directory. Have you downloaded the assets?\nhttps://github.com/CleanCut/rusty_engine#you-must-download-the-assets-separately");
0 commit comments