Skip to content

Commit 68a598d

Browse files
Fixed text positioning
2 parents f707dc0 + 3e3f5bd commit 68a598d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

examples/ecs/per_entity_events.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct Selectable;
5151
#[derive(Bundle)]
5252
struct InteractableBundle {
5353
#[bundle]
54-
text_bundle: TextBundle,
54+
text_bundle: Text2dBundle,
5555
selectable: Selectable,
5656
rainbow: Rainbow,
5757
cycle_color_events: Events<CycleColorAction>,
@@ -62,7 +62,7 @@ impl InteractableBundle {
6262
// FIXME: fix position
6363
fn new(x: f32, y: f32, font_handle: &Handle<Font>) -> Self {
6464
InteractableBundle {
65-
text_bundle: TextBundle {
65+
text_bundle: Text2dBundle {
6666
text: Text::with_section(
6767
"0",
6868
TextStyle {
@@ -134,19 +134,19 @@ struct AddNumberAction {
134134

135135
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
136136
// Don't forget to include a camera!
137-
commands.spawn_bundle(UiCameraBundle::default());
137+
commands.spawn_bundle(OrthographicCameraBundle::new_2d());
138138

139139
let font_handle = asset_server.load("fonts/FiraSans-Bold.ttf");
140140
// Spawns the first entity, and grabs the Entity id that is being allocated
141141
let first_entity = commands
142-
.spawn_bundle(InteractableBundle::new(-200.0, 400.0, &font_handle))
142+
.spawn_bundle(InteractableBundle::new(-200.0, 0.0, &font_handle))
143143
.id();
144144
commands.insert_resource(Selected {
145145
entity: first_entity,
146146
});
147147

148-
commands.spawn_bundle(InteractableBundle::new(0.0, 400.0, &font_handle));
149-
commands.spawn_bundle(InteractableBundle::new(200.0, 400.0, &font_handle));
148+
commands.spawn_bundle(InteractableBundle::new(0.0, 0.0, &font_handle));
149+
commands.spawn_bundle(InteractableBundle::new(200.0, 0.0, &font_handle));
150150
}
151151

152152
enum CycleBehavior {

0 commit comments

Comments
 (0)