@@ -201,9 +201,9 @@ bool MENU_NoActiveWindow() {
201
201
return false ;
202
202
}
203
203
204
- void FontRenderText (Font* _pFont, Vec3f pos , const std::string& _pText, Color _c) {
205
- if (pTextManage) {
206
- pTextManage->AddText (_pFont, _pText, pos. x , pos. y , _c);
204
+ void FontRenderText (Font* _pFont, const Rect & rzone , const std::string& _pText, Color _c) {
205
+ if (pTextManage && !rzone. empty () ) {
206
+ pTextManage->AddText (_pFont, _pText, rzone , _c);
207
207
}
208
208
}
209
209
@@ -1023,17 +1023,12 @@ void TextWidget::Render() {
1023
1023
if (bNoMenu)
1024
1024
return ;
1025
1025
1026
- Vec3f ePos;
1027
- ePos.x = (float ) rZone.left ;
1028
- ePos.y = (float ) rZone.top ;
1029
- ePos.z = 1 ;
1030
-
1031
1026
if (bSelected) {
1032
- FontRenderText (pFont, ePos , lpszText, lColorHighlight);
1027
+ FontRenderText (pFont, rZone , lpszText, lColorHighlight);
1033
1028
} else if (enabled) {
1034
- FontRenderText (pFont, ePos , lpszText, lColor);
1029
+ FontRenderText (pFont, rZone , lpszText, lColor);
1035
1030
} else {
1036
- FontRenderText (pFont, ePos , lpszText, Color::grayb (127 ));
1031
+ FontRenderText (pFont, rZone , lpszText, Color::grayb (127 ));
1037
1032
}
1038
1033
1039
1034
}
@@ -1048,9 +1043,7 @@ void TextWidget::RenderMouseOver() {
1048
1043
GRenderer->SetRenderState (Renderer::AlphaBlending, true );
1049
1044
GRenderer->SetBlendFunc (Renderer::BlendOne, Renderer::BlendOne);
1050
1045
1051
- Vec3f ePos = Vec3f (Vec2f (rZone.topLeft ()), 1 .f );
1052
-
1053
- FontRenderText (pFont, ePos, lpszText, lColorHighlight);
1046
+ FontRenderText (pFont, rZone, lpszText, lColorHighlight);
1054
1047
1055
1048
GRenderer->SetRenderState (Renderer::AlphaBlending, false );
1056
1049
@@ -1083,10 +1076,6 @@ void TextWidget::RenderMouseOver() {
1083
1076
}
1084
1077
}
1085
1078
1086
- Vec2i TextWidget::GetTextSize () const {
1087
- return pFont->getTextSize (lpszText);
1088
- }
1089
-
1090
1079
CMenuState::CMenuState ()
1091
1080
: bReInitAll(false )
1092
1081
, eOldMenuState(NOP)
@@ -1370,9 +1359,9 @@ bool CheckboxWidget::OnMouseClick() {
1370
1359
break ;
1371
1360
}
1372
1361
case BUTTON_MENUOPTIONSAUDIO_EAX: {
1373
- ARXMenu_Options_Audio_SetEAX ((iState)?true :false );
1374
- }
1362
+ ARXMenu_Options_Audio_SetEAX (iState != 0 );
1375
1363
break ;
1364
+ }
1376
1365
case BUTTON_MENUOPTIONS_CONTROLS_INVERTMOUSE: {
1377
1366
ARXMenu_Options_Control_SetInvertMouse ((iState)?true :false );
1378
1367
}
@@ -2455,25 +2444,27 @@ void CycleTextWidget::AddText(TextWidget *_pText) {
2455
2444
_pText->Move (Vec2i (rZone.left + pLeftButton->rZone .width (), rZone.top + 0 ));
2456
2445
vText.push_back (_pText);
2457
2446
2458
- Vec2i textSize = _pText->GetTextSize ();
2447
+ Vec2i textSize = _pText->rZone . size ();
2459
2448
2460
2449
rZone.right = std::max (rZone.right , rZone.left + pLeftButton->rZone .width () + pRightButton->rZone .width () + textSize.x );
2461
2450
rZone.bottom = std::max (rZone.bottom , rZone.top + textSize.y );
2462
2451
2463
- pLeftButton->SetPos (Vec2i (rZone.left , rZone.top +(textSize.y >>2 )));
2464
- pRightButton->SetPos (Vec2i (rZone.right -pRightButton->rZone .width (), rZone.top +(textSize.y >>2 )));
2452
+ pLeftButton->SetPos (Vec2i (rZone.left ,
2453
+ rZone.top + rZone.height () / 2 - pLeftButton->rZone .height () / 2 ));
2454
+ pRightButton->SetPos (Vec2i (rZone.right - pRightButton->rZone .width (),
2455
+ rZone.top + rZone.height () / 2 - pRightButton->rZone .height () / 2 ));
2465
2456
2466
- int dx=rZone.right -rZone. left -pLeftButton->rZone .width ()-pRightButton->rZone .width ();
2457
+ int dx=rZone.width () -pLeftButton->rZone .width ()-pRightButton->rZone .width ();
2467
2458
// on recentre tout
2468
2459
std::vector<TextWidget*>::iterator it;
2469
2460
2470
2461
for (it = vText.begin (); it < vText.end (); ++it) {
2471
2462
TextWidget *pMenuElementText=*it;
2472
2463
2473
- textSize = pMenuElementText->GetTextSize ();
2464
+ textSize = pMenuElementText->rZone . size ();
2474
2465
2475
2466
int dxx=(dx-textSize.x )>>1 ;
2476
- pMenuElementText->SetPos (Vec2i (pLeftButton->rZone .right + dxx, rZone.top ));
2467
+ pMenuElementText->SetPos (Vec2i (pLeftButton->rZone .right + dxx, rZone.top + rZone. height () / 2 - textSize. y / 2 ));
2477
2468
}
2478
2469
}
2479
2470
@@ -2542,6 +2533,16 @@ bool CycleTextWidget::OnMouseClick() {
2542
2533
}
2543
2534
2544
2535
switch (iID) {
2536
+
2537
+ case BUTTON_MENUOPTIONSAUDIO_DEVICE: {
2538
+ if (iPos == 0 ) {
2539
+ ARXMenu_Options_Audio_SetDevice (" auto" );
2540
+ } else {
2541
+ ARXMenu_Options_Audio_SetDevice (vText.at (iPos)->lpszText );
2542
+ }
2543
+ break ;
2544
+ }
2545
+
2545
2546
case BUTTON_MENUOPTIONSVIDEO_RESOLUTION: {
2546
2547
std::string pcText = (vText.at (iPos))->lpszText ;
2547
2548
@@ -2566,14 +2567,6 @@ bool CycleTextWidget::OnMouseClick() {
2566
2567
}
2567
2568
break ;
2568
2569
}
2569
- case BUTTON_MENUOPTIONSAUDIO_BACKEND: {
2570
- switch ((vText.at (iPos))->eMenuState ) {
2571
- case OPTIONS_AUDIO_BACKEND_OPENAL: config.audio .backend = " OpenAL" ; break ;
2572
- case OPTIONS_AUDIO_BACKEND_AUTOMATIC: config.audio .backend = " auto" ; break ;
2573
- default : break ;
2574
- }
2575
- break ;
2576
- }
2577
2570
// MENUOPTIONS_VIDEO
2578
2571
case BUTTON_MENUOPTIONSVIDEO_OTHERSDETAILS: {
2579
2572
ARXMenu_Options_Video_SetDetailsQuality (iPos);
0 commit comments