From 7271a1cb75f0bb3815d264da5363b65efb3d7cbc Mon Sep 17 00:00:00 2001 From: grzi Date: Fri, 4 Jun 2021 23:01:27 +0200 Subject: [PATCH] fix: UiText translation bug with parent --- examples/tetris/assets/font.png | Bin 0 -> 963 bytes examples/tetris/layer.rs | 2 +- src/application.rs | 7 ++++--- src/core/systems/ui_text_system.rs | 3 +-- 4 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 examples/tetris/assets/font.png diff --git a/examples/tetris/assets/font.png b/examples/tetris/assets/font.png new file mode 100644 index 0000000000000000000000000000000000000000..5526f968da024b1c7f7ce25290254eee05727f34 GIT binary patch literal 963 zcmV;!13dhRP)Px&eMv+?RCt{2o!fSWAPhvItN;JY_MvtiwIa6}NO1OBdvr(w8brVtZrHXhgb=p7 z-!8-$W5HoreUwg$Vtuyng=J>7E9^Y-sEhKQVOyiViF(gySLvZ++o+e-M#s~L-}E@L z?u|#0ZU3=ZJYRM;4ykg#(8dTMgb*!!AO9#wZ2vf(Q_ySfrd8+3PKM@_c59~u6+?t( zX}zN~SE%<^Jw&}T+77CWl>Zj}X2x+u9a-o5^7rXcvEclk<9lG($@INedz4nIX36oj zw#}-e+4Wwk*HiCz=Q7$+i*D|COMWxsxJ)+c86LbQq^of9H%r-^Vdo0IGc-$lZ+yp6 zjkkJ7J)zxcr6?_f(T;MuE&k8)n;Az-_mkN?CL|$5ITnYQ*mxQe6ZRRMkdEDlt{Ex4 zh78hN6~!t|?GR4tnurZrC1o(^vGd9QH-Wl0x@K5HLcOdUJwzqWC{}em#jEz3Xo)>* zl0CXWJV}NO_VA8i!hOPtn3d1DZmtisjc3 z?odMNKs_2E-iwCX@GO~-Ml}w`;!p;o7qQl!kFWv7TW5{c+BvJeuUtQtY?;N932BEt zLuuBGAjX2zT7AZ1z@8atCC8&QYw&W1sov9#VnrUbooGERjO}FQgmeNmLn(xLJsHmn zPJ7F39Uft53O}IhIMtqdo*32kJ}i@vJXNYETaonmZE4Rv@m|!PxGa;9c04SsduKNK zfZj_Cc|3YQM#cIgZsSn*9BxNfU95--;Z+DD zji=Xybi#74R)|*q+O_4LFLU9kWxv_P7^w?+t@4VC<8|z|wwh@_ihLVXP7RGJ1(88rJaI l8{_#k+W;Yi5F&&SegL`=Fk_BsSAPHi002ovPDHLkV1g+J&h-EQ literal 0 HcmV?d00001 diff --git a/examples/tetris/layer.rs b/examples/tetris/layer.rs index b50e6dd..e139f5e 100644 --- a/examples/tetris/layer.rs +++ b/examples/tetris/layer.rs @@ -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., diff --git a/src/application.rs b/src/application.rs index a427b9d..41c3b8a 100644 --- a/src/application.rs +++ b/src/application.rs @@ -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::()); self.schedule_builder @@ -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(); diff --git a/src/core/systems/ui_text_system.rs b/src/core/systems/ui_text_system.rs index 5022731..49df6ca 100644 --- a/src/core/systems/ui_text_system.rs +++ b/src/core/systems/ui_text_system.rs @@ -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.,