@@ -74,6 +74,10 @@ namespace gmenu {
7474 // std::cout << x << " " << textRect.width / 2.0f;
7575 x = textRect.width / 2 + style.Padding .left ;
7676 }
77+ if ( x + textRect.width / 2 .0f > window.getSize ().x ) {
78+ // std::cout << x << " " << textRect.width / 2.0f;
79+ x = window.getSize ().x - textRect.width /2 + style.Padding .left ;
80+ }
7781 text.setPosition (sf::Vector2f (x,y));
7882 window.draw (text);
7983 } // writeText(...)
@@ -86,9 +90,9 @@ namespace gmenu {
8690 {
8791 /* Small scope just to be able to freely use the variable names */
8892 float offset_coefficient = 0.5 ;
89- if ( style.layout & Layout::TitleCentre == Layout::TitleCentre ) offset_coefficient = 0.5 ;
90- else if ( style.layout & Layout::TitleLeft == Layout::TitleLeft ) offset_coefficient = 0.25 ;
91- else if ( style.layout & Layout::TitleRight == Layout::TitleRight ) offset_coefficient = 0.75 ;
93+ if ( style.layout & Layout::TitleCentre ) offset_coefficient = 0.5 ;
94+ else if ( style.layout & Layout::TitleLeft ) offset_coefficient = 0.25 ;
95+ else if ( style.layout & Layout::TitleRight ) offset_coefficient = 0.75 ;
9296 float x = (float ) window.getSize ().x * offset_coefficient, y = style.Padding .top ;
9397 title_location.x = (x + style.Padding .left );
9498 title_location.y = y;
@@ -99,9 +103,9 @@ namespace gmenu {
99103 unsigned int block_height = (int ) menu_screen_height / menuItems.size () * style.MenuItemScaleFactor ;
100104
101105 float offset_coefficient = 0.5 ;
102- if ( style.layout & Layout::ItemCentre == Layout::ItemCentre ) offset_coefficient = 0.5 ;
103- else if ( style.layout & Layout::ItemLeft == Layout::ItemLeft ) offset_coefficient = 0.25 ;
104- else if ( style.layout & Layout::ItemRight == Layout::ItemRight ) offset_coefficient = 0.75 ;
106+ if ( style.layout & Layout::ItemCentre ) offset_coefficient = 0.5 ;
107+ else if ( style.layout & Layout::ItemLeft ) offset_coefficient = 0.25 ;
108+ else if ( style.layout & Layout::ItemRight ) offset_coefficient = 0.75 ;
105109
106110 float x = (float )window.getSize ().x * offset_coefficient + style.Padding .left ;
107111 float y = ((float )window.getSize ().y ) - 0.75 * menu_screen_height + block_height * 1 / 8 ;
0 commit comments