MCPcopy Create free account
hub / github.com/NetHack/NetHack / InitHitpointBar

Method InitHitpointBar

win/Qt/qt_stat.cpp:588–613  ·  view source on GitHub ↗

hitpointbar: two panels: left==current health, right==missing max health

Source from the content-addressed store, hash-verified

586
587// hitpointbar: two panels: left==current health, right==missing max health
588QHBoxLayout *NetHackQtStatusWindow::InitHitpointBar()
589{
590 hpbar_health.setFrameStyle(QFrame::NoFrame);
591 hpbar_health.setMaximumHeight(9);
592 hpbar_health.setAutoFillBackground(true);
593 if (!iflags.wc2_hitpointbar)
594 hpbar_health.hide();
595
596 hpbar_injury.setFrameStyle(QFrame::NoFrame);
597 /* health portion has thickness 9, injury portion just 3 */
598 hpbar_injury.setMaximumHeight(3);
599 hpbar_injury.setContentsMargins(0, 3, 0, 3); // left,top,right,bottom
600 hpbar_injury.setAutoFillBackground(true);
601 hpbar_injury.hide(); // only shown when hitpointbar is On and uhp < uhpmax
602
603 QHBoxLayout *hpbar = new QHBoxLayout;
604 hpbar->setSpacing(0);
605#if QT_VERSION < 0x060000
606 hpbar->setMargin(0);
607#endif
608 hpbar->addWidget(&hpbar_health);
609 hpbar->setAlignment(&hpbar_health, Qt::AlignLeft);
610 hpbar->addWidget(&hpbar_injury);
611 hpbar->setAlignment(&hpbar_injury, Qt::AlignRight);
612 return hpbar; // caller will add our result to vbox layout
613}
614
615DISABLE_WARNING_FORMAT_NONLITERAL
616

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected