@ -27,20 +27,10 @@ namespace gui {
sf : : Text label ( $ font , name ) ;
sf : : Text label ( $ font , name ) ;
auto bounds = label . getLocalBounds ( ) ;
auto bounds = label . getLocalBounds ( ) ;
fmt : : println ( " CENTER w/h={},{} vs bounds={},{} " ,
cell . w , cell . h , bounds . size . x , bounds . size . y ) ;
auto label_cell = lel : : center ( bounds . size . x , bounds . size . y , cell ) ;
auto label_cell = lel : : center ( bounds . size . x , bounds . size . y , cell ) ;
label . setPosition ( { float ( label_cell . x ) , float ( label_cell . y ) } ) ;
// this stupid / 2 is because SFML renders from baseline rather than from the claimed bounding box
label . setPosition ( { float ( label_cell . x ) , float ( label_cell . y ) - label_cell . h / 2 } ) ;
$ labels . push_back ( label ) ;
$ labels . push_back ( label ) ;
sf : : RectangleShape label_box ;
label_box . setPosition ( { float ( label_cell . x ) , float ( label_cell . y ) } ) ;
label_box . setSize ( { float ( label_cell . w ) , float ( label_cell . h ) } ) ;
label_box . setFillColor ( { 10 , 10 , 10 } ) ;
label_box . setOutlineColor ( { 100 , 100 , 100 } ) ;
label_box . setOutlineThickness ( 1.0 ) ;
$ label_boxes . insert_or_assign ( " Z " + name , label_box ) ;
}
}
}
}