MCPcopy Create free account
hub / github.com/ddnet/ddnet / DoButtonLogic

Method DoButtonLogic

src/game/client/ui.cpp:510–545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508}
509
510int CUi::DoButtonLogic(const void *pId, int Checked, const CUIRect *pRect, const unsigned Flags)
511{
512 int ReturnValue = 0;
513 const bool Inside = MouseHovered(pRect);
514
515 if(CheckActiveItem(pId))
516 {
517 dbg_assert(m_ActiveButtonLogicButton >= 0, "m_ActiveButtonLogicButton invalid");
518 if(!MouseButton(m_ActiveButtonLogicButton))
519 {
520 if(Inside && Checked >= 0)
521 ReturnValue = 1 + m_ActiveButtonLogicButton;
522 SetActiveItem(nullptr);
523 m_ActiveButtonLogicButton = -1;
524 }
525 }
526
527 bool NoRelevantButtonsPressed = true;
528 for(int Button = 0; Button < 3; ++Button)
529 {
530 if((Flags & (BUTTONFLAG_LEFT << Button)) && MouseButton(Button))
531 {
532 NoRelevantButtonsPressed = false;
533 if(HotItem() == pId)
534 {
535 SetActiveItem(pId);
536 m_ActiveButtonLogicButton = Button;
537 }
538 }
539 }
540
541 if(Inside && NoRelevantButtonsPressed)
542 SetHotItem(pId);
543
544 return ReturnValue;
545}
546
547int CUi::DoDraggableButtonLogic(const void *pId, int Checked, const CUIRect *pRect, bool *pClicked, bool *pAbrupted)
548{

Callers 15

DoNextItemMethod · 0.45
DoButton_ToggleMethod · 0.45
DoButton_MenuMethod · 0.45
DoButton_MenuTabMethod · 0.45
DoButton_GridHeaderMethod · 0.45
DoButton_FavoriteMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected