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

Method _render_wireframe

src/core/render.cpp:617–1075  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

615}
616
617auto Sorcery::Render::_render_wireframe(Component *component) -> void {
618
619 const auto player_pos{_ctx.game->state->get_player_pos()};
620 const auto player_facing{_ctx.game->state->get_player_facing()};
621 const auto &metrics{_ctx.display->get_display_metrics()};
622 const auto scale{metrics.scale};
623 const auto width{scale * _pane_size.x};
624 const auto height{scale * _pane_size.y};
625 const auto x{std::invoke([&] {
626 if (component->x == -1) {
627 const auto viewport{ImGui::GetMainViewport()};
628 return (viewport->Size.x - width) / 2;
629 } else
630 return static_cast<float>(width);
631 })};
632 const auto y{std::invoke([&] {
633 if (component->y == -1) {
634 const auto viewport{ImGui::GetMainViewport()};
635 return (viewport->Size.y - height) / 2;
636 } else
637 return static_cast<float>(height);
638 })};
639 const ImVec2 pos{x, y};
640
641 // TODO - change level at to use z- into the screen
642 const auto tl0{
643 _ctx.game->state->level->at(player_pos, player_facing, -1, 0)};
644 auto vl0{_tileviews.at(Coordinate3{-1, 0, 0})};
645 const auto tm0{
646 _ctx.game->state->level->at(player_pos, player_facing, 0, 0)};
647 auto vm0{_tileviews.at(Coordinate3{0, 0, 0})};
648 const auto tr0{
649 _ctx.game->state->level->at(player_pos, player_facing, 1, 0)};
650 auto vr0{_tileviews.at(Coordinate3{1, 0, 0})};
651
652 const auto tl1{
653 _ctx.game->state->level->at(player_pos, player_facing, -1, 1)};
654 auto vl1{_tileviews.at(Coordinate3{-1, 0, -1})};
655 const auto tm1{
656 _ctx.game->state->level->at(player_pos, player_facing, 0, 1)};
657 auto vm1{_tileviews.at(Coordinate3{0, 0, -1})};
658 const auto tr1{
659 _ctx.game->state->level->at(player_pos, player_facing, 1, 1)};
660 auto vr1{_tileviews.at(Coordinate3{1, 0, -1})};
661
662 const auto tl2{
663 _ctx.game->state->level->at(player_pos, player_facing, -1, 2)};
664 auto vl2{_tileviews.at(Coordinate3{-1, 0, -2})};
665 const auto tm2{
666 _ctx.game->state->level->at(player_pos, player_facing, 0, 2)};
667 auto vm2{_tileviews.at(Coordinate3{0, 0, -2})};
668 const auto tr2{
669 _ctx.game->state->level->at(player_pos, player_facing, 1, 2)};
670 auto vr2{_tileviews.at(Coordinate3{1, 0, -2})};
671
672 const auto tl3{
673 _ctx.game->state->level->at(player_pos, player_facing, -1, 3)};
674 auto vl3{_tileviews.at(Coordinate3{-1, 0, -3})};

Callers

nothing calls this directly

Calls 6

get_player_posMethod · 0.80
get_player_facingMethod · 0.80
isMethod · 0.80
get_litMethod · 0.80
atMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected