@@ -11,10 +11,57 @@ use crate::prelude::{NotationAssets, ThemeColors};
1111#[ derive( Copy , Clone , PartialEq , Serialize , Deserialize , Debug , Default ) ]
1212#[ cfg_attr( feature = "inspector" , derive( Inspectable ) ) ]
1313pub struct ThemeTexts {
14+ pub tab : TabTexts ,
1415 pub rhythm : RhythmTexts ,
1516 pub mini_map : MiniMapTexts ,
1617}
1718
19+ #[ derive( Copy , Clone , PartialEq , Serialize , Deserialize , Debug ) ]
20+ #[ cfg_attr( feature = "inspector" , derive( Inspectable ) ) ]
21+ pub struct TabTexts {
22+ pub bar_font_size : f32 ,
23+ pub bar_font_color : Color ,
24+ pub bar_x : f32 ,
25+ pub bar_y : f32 ,
26+ }
27+ impl Default for TabTexts {
28+ fn default ( ) -> Self {
29+ Self {
30+ bar_font_size : 18.0 ,
31+ bar_font_color : ThemeColors :: hex_linear ( "00000066" ) ,
32+ bar_x : -6.0 ,
33+ bar_y : -6.0 ,
34+ }
35+ }
36+ }
37+ impl TabTexts {
38+ pub fn spawn_bar_number (
39+ & self ,
40+ commands : & mut Commands ,
41+ assets : & NotationAssets ,
42+ entity : Entity ,
43+ text : & str ,
44+ ) {
45+ //NOTE: not sure why, using HorizontalAlign::Right here got the left behaviour
46+ BevyUtil :: spawn_text (
47+ commands,
48+ entity,
49+ text,
50+ assets. en_font . clone ( ) ,
51+ self . bar_font_size ,
52+ self . bar_font_color ,
53+ HorizontalAlign :: Left ,
54+ VerticalAlign :: Center ,
55+ self . bar_x ,
56+ self . bar_y ,
57+ 3.0 ,
58+ ) ;
59+ }
60+ pub fn update_bar_number_x ( & self , transform : & mut Transform , bar_width : f32 ) {
61+ transform. translation . x = bar_width + self . bar_x ;
62+ }
63+ }
64+
1865#[ derive( Copy , Clone , PartialEq , Serialize , Deserialize , Debug ) ]
1966#[ cfg_attr( feature = "inspector" , derive( Inspectable ) ) ]
2067pub struct RhythmTexts {
@@ -35,8 +82,8 @@ impl RhythmTexts {
3582 pub fn spawn_bar_text (
3683 & self ,
3784 commands : & mut Commands ,
38- entity : Entity ,
3985 assets : & NotationAssets ,
86+ entity : Entity ,
4087 text : & str ,
4188 ) {
4289 //NOTE: not sure why, using HorizontalAlign::Right here got the left behaviour
@@ -74,8 +121,8 @@ impl MiniMapTexts {
74121 pub fn spawn_bar_text (
75122 & self ,
76123 commands : & mut Commands ,
77- entity : Entity ,
78124 assets : & NotationAssets ,
125+ entity : Entity ,
79126 text : & str ,
80127 ) {
81128 //NOTE: not sure why, using HorizontalAlign::Right here got the left behaviour
0 commit comments