bevy/examples/2d
Doonv ba0f8f996f
Add insert_state to App. (#11043)
# Objective

Fix #10731.

## Solution

Rename `App::add_state<T>(&mut self)` to `init_state`, and add
`App::insert_state<T>(&mut self, state: T)`. I decided on these names
because they are more similar to `init_resource` and `insert_resource`.

I also removed the `States` trait's requirement for `Default`. Instead,
`init_state` requires `FromWorld`.

---

## Changelog

- Renamed `App::add_state` to `init_state`.
- Added `App::insert_state`.
- Removed the `States` trait's requirement for `Default`.

## Migration Guide

- Renamed `App::add_state` to `init_state`.
2023-12-21 14:09:24 +00:00
..
2d_gizmos.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
2d_shapes.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
2d_viewport_to_world.rs Add example for Camera::viewport_to_world (#7179) 2023-09-11 18:52:11 +00:00
bloom_2d.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
custom_gltf_vertex_attribute.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
mesh2d.rs Remove unnecessary path prefixes (#10749) 2023-11-28 23:43:40 +00:00
mesh2d_manual.rs Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
mesh2d_vertex_color_texture.rs Remove unnecessary path prefixes (#10749) 2023-11-28 23:43:40 +00:00
move_sprite.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
pixel_perfect.rs Update color and naming for consistency (#10367) 2023-11-04 02:09:23 +00:00
rotation.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
sprite.rs Update color and naming for consistency (#10367) 2023-11-04 02:09:23 +00:00
sprite_flipping.rs Update color and naming for consistency (#10367) 2023-11-04 02:09:23 +00:00
sprite_sheet.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
text2d.rs Rename TextAlignment to JustifyText. (#10854) 2023-12-05 03:00:41 +00:00
texture_atlas.rs Add insert_state to App. (#11043) 2023-12-21 14:09:24 +00:00
transparency_2d.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00