diff --git a/source/application.cpp b/source/application.cpp index 552de59..d53f15a 100644 --- a/source/application.cpp +++ b/source/application.cpp @@ -731,7 +731,7 @@ namespace gmtk }); } - void draw(map & map, gfx::painter & painter) + void draw(map & map, gfx::painter & painter, float pixel_size) { map.world.apply([&](vertex const & v, crossing const & c) { @@ -800,7 +800,7 @@ namespace gmtk auto pen = v.location.bbox(-0.4f).corner(0.5f, 1.f); - float vs = std::pow(3.f, - v.location.level) * 0.01f; + float vs = 2.f * pixel_size; draw_item(stages[map.stage].type, pen, 1.f, painter); @@ -1384,6 +1384,7 @@ namespace gmtk gl::Clear(gl::COLOR_BUFFER_BIT); float view_level = view_stack_.back().level; + float pixel_size = view_box_[1].length() / screen_size_[1]; if (view_transition_) { @@ -1427,7 +1428,7 @@ namespace gmtk draw_selection(belt_start_->bbox(), painter_, {64, 64, 64, 255}); } - draw(map_, painter_); + draw(map_, painter_, pixel_size); { float w = (view_box_[0].length() - view_box_[1].length()) / 2.f; @@ -1524,7 +1525,8 @@ namespace gmtk { float const step = 0.5f * std::pow(3.f, - 1.f - view_level); - float vs = std::pow(3.f, - 1.f - view_level) * 0.01f; + + float vs = 2.f * pixel_size; geom::point pen = view_box_.corner(1, 1) - geom::vector{step, step} / 2.f; @@ -1550,8 +1552,7 @@ namespace gmtk if (type != card_type::eraser) { - auto color = (type != card_type::crossing) ? gfx::black : gfx::white; - painter_.text(box.center(), std::to_string(map_.cards.at(type)), {.scale = {vs, -vs}, .c = color}); + painter_.text(box.center() - geom::vector{step, 0.f}, std::to_string(map_.cards.at(type)), {.scale = {vs, -vs}, .c = gfx::black}); } pen[1] -= step;