File tree Expand file tree Collapse file tree
scene/playing_scene/top_bar Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ pub fn font_system() -> Rc<RefCell<FontSystem>> {
2525 glyphon:: fontdb:: Source :: Binary ( Arc :: new ( include_bytes ! (
2626 "../../assets/fonts/bootstrap-icons.ttf"
2727 ) ) ) ,
28+ glyphon:: fontdb:: Source :: Binary ( Arc :: new ( include_bytes ! (
29+ "../../assets/fonts/Leland.otf"
30+ ) ) ) ,
2831 ] ) ) )
2932 } )
3033 . clone ( )
Original file line number Diff line number Diff line change @@ -59,3 +59,49 @@ pub fn record_stop_icon() -> &'static str {
5959pub fn save_icon ( ) -> & ' static str {
6060 "\u{f7D9} "
6161}
62+
63+ pub mod sheet {
64+ pub fn stem ( ) -> & ' static str {
65+ "\u{1D165} "
66+ }
67+
68+ pub fn f_clef ( ) -> & ' static str {
69+ "\u{E062} "
70+ }
71+
72+ pub fn g_clef ( ) -> & ' static str {
73+ "\u{E050} "
74+ }
75+
76+ pub fn accidental_flat ( ) -> & ' static str {
77+ "\u{E260} "
78+ }
79+
80+ pub fn accidental_sharp ( ) -> & ' static str {
81+ "\u{E262} "
82+ }
83+
84+ pub fn notehead_whole ( ) -> & ' static str {
85+ "\u{E0A2} "
86+ }
87+
88+ pub fn notehead_black ( ) -> & ' static str {
89+ "\u{E0A4} "
90+ }
91+
92+ pub fn flag_8th ( ) -> & ' static str {
93+ "\u{E240} "
94+ }
95+
96+ pub fn flag_16th ( ) -> & ' static str {
97+ "\u{E242} "
98+ }
99+
100+ pub fn flag_64th ( ) -> & ' static str {
101+ "\u{E246} "
102+ }
103+
104+ pub fn flag_128th ( ) -> & ' static str {
105+ "\u{E248} "
106+ }
107+ }
Original file line number Diff line number Diff line change @@ -79,6 +79,55 @@ impl TopBar {
7979 pub fn ui ( this : & mut PlayingScene , ctx : & mut Context ) {
8080 let mut ui = std:: mem:: replace ( & mut this. nuon , nuon:: Ui :: new ( ) ) ;
8181
82+ nuon:: translate ( ) . y ( 100.0 ) . build ( & mut ui, |ui| {
83+ let spacing = 15.0 ;
84+ let half_spacing = spacing / 2.0 ;
85+ let y = 50.0 ;
86+ let x = 40.0 ;
87+
88+ let color = [ 0 ; 3 ] ;
89+
90+ nuon:: quad ( )
91+ . color ( [ 255 ; 3 ] )
92+ . pos ( 0.0 , 0.0 )
93+ . size ( 250.0 , 130.0 )
94+ . border_radius ( [ 0.0 , 10.0 , 10.0 , 0.0 ] )
95+ . build ( ui) ;
96+
97+ // Staves
98+ for id in 0 ..5 {
99+ nuon:: quad ( )
100+ . y ( y - id as f32 * spacing + 39.0 )
101+ . height ( 1.0 )
102+ . width ( 250.0 )
103+ . color ( color)
104+ . build ( ui) ;
105+ }
106+
107+ let base = || half_spacing * 4.0 ;
108+ let pitch_y = |pitch : u8 | base ( ) - half_spacing * pitch as f32 ;
109+
110+ nuon:: leland ( )
111+ . text ( icons:: sheet:: g_clef ( ) )
112+ . color ( color)
113+ . x ( x)
114+ . y ( y)
115+ . build ( ui) ;
116+
117+ let whole = icons:: sheet:: notehead_whole ( ) ;
118+
119+ for pitch in 0 ..10 {
120+ let y = y + pitch_y ( pitch) ;
121+
122+ nuon:: leland ( )
123+ . text ( whole)
124+ . color ( color)
125+ . x ( x + 60.0 + 22.0 * ( pitch % 2 ) as f32 )
126+ . y ( y)
127+ . build ( ui) ;
128+ }
129+ } ) ;
130+
82131 nuon:: translate ( )
83132 . y ( this. top_bar . topbar_expand_animation . animate_bool (
84133 -75.0 + 5.0 ,
Original file line number Diff line number Diff line change @@ -1169,6 +1169,10 @@ pub fn label() -> Label {
11691169 Label :: new ( )
11701170}
11711171
1172+ pub fn leland ( ) -> Label {
1173+ label ( ) . font_family ( "Leland" ) . font_size ( 60.0 )
1174+ }
1175+
11721176impl Default for Label {
11731177 fn default ( ) -> Self {
11741178 Self :: new ( )
You can’t perform that action at this time.
0 commit comments