Skip to content

Commit

Permalink
Show the recent stat change as green when it is a negative fire rate …
Browse files Browse the repository at this point in the history
…(lower is better)
  • Loading branch information
networkMe committed Sep 25, 2015
1 parent f7890ed commit f8c328c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/LoaderGUI.ui
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<number>1</number>
</property>
<property name="text">
<string>&lt;a href=&quot;https://github.com/networkMe/missinghud2/releases&quot;&gt;v1.2.0&lt;/a&gt;</string>
<string>&lt;a href=&quot;https://github.com/networkMe/missinghud2/releases&quot;&gt;v1.2.1&lt;/a&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
Expand Down
25 changes: 21 additions & 4 deletions src/dll/HUDStat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@
HUDStat::HUDStat(MHUDSTAT mhud_stat)
{
hud_stat_ = mhud_stat;

Color green(0, 200, 0);
Color red(200, 0, 0);
switch (mhud_stat)
{
case MHUDSTAT::kStat_FireRate:
{
negative_color_ = green;
positive_color_ = red;
} break;

default:
{
positive_color_ = green;
negative_color_ = red;
}
}
}

HUDStat::~HUDStat()
Expand All @@ -39,9 +56,9 @@ void HUDStat::Draw(glm::vec2 position, float stat_value, float stat_change, bool
// Draw the change in statistic value if it recently changed
position.x += text_render_size.x;
if (stat_change > 0.0f)
isaac_text->RenderText(position, "+" + NumToStr(stat_change, percentage), Color(0, 200, 0));
isaac_text->RenderText(position, "+" + NumToStr(stat_change, percentage), positive_color_);
else if (stat_change < 0.0f)
isaac_text->RenderText(position, NumToStr(stat_change, percentage), Color(200, 0, 0)); // Negative symbol automatic via C++
isaac_text->RenderText(position, NumToStr(stat_change, percentage), negative_color_); // Negative symbol automatic via C++
}

void HUDStat::Draw(glm::vec2 position, int stat_value, int stat_change)
Expand All @@ -60,9 +77,9 @@ void HUDStat::Draw(glm::vec2 position, int stat_value, int stat_change)
// Draw the change in statistic value if it recently changed
position.x += text_render_size.x;
if (stat_change > 0)
isaac_text->RenderText(position, "+" + NumToStr(stat_change), Color(0, 200, 0));
isaac_text->RenderText(position, "+" + NumToStr(stat_change), positive_color_);
else if (stat_change < 0)
isaac_text->RenderText(position, NumToStr(stat_change), Color(200, 0, 0)); // Negative symbol automatic via C++
isaac_text->RenderText(position, NumToStr(stat_change), negative_color_); // Negative symbol automatic via C++
}

std::string HUDStat::NumToStr(float number, bool percentage)
Expand Down
2 changes: 2 additions & 0 deletions src/dll/HUDStat.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class HUDStat

private:
MHUDSTAT hud_stat_;
Color positive_color_;
Color negative_color_;
};


Expand Down

0 comments on commit f8c328c

Please sign in to comment.