MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / ChoiceOverlay

Method ChoiceOverlay

3ds/source/ChoiceOverlay.cpp:33–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31#include "util.hpp"
32
33ChoiceOverlay::ChoiceOverlay(Screen& screen, const std::string& text, Button first, Button second, u32 dismissKeys)
34 : Overlay(screen), mText(text), mButtons{std::move(first), std::move(second)}, mHid(2, 2), mDismissKeys(dismissKeys)
35{
36 // Size the card to the wrapped prompt (same math as MessageOverlay), so a
37 // long prompt grows the box instead of spilling out of it.
38 mLayout = ModalChrome::fitText(mText, SIZE, false);
39 mPosx = ceilf((320 - StringUtils::textWidth(mText, SIZE)) / 2);
40
41 for (size_t i = 0; i < 2; i++) {
42 mClick[i] = std::make_unique<Clickable>(
43 mButtons[i].x, mLayout.btnY, ModalChrome::BTN_HALF_W, ModalChrome::BTN_H, mButtons[i].bg, mButtons[i].fg, mButtons[i].label, true);
44 }
45}
46
47void ChoiceOverlay::drawTop(void) const
48{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected