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

Method DoButton_CheckBox_Common

src/game/client/components/menus.cpp:280–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280int CMenus::DoButton_CheckBox_Common(const void *pId, const char *pText, const char *pBoxText, const CUIRect *pRect, const unsigned Flags)
281{
282 CUIRect Box, Label;
283 pRect->VSplitLeft(pRect->h, &Box, &Label);
284 Label.VSplitLeft(5.0f, nullptr, &Label);
285
286 Box.Margin(2.0f, &Box);
287 Box.Draw(ColorRGBA(1, 1, 1, 0.25f * Ui()->ButtonColorMul(pId)), IGraphics::CORNER_ALL, 3.0f);
288
289 const bool Checkable = *pBoxText == 'X';
290 if(Checkable)
291 {
292 TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE | ETextRenderFlags::TEXT_RENDER_FLAG_NO_PIXEL_ALIGNMENT);
293 TextRender()->SetFontPreset(EFontPreset::ICON_FONT);
294 Ui()->DoLabel(&Box, FontIcon::XMARK, Box.h * CUi::ms_FontmodHeight, TEXTALIGN_MC);
295 TextRender()->SetFontPreset(EFontPreset::DEFAULT_FONT);
296 }
297 else
298 Ui()->DoLabel(&Box, pBoxText, Box.h * CUi::ms_FontmodHeight, TEXTALIGN_MC);
299
300 TextRender()->SetRenderFlags(0);
301 Ui()->DoLabel(&Label, pText, Box.h * CUi::ms_FontmodHeight, TEXTALIGN_ML);
302
303 return Ui()->DoButtonLogic(pId, 0, pRect, Flags);
304}
305
306void CMenus::DoLaserPreview(const CUIRect *pRect, const ColorHSLA LaserOutlineColor, const ColorHSLA LaserInnerColor, const int LaserType)
307{

Callers

nothing calls this directly

Calls 11

UiFunction · 0.85
TextRenderFunction · 0.85
VSplitLeftMethod · 0.80
MarginMethod · 0.80
ButtonColorMulMethod · 0.80
SetRenderFlagsMethod · 0.80
DoLabelMethod · 0.80
ColorRGBAClass · 0.70
DrawMethod · 0.45
SetFontPresetMethod · 0.45
DoButtonLogicMethod · 0.45

Tested by

no test coverage detected