diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2016-04-30 21:08:39 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2016-04-30 21:08:39 -0400 |
commit | d9796041ca5876f88280ccb54560653e65e8da8a (patch) | |
tree | 81ad290bffe543ef39bc5bba741d9c322e8ce593 /src/inventory.cpp | |
parent | bf3a781ab8ea7c00bf18c960bcb23e72da99bc7b (diff) |
added TextureIterator
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 78502a7..83c1f0a 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; |