@@ -1475,69 +1475,24 @@ void Skin::drawRibbonChild(const core::recti &rect, Widget* widget,
1475
1475
}
1476
1476
}
1477
1477
1478
+ // Handle focus from players
1478
1479
1479
- // Handle drawing for the first player
1480
1480
int nPlayersOnThisItem = 0 ;
1481
1481
1482
1482
if (mark_focused)
1483
1483
{
1484
- if (use_glow)
1485
- {
1486
- // don't mark filler items as focused
1487
- if (widget->m_properties [PROP_ID] == RibbonWidget::NO_ITEM_ID)
1488
- return ;
1489
-
1490
- static float glow_effect = 0 ;
1491
-
1492
- const float dt = GUIEngine::getLatestDt ();
1493
- glow_effect += dt * 3 ;
1494
- if (glow_effect > 6 .2832f /* 2*PI */ ) glow_effect -= 6 .2832f ;
1495
- float grow = 10 .0f * sinf (glow_effect);
1496
-
1497
- const int glow_center_x = rect.UpperLeftCorner .X
1498
- + rect.getWidth () / 2 ;
1499
- const int glow_center_y = rect.LowerRightCorner .Y ;
1500
-
1501
- ITexture* tex_ficonhighlight =
1502
- SkinConfig::m_render_params[" focusHalo::neutral" ]
1503
- .getImage ();
1504
- const int texture_w = tex_ficonhighlight->getSize ().Width ;
1505
- const int texture_h = tex_ficonhighlight->getSize ().Height ;
1506
-
1507
- core::recti source_area (0 , 0 , texture_w, texture_h);
1508
-
1509
- float scale = (float )std::min (irr_driver->getActualScreenSize ().Height / 1080 .0f ,
1510
- irr_driver->getActualScreenSize ().Width / 1350 .0f );
1511
- int size = (int )((90 .0f + grow) * scale);
1512
- const core::recti rect2 (glow_center_x - size,
1513
- glow_center_y - size / 2 ,
1514
- glow_center_x + size,
1515
- glow_center_y + size / 2 );
1516
-
1517
- draw2DImage (tex_ficonhighlight, rect2,
1518
- source_area,
1519
- /* clipping*/ 0 ,
1520
- /* color*/ 0 ,
1521
- /* alpha*/ true );
1522
- }
1523
- // if we're not using glow, draw square focus instead
1524
- else
1525
- {
1526
- const bool show_focus = (focused || parent_focused);
1527
-
1528
- if (!always_show_selection && !show_focus) return ;
1529
-
1530
- // don't mark filler items as focused
1531
- if (widget->m_properties [PROP_ID] == RibbonWidget::NO_ITEM_ID)
1532
- return ;
1533
-
1534
- drawBoxFromStretchableTexture (parentRibbonWidget, rect,
1535
- SkinConfig::m_render_params[" squareFocusHalo1::neutral" ]);
1536
- nPlayersOnThisItem++;
1537
- }
1538
- } // end if mark_focused
1539
-
1540
- // Handle drawing for everyone else
1484
+ // Don't mark filler items as focused
1485
+ if (widget->m_properties [PROP_ID] == RibbonWidget::NO_ITEM_ID)
1486
+ return ;
1487
+
1488
+ // Hide focus when not forced
1489
+ if (!always_show_selection && !focused && !parent_focused)
1490
+ return ;
1491
+
1492
+ nPlayersOnThisItem = 1 ;
1493
+ }
1494
+
1495
+ // Handle drawing for everyone else
1541
1496
for (unsigned i = 1 ; i < MAX_PLAYER_COUNT; i++)
1542
1497
{
1543
1498
// ---- Draw selection for other players than player 1
@@ -1595,6 +1550,52 @@ void Skin::drawRibbonChild(const core::recti &rect, Widget* widget,
1595
1550
}
1596
1551
}
1597
1552
1553
+ // Handle drawing for the first player
1554
+ if (mark_focused)
1555
+ {
1556
+ if (use_glow)
1557
+ {
1558
+ static float glow_effect = 0 ;
1559
+
1560
+ const float dt = GUIEngine::getLatestDt ();
1561
+ glow_effect += dt * 3 ;
1562
+ if (glow_effect > 6 .2832f /* 2*PI */ ) glow_effect -= 6 .2832f ;
1563
+ float grow = 10 .0f * sinf (glow_effect);
1564
+
1565
+ const int glow_center_x = rect.UpperLeftCorner .X
1566
+ + rect.getWidth () / 2 ;
1567
+ const int glow_center_y = rect.LowerRightCorner .Y ;
1568
+
1569
+ ITexture* tex_ficonhighlight =
1570
+ SkinConfig::m_render_params[" focusHalo::neutral" ]
1571
+ .getImage ();
1572
+ const int texture_w = tex_ficonhighlight->getSize ().Width ;
1573
+ const int texture_h = tex_ficonhighlight->getSize ().Height ;
1574
+
1575
+ core::recti source_area (0 , 0 , texture_w, texture_h);
1576
+
1577
+ float scale = (float )std::min (irr_driver->getActualScreenSize ().Height / 1080 .0f ,
1578
+ irr_driver->getActualScreenSize ().Width / 1350 .0f );
1579
+ int size = (int )((90 .0f + grow) * scale);
1580
+ const core::recti rect2 (glow_center_x - size,
1581
+ glow_center_y - size / 2 ,
1582
+ glow_center_x + size,
1583
+ glow_center_y + size / 2 );
1584
+
1585
+ draw2DImage (tex_ficonhighlight, rect2,
1586
+ source_area,
1587
+ /* clipping*/ 0 ,
1588
+ /* color*/ 0 ,
1589
+ /* alpha*/ true );
1590
+ }
1591
+ // if we're not using glow, draw square focus instead
1592
+ else
1593
+ {
1594
+ drawBoxFromStretchableTexture (parentRibbonWidget, rect,
1595
+ SkinConfig::m_render_params[" squareFocusHalo1::neutral" ]);
1596
+ }
1597
+ } // end if mark_focused
1598
+
1598
1599
drawIconButton (rect, widget, pressed, focused);
1599
1600
1600
1601
} // end if icon ribbons
0 commit comments