Skip to content

Commit 8be6a1f

Browse files
committed
6.0v experiment
1 parent 41db2aa commit 8be6a1f

38 files changed

+1474
-760
lines changed

.DS_Store

6 KB
Binary file not shown.

CHANGELOG.md

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<!-- next-header -->
2+
23
## [Unreleased] - ReleaseDate
34

45
## Added
@@ -17,7 +18,6 @@
1718

1819
- Updated to `bevy 0.8` and `bevy_prototype_lyon 0.6` under the hood, which resolves the occasional stuttering problem.
1920

20-
2121
## [5.1.0] - 2022-06-18
2222

2323
### Improved
@@ -118,58 +118,58 @@ Yes, I know I shouldn't be releasing breaking changes in a patch release...but n
118118
### BREAKING CHANGES
119119

120120
- The fundamental way that Rusty Engine connects a user's game state to Bevy has been heavily
121-
refactored to a new solution based on macros so that users can provide a custom struct with their
122-
desired game state. This obseletes the old generic vectors and maps of various types that used to be
123-
stored on the `GameState` struct (which itself has been renamed to `EngineState` to more accurately
124-
describe what it is used for). Please refer to the [readme](./README.md) and
125-
[docs](https://docs.rs/rusty_engine/latest/rusty_engine/) for comprehensive documentation on the new
126-
approach.
121+
refactored to a new solution based on macros so that users can provide a custom struct with their
122+
desired game state. This obseletes the old generic vectors and maps of various types that used to be
123+
stored on the `GameState` struct (which itself has been renamed to `EngineState` to more accurately
124+
describe what it is used for). Please refer to the [readme](./README.md) and
125+
[docs](https://docs.rs/rusty_engine/latest/rusty_engine/) for comprehensive documentation on the new
126+
approach.
127127
- Placing the module-level macro call `rusty_engine::init!(MyGameState)` is now required.
128-
`MyGameState` is any user-defined struct type that will be passed to the logic functions each frame.
128+
`MyGameState` is any user-defined struct type that will be passed to the logic functions each frame.
129129
- `GameState` has been renamed to `EngineState` so that user's custom game state can be referred to
130-
as `GameState` instead.
131-
- `GameState::add_actor` has been renamed to `EngineState::add_sprite`
132-
- `GameState::add_text_actor` has been renamed to `EngineState::add_text`
130+
as `GameState` instead.
131+
- `GameState::add_actor` has been renamed to `EngineState::add_one`
132+
- `GameState::add_one_actor` has been renamed to `EngineState::add_one`
133133
- `Game` now implements `Deref` and `DerefMut` for `EngineState`, so you can easily access
134-
`EngineState`'s methods from `Game` in `main.rs` for your game setup. `Game::game_state_mut` has
135-
been removed (if it had stayed it would have been renamed `engine_state_mut`, but with the deref
136-
implementations it's not needed at all).
134+
`EngineState`'s methods from `Game` in `main.rs` for your game setup. `Game::game_state_mut` has
135+
been removed (if it had stayed it would have been renamed `engine_state_mut`, but with the deref
136+
implementations it's not needed at all).
137137
- `GameState.screen_dimensions`, which was set at startup and never updated, has been replaced by `EngineState.window_dimensions`, which is updated every frame so resizing the window can be handled in your game logic.
138138
- Multiple logic functions can now be run. Pass them to `Game::run` in the order you would like them
139-
run. Return `false` to abort running any later functions during the frame.
139+
run. Return `false` to abort running any later functions during the frame.
140140
- Logic functions now need to fit the signature `fn somename(engine_state: &mut EngineState, game_state: &mut GameState) -> bool`, where `GameState` is the user-defined struct passed to `rusty_engine::init!()`, or `()` if nothing was passed in.
141141
- `.play_sfx()` now takes a volume level from `0.0` to `1.0` as a second argument, e.g. `.play_sfx(SfxPreset::Congratulations, 1.0)`
142142
- `Actor` has been renamed to `Sprite` to eliminate the confusing "actor" terminalogy.
143-
- `Actor::build` has been replaced by `Sprite::new`, which _must_ be used to create a `Sprite` instead of defining a struct literal (enforced via private phantom data). The `Default` implementation has been removed because of the previous restriction.
144-
- `Actor.preset` has been removed
145-
- `Actor.filename` (a `String`) has been replaced with `Sprite.filepath` (a `PathBuf`)
146-
- The builder methods `Actor::set_collision` and `Actor::set_collider` have been removed since we never ended up adopting a builder pattern.
147-
- `Sprite.collider_filepath` has been added
148-
- `Sprite::write_collider` has been added (see note below about changes to colliders)
143+
- `Actor::build` has been replaced by `Sprite::new`, which _must_ be used to create a `Sprite` instead of defining a struct literal (enforced via private phantom data). The `Default` implementation has been removed because of the previous restriction.
144+
- `Actor.preset` has been removed
145+
- `Actor.filename` (a `String`) has been replaced with `Sprite.filepath` (a `PathBuf`)
146+
- The builder methods `Actor::set_collision` and `Actor::set_collider` have been removed since we never ended up adopting a builder pattern.
147+
- `Sprite.collider_filepath` has been added
148+
- `Sprite::write_collider` has been added (see note below about changes to colliders)
149149
- `TextActor` has been renamed to `Text` to eliminate the confusing "actor" terminology.
150-
- `TextActor.text` is now `Text.value` for similar reasons.
151-
- `Sprite`s may now be created with either a `SpritePreset` or the path to an image file via both `Sprite::new` or `EngineState::add_sprite`. The image file needs to be stored in `assets/sprite` or one of its subdirectories. When specifying the path to the file, the path relative to `assets/sprite` should be used. For example, if your image is `assets/sprite/circus/animal.png` then you would pass `circus/animal.png` to one of the methods to create the sprite.
150+
- `TextActor.text` is now `Text.value` for similar reasons.
151+
- `Sprite`s may now be created with either a `SpritePreset` or the path to an image file via both `Sprite::new` or `EngineState::add_one`. The image file needs to be stored in `assets/sprite` or one of its subdirectories. When specifying the path to the file, the path relative to `assets/sprite` should be used. For example, if your image is `assets/sprite/circus/animal.png` then you would pass `circus/animal.png` to one of the methods to create the sprite.
152152
- `SpritePreset::build_from_name` and `SpritePreset::build` have been removed (see note above about the new, more flexible way to create sprites)
153153
- `SpritePreset::collider()` has been removed since colliders are no longer hard-coded features of presets (see note below about changes to colliders)
154154
- `SpritePreset::filename -> String` has been replaced by `SpritePreset::filepath -> PathBuf`, which powers the `impl From<SpritePreset> for PathBuf` implementation.
155-
- Colliders are now loaded from collider files. Collider files use the [Rusty Object Notation (RON)](https://github.com/ron-rs/ron) format. The easiest way to create a collider is to run the `collider_creator` example by cloning the `rusty_engine` repository and running `cargo run --release --example collider_creator relative/path/to/my/image.png`. The image needs to be somewhere inside the `assets/` directory. You could also create the collider programmatically, set it on the `Sprite` struct, and call the sprite's `write_collider()` method. Or you could copy an existing collider file, name it the same as your image file (but with the `.collider` extension) and change it to match your image. Collider coordinates need to define a convex polygon with points going in clockwise order. Coordinates are floating point values relative to the center of the image, with the center of the image being (0.0, 0.0).
155+
- Colliders are now loaded from collider files. Collider files use the [Rusty Object Notation (RON)](https://github.com/ron-rs/ron) format. The easiest way to create a collider is to run the `collider_creator` example by cloning the `rusty_engine` repository and running `cargo run --release --example collider_creator relative/path/to/my/image.png`. The image needs to be somewhere inside the `assets/` directory. You could also create the collider programmatically, set it on the `Sprite` struct, and call the sprite's `write_collider()` method. Or you could copy an existing collider file, name it the same as your image file (but with the `.collider` extension) and change it to match your image. Collider coordinates need to define a convex polygon with points going in clockwise order. Coordinates are floating point values relative to the center of the image, with the center of the image being (0.0, 0.0).
156156
- All sprites' colliders in the asset pack have been recreated more cleanly using the new `collider_creator` example.
157157
- The `assets/fonts` directory in the asset pack has been renamed to `assets/font` for consistency with the other directories.
158158
- `KeyboardState` and `MouseState` now both have 6 similar methods for processing key- and button-presses:
159-
- `pressed` -> `pressed_any`
160-
- `just_pressed` -> `just_pressed_any`
161-
- `just_released` -> `just_released_any`
159+
- `pressed` -> `pressed_any`
160+
- `just_pressed` -> `just_pressed_any`
161+
- `just_released` -> `just_released_any`
162162

163163
### Other Changes
164164

165165
- `AudioManager::music_playing()` will return whether or not music is currently playing (accessible
166-
through `EngineState:audio_manager`)
166+
through `EngineState:audio_manager`)
167167
- A custom font may now be selected by placing it in `assets/font` and specifying the relative filepath on `Text.font`.
168168
- Custom sounds may now be played via `AudioManager::play_music` and `AudioManager::play_sfx` by
169-
specifying a path to a sound file relative to `assets/audio`.
169+
specifying a path to a sound file relative to `assets/audio`.
170170
- `Collider` now implements `PartialEq`, `Serialize`, and `Deserialize`
171171
- `Collider::is_convex` was added to make it easier to tell if you have a convex collider.
172-
- The `collider_creator` example was added to make it easy to load a sprite and make a collider file for it. Place your image file (let's call it `my_image.png`) anywhere inside your local clone of the Rusty Engine `assets/` directory and then run the example: `cargo run --release --example collider_creator -- assets/my_image.png`. Afterwards, copy the image file and the new collider file `my_image.collider` file over to the assets directory of your own project.
172+
- The `collider_creator` example was added to make it easy to load a sprite and make a collider file for it. Place your image file (let's call it `my_image.png`) anywhere inside your local clone of the Rusty Engine `assets/` directory and then run the example: `cargo run --release --example collider_creator -- assets/my_image.png`. Afterwards, copy the image file and the new collider file `my_image.collider` file over to the assets directory of your own project.
173173
- You can now toggle debug rendering of colliders by setting `EngineState.debug_sprite_colliders` to `true`. The `collision` example will now toggle that value when you press the `C` key.
174174
- (meta) Improved CI times by using sccache together with GitHub Actions caching
175175
- Circular colliders no longer have duplicate starting and ending coordinates
@@ -196,8 +196,8 @@ specifying a path to a sound file relative to `assets/audio`.
196196
- Added `GameState.vec2_map` and `GameState.vec2_vec` as collections for the user to store state in.
197197
- Switched all instances of `std::collections::HashMap` to `bevy::utils::HashMap`.
198198
- Updated all examples to adjust for breaking changes, also:
199-
- The `keyboard` example has been renamed to `keyboard_events` to distinguish it from the new `keyboard_state` example which uses `KeyboardState` for smooth movement
200-
- The `mouse` example has been renamed to `mouse_events` to distinguish it from the new `mouse_state` example which uses `MouseState` for smooth movement
199+
- The `keyboard` example has been renamed to `keyboard_events` to distinguish it from the new `keyboard_state` example which uses `KeyboardState` for smooth movement
200+
- The `mouse` example has been renamed to `mouse_events` to distinguish it from the new `mouse_state` example which uses `MouseState` for smooth movement
201201
- Added now `level_creator` example to use as a rudimentary level creator (originally added in 1.1.0)
202202

203203
## [1.1.4] - 2021-08-26
@@ -280,11 +280,13 @@ specifying a path to a sound file relative to `assets/audio`.
280280

281281
## 0.0.1 - [0.11.0]
282282

283-
- Rapid, messy development based on gfx via `glium`, sound via `rusty_audio`, timing via `rusty_time`, and custom logic for everything else. This approach never reached a very usable state.
283+
- Rapid, messy development based on gfx via `glium`, sound via `rusty_audio`, timing via `rusty_time`, and custom logic for everything else. This approach never reached a very usable state.
284+
285+
[bevy]: https://bevyengine.org
284286

285-
[Bevy]: https://bevyengine.org
286287
<!-- next-url -->
287-
[Unreleased]: https://github.com/CleanCut/rusty_engine/compare/v5.1.1...HEAD
288+
289+
[unreleased]: https://github.com/CleanCut/rusty_engine/compare/v5.1.1...HEAD
288290
[5.1.1]: https://github.com/CleanCut/rusty_engine/compare/v5.1.0...v5.1.1
289291
[5.1.0]: https://github.com/CleanCut/rusty_engine/compare/v5.0.6...v5.1.0
290292
[5.0.6]: https://github.com/CleanCut/rusty_engine/compare/v5.0.5...v5.0.6

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rusty_engine"
3-
version = "5.1.1"
3+
version = "6.0.0"
44
description = "Learn Rust with a simple, cross-platform, 2D game engine."
55
edition = "2021"
66
homepage = "https://github.com/CleanCut/rusty_engine"

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ If you are using Linux or Windows Subsystem for Linux 2, please visit Bevy's [In
4747
### You MUST download the assets separately!!!
4848

4949
Here are three different ways to download the assets (pick any of them--it should end up the same in the end):
50+
5051
- Clone the `rusty_engine` repository and copy/move the `assets/` directory over to your own project
5152
- 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.
5253
- (My favorite!) On a posix compatible shell, run this command inside your project directory:
54+
5355
```shell
5456
curl -L https://github.com/CleanCut/rusty_engine/archive/refs/heads/main.tar.gz | tar -zxv --strip-components=1 rusty_engine-main/assets
5557
```
@@ -76,7 +78,7 @@ Write your game!
7678
// Create a game
7779
let mut game = Game::new();
7880
// Set up your game. `Game` exposes all of the methods and fields of `Engine`.
79-
let sprite = game.add_sprite("player", SpritePreset::RacingCarBlue);
81+
let sprite = game.add_one(Sprite::new("player", SpritePreset::RacingCarBlue);
8082
sprite.scale = 2.0;
8183
game.audio_manager.play_music(MusicPreset::Classy8Bit, 1.0);
8284
// Add one or more functions with logic for your game. When the game is run, the logic
@@ -109,7 +111,6 @@ Run your game with `cargo run --release`!
109111

110112
<img width="1348" alt="example screenshot" src="https://user-images.githubusercontent.com/5838512/146858022-1d91c7f4-8b21-4f85-a72a-c4b93edcabc6.png">
111113

112-
113114
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/)
114115

115116
## Student Showcase
@@ -121,7 +122,7 @@ Show off the project you made with Rusty Engine! Learning Rust can be fun. 😄
121122

122123
## Contribution
123124

124-
All software contributions are assumed to be dual-licensed under MIT/Apache-2. All asset contributions must be under licenses compatible with the software license, and explain their license(s) in a `README.md` file in the same directory as the source files.
125+
All software contributions are assumed to be dual-licensed under MIT/Apache-2. All asset contributions must be under licenses compatible with the software license, and explain their license(s) in a `README.md` file in the same directory as the source files.
125126

126127
## Asset Licenses
127128

@@ -135,11 +136,11 @@ Distributed under the terms of both the MIT license and the Apache License (Vers
135136

136137
See [license/APACHE](license/APACHE) and [license/MIT](license/MIT).
137138

138-
[CPAL]: https://github.com/RustAudio/cpal
139-
[Questions]: https://github.com/CleanCut/rusty_engine/discussions
140-
[Ultimate Rust Crash Course]: https://agileperception.com/ultimate_rust_crash_course
139+
[cpal]: https://github.com/RustAudio/cpal
140+
[questions]: https://github.com/CleanCut/rusty_engine/discussions
141+
[ultimate rust crash course]: https://agileperception.com/ultimate_rust_crash_course
141142
[bug reports]: https://github.com/CleanCut/rusty_engine/issues/new
142143
[rendy]: https://github.com/amethyst/rendy
143-
[on GitHub]: https://github.com/sponsors/CleanCut
144-
[on Patreon]: https://patreon.com/nathanstocks
145-
[Bevy]: https://bevyengine.org/
144+
[on github]: https://github.com/sponsors/CleanCut
145+
[on patreon]: https://patreon.com/nathanstocks
146+
[bevy]: https://bevyengine.org/

0 commit comments

Comments
 (0)