Add more helper text
This commit is contained in:
parent
4e95620160
commit
31939f7032
1 changed files with 73 additions and 5 deletions
|
|
@ -191,6 +191,38 @@ namespace gmtk
|
|||
},
|
||||
};
|
||||
|
||||
std::optional<transformer_type> transformer_for(resource_type const & type)
|
||||
{
|
||||
if (type == resource_type{color_type::gray, shape_type::circle})
|
||||
return transformer_type::mixer;
|
||||
|
||||
if (type == resource_type{color_type::green, shape_type::circle})
|
||||
return transformer_type::hue_shifter;
|
||||
|
||||
if (type == resource_type{color_type::green, shape_type::square})
|
||||
return transformer_type::reshaper;
|
||||
|
||||
if (type == resource_type{color_type::blue, shape_type::square})
|
||||
return transformer_type::reshaper;
|
||||
|
||||
if (type == resource_type{color_type::yellow, shape_type::square})
|
||||
return transformer_type::reshaper;
|
||||
|
||||
if (type == resource_type{color_type::cyan, shape_type::square})
|
||||
return transformer_type::reshaper;
|
||||
|
||||
if (type == resource_type{color_type::magenta, shape_type::square})
|
||||
return transformer_type::reshaper;
|
||||
|
||||
if (type == resource_type{color_type::black, shape_type::square})
|
||||
return transformer_type::mixer;
|
||||
|
||||
if (type == resource_type{color_type::white, shape_type::square})
|
||||
return transformer_type::mixer;
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
geom::vector<int, 2> const neighbours[4]
|
||||
{
|
||||
{1, 0},
|
||||
|
|
@ -2166,6 +2198,7 @@ namespace gmtk
|
|||
float pixel_size = view_box_[1].length() / screen_size_[1];
|
||||
|
||||
std::vector<std::string> helper_text;
|
||||
std::optional<resource_type> helper_resource;
|
||||
|
||||
if (view_transition_)
|
||||
{
|
||||
|
|
@ -2400,10 +2433,23 @@ namespace gmtk
|
|||
helper_text = card_description(card_type::crossing);
|
||||
else if (acc.contains<zoomer>())
|
||||
helper_text = card_description(card_type::zoomer);
|
||||
else if (acc.contains<source>())
|
||||
helper_text = {"Source", "Generates circles"};
|
||||
else if (auto s = acc.get_if<source>())
|
||||
{
|
||||
helper_text = {"Source", "Produces "};
|
||||
helper_resource = s->type;
|
||||
}
|
||||
else if (acc.contains<lab>())
|
||||
helper_text = {"Consumer", "Consumes produced items"};
|
||||
{
|
||||
if (is_sandbox_mode_)
|
||||
{
|
||||
helper_text = {"Consumer", "Consumes items"};
|
||||
}
|
||||
else
|
||||
{
|
||||
helper_text = {"Consumer", "Consumes "};
|
||||
helper_resource = stages[map_.stage].type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!in_menu() && helper_text.empty())
|
||||
|
|
@ -2443,11 +2489,33 @@ namespace gmtk
|
|||
geom::point<float, 2> pen = view_box_.corner(0, 1) + geom::vector{18.f, -24.f} * pixel_size;
|
||||
float s = 2.f * pixel_size;
|
||||
|
||||
gfx::painter::text_options opts{.scale = {s, -s}, .x = gfx::painter::x_align::left, .y = gfx::painter::y_align::top, .c = gfx::black};
|
||||
|
||||
std::string extra_line;
|
||||
|
||||
for (int i = 0; i < helper_text.size(); ++i)
|
||||
{
|
||||
painter_.text(pen, helper_text[i], {.scale = {s, -s}, .x = gfx::painter::x_align::left, .y = gfx::painter::y_align::top, .c = gfx::black});
|
||||
painter_.text(pen, helper_text[i], opts);
|
||||
|
||||
if (i + 1 == helper_text.size() && helper_resource)
|
||||
{
|
||||
float text_width = painter_.text_size(helper_text[i])[0] * s;
|
||||
draw_item(*helper_resource, {pen[0] + text_width + 18.f * pixel_size, pen[1] - 12.f * pixel_size}, 1.f, painter_);
|
||||
|
||||
if (auto t = transformer_for(*helper_resource))
|
||||
{
|
||||
extra_line = util::to_string("(use ", *t, " to make it)");
|
||||
std::replace(extra_line.begin(), extra_line.end(), '_', ' ');
|
||||
}
|
||||
}
|
||||
|
||||
pen[1] -= 32.f * pixel_size;
|
||||
}
|
||||
|
||||
if (!extra_line.empty())
|
||||
{
|
||||
painter_.text(pen, extra_line, opts);
|
||||
}
|
||||
}
|
||||
|
||||
if (!in_start_menu_)
|
||||
|
|
@ -2763,7 +2831,7 @@ namespace gmtk
|
|||
void reshaper_sound()
|
||||
{
|
||||
if (in_start_menu_) return;
|
||||
mixer_->add(audio::volume(key_click_->stream(), 0.375f));
|
||||
mixer_->add(audio::volume(key_click_->stream(), 0.25f));
|
||||
}
|
||||
|
||||
void item_removed_sound()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue