MCPcopy Create free account
hub / github.com/davemoore22/sorcery / draw

Method draw

src/gui/menu.cpp:75–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73
74auto Sorcery::Menu::regenerate() -> void {
75
76 _ctx.menubuilder->build(_name, _width, _items, _data, _reorder);
77}
78
79auto Sorcery::Menu::draw() -> void {
80
81 with_Window(WINDOW_LAYER_MENUS, nullptr,
82 ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoTitleBar) {
83
84 const auto col{_ctx.ui->get_hl_colour(_ctx.animation->lerp)};
85 set_Font(
86 _ctx.ui->fontstore->get_current_font(Enums::Layout::Font::MONOSPACE)
87 .value(),
88 _ctx.ui->font_sz());
89 const auto sz{
90 ImVec2{static_cast<float>(_width * _ctx.ui->font_sz()),
91 static_cast<float>(
92 (_height * ImGui::GetTextLineHeightWithSpacing()) + 2)}};
93
94 // Note that _pos is in grid units whereas sz is in pixels!
95 _ctx.ui->draw_menu(_name, col, _pos, sz, _font, _items, _data, _reorder,
96 _across, _numeric_input);
97
98 // Handle SpecialEvents such as Reordering Party Menu
99 if (_ctx.controller->has_flag("party_order_changed")) {
100
101 _game->state->reorder_party(_ctx.controller->get_candidate_party());
102 regenerate();
103 _ctx.controller->clear_candidate_party();
104 _ctx.controller->unset_flag("party_order_changed");
105 }

Callers

nothing calls this directly

Calls 9

with_WindowFunction · 0.85
get_hl_colourMethod · 0.80
get_current_fontMethod · 0.80
draw_menuMethod · 0.80
has_flagMethod · 0.80
reorder_partyMethod · 0.80
get_candidate_partyMethod · 0.80
clear_candidate_partyMethod · 0.80
unset_flagMethod · 0.80

Tested by

no test coverage detected