Skip to content

Commit

Permalink
fix: UiText translation bug with parent
Browse files Browse the repository at this point in the history
  • Loading branch information
suspistew committed Jun 4, 2021
1 parent 27cd885 commit 7271a1c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Binary file added examples/tetris/assets/font.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/tetris/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl SimpleGameLayer for TetrisLayer {
fn add_score_ui(world: &mut World) -> Entity {
// First we add an UiText to the world
let font = Font::Bitmap {
texture_path: app_base_path().join("assets/tetris/font.png").get(),
texture_path: asset_path().join("font.png").get(),
chars: "0123456789ACEOPRSULI".to_string(),
texture_columns: 20.,
texture_lines: 1.,
Expand Down
7 changes: 4 additions & 3 deletions src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,10 @@ impl ScionBuilder {
}

fn init_schedule_with_internal_systems(&mut self) {
self.schedule_builder
.add_system(ui_text_bitmap_update_system());
self.schedule_builder.flush();
self.schedule_builder.add_system(children_manager_system());

self.schedule_builder
.add_system(missing_ui_component_system::<UiImage>());
self.schedule_builder
Expand All @@ -300,8 +302,7 @@ impl ScionBuilder {
self.schedule_builder.add_system(dirty_child_system());
self.schedule_builder.flush();
self.schedule_builder.add_system(dirty_transform_system());
self.schedule_builder
.add_system(ui_text_bitmap_update_system());

self.schedule_builder
.add_system(compute_collisions_system());
self.schedule_builder.flush();
Expand Down
3 changes: 1 addition & 2 deletions src/core/systems/ui_text_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ pub(crate) fn ui_text_bitmap_update(

let mut char_transform = Transform::new(
Coordinates::new(
transform.translation().x() + (index as f32 * (width + 1.)),
transform.translation().y(),
(index as f32 * (width + 1.)),0.,
),
1.0,
0.,
Expand Down

0 comments on commit 7271a1c

Please # to comment.