From d9796041ca5876f88280ccb54560653e65e8da8a Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Sat, 30 Apr 2016 21:08:39 -0400 Subject: added TextureIterator --- src/inventory.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/inventory.cpp') 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 + +#include + #include #include #include @@ -296,6 +299,11 @@ void Inventory::draw(void) { } } a = 0; + auto averagef = [](const std::vector &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; -- cgit v1.2.3