diff options
author | drumsetmonkey <abelleisle@roadrunner.com> | 2016-05-02 07:36:43 -0400 |
---|---|---|
committer | drumsetmonkey <abelleisle@roadrunner.com> | 2016-05-02 07:36:43 -0400 |
commit | c61cbf691bee6dec791c3a161145ae16b448ac2b (patch) | |
tree | c276a82d88353d2863bd4da76a77715bab7bc4f2 /src/inventory.cpp | |
parent | 992969772def3578acbd1cef0155333636f75862 (diff) | |
parent | afa34b3140979874d46a362e83dc0d1eebd137eb (diff) |
Merge branch 'master' of https://github.com/tcsullivan/gamedev
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r-- | src/inventory.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp index ab31277..ff7284f 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -1,4 +1,7 @@ #include <inventory.hpp> + +#include <numeric> + #include <entities.hpp> #include <ui.hpp> #include <gametime.hpp> @@ -296,6 +299,11 @@ void Inventory::draw(void) { } } a = 0; + auto averagef = [](const std::vector<int> &v) { + auto sum = std::accumulate(std::begin(v), std::end(v), 0); + return sum / v.size(); + }; + ui::fontTransInv = 255 * (averagef(dfp) / range); if (ui::fontTransInv > 255) ui::fontTransInv = 255; |