Some fixes for soccer setup screen

This commit is contained in:
Deve 2018-09-04 00:31:56 +02:00
parent 674397e648
commit cdeb70dbf4
2 changed files with 19 additions and 14 deletions

View File

@ -2,27 +2,30 @@
<stkgui>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
<div x="5%" y="5%" width="90%" height="90%" layout="vertical-row" >
<icon id="red_team" I18N="In soccer setup screen" text="Red Team" icon="gui/soccer_ball_red.png" width="7%" height="7%"/>
<icon id="blue_team" I18N="In soccer setup screen" text="Blue Team" icon="gui/soccer_ball_blue.png" width="7%" height="7%"/>
<div x="2%" y="1%" width="96%" height="98%" layout="vertical-row" >
<header width="80%" text="Race Setup" align="center" text_align="center" />
<spacer height="10" width="25"/>
<div layout="horizontal-row" width="fit" height="35" align="left">
<div layout="horizontal-row" width="fit" height="fit" align="left">
<bright proportion="1" height="100%"
I18N="In soccer setup screen" text="Number of goals to win" text_align="left" />
<spacer width="10" height="25"/>
<spinner id="goalamount" width="200" height="90%" min_value="1" max_value="10"/>
<spinner id="goalamount" width="200" min_value="1" max_value="10"/>
</div>
<div layout="horizontal-row" width="fit" height="35" align="left">
<div layout="horizontal-row" width="fit" height="fit" align="left">
<bright proportion="1" height="100%"
I18N="In soccer setup screen" text="Maximum time (min.)" text_align="left" />
<spacer width="10" height ="25"/>
<spinner id="timeamount" width="200" height="90%" min_value="1" max_value="15"/>
<spinner id="timeamount" width="200" min_value="1" max_value="15"/>
</div>
<div layout="horizontal-row" width="fit" height="35" align="left">
<div layout="horizontal-row" width="fit" height="fit" align="left">
<bright proportion="1" height="100%"
I18N="In soccer setup screen" text="Game type (Goals limit / Time limit)" text_align="left" />
<spacer width="10" height="25"/>
@ -33,14 +36,16 @@
<bubble height="fit" width="100%" id="lblLeftRight" I18N="In soccer setup screen" text="Use left/right to choose your team and press fire" word_wrap="true" text_align="center"/>
<spacer height="10" width="25"/>
<div id="central_div" layout="horizontal-row" width="100%" proportion="1" align="center">
<roundedbox y="5%" width="100%" layout="horizontal-row" height="95%">
<roundedbox width="100%" layout="horizontal-row" height="100%">
<!-- Content is added programmatically -->
</roundedbox>
<icon id="red_team" I18N="In soccer setup screen" text="Red Team" icon="gui/soccer_ball_red.png" width="font" height="font"/> <!-- Layout is done programmatically -->
<icon id="blue_team" I18N="In soccer setup screen" text="Blue Team" icon="gui/soccer_ball_blue.png" width="font" height="font"/>
</div>
<spacer height="10" width="25"/>
<button id="continue" I18N="In soccer setup screen" text="Continue" align="center" width="60%"/>
</div>
</stkgui>

View File

@ -120,11 +120,11 @@ void SoccerSetupScreen::beforeAddingWidget()
// Add red/blue team icon above the karts
IconButtonWidget* red = getWidget<IconButtonWidget>("red_team");
IconButtonWidget* blue = getWidget<IconButtonWidget>("blue_team");
red->m_x = central_div->m_x + central_div->m_w/4;
red->m_y = central_div->m_y + red->m_h;
red->m_x = central_div->m_x + central_div->m_w/4 - red->m_w/2;
red->m_y = central_div->m_y + (int)(red->m_h * 0.5f);
blue->m_x = central_div->m_x + (central_div->m_w/4)*3;
blue->m_y = central_div->m_y + blue->m_h;
blue->m_x = central_div->m_x + (central_div->m_w/4)*3 - blue->m_w/2;
blue->m_y = central_div->m_y + (int)(blue->m_h * 0.5f);
// Add the 3D views for the karts
int nb_players = race_manager->getNumPlayers();
@ -463,7 +463,7 @@ void SoccerSetupScreen::updateKartViewsLayout()
// Compute/get some dimensions
const int nb_columns = 2; // two karts maximum per column
const int kart_area_width = (central_div->m_w) / 2; // size of one half of the screen
const int kart_area_width = (int)((central_div->m_w) / 2 * 0.8f); // size of one half of the screen with some margin
const int kart_view_size = kart_area_width/nb_columns; // Size (width and height) of a kart view
const int center_x = central_div->m_x + central_div->m_w/2;
const int center_y = central_div->m_y + central_div->m_h/2;