Archimedes/Dash Da Capo!
Loading...
Searching...
No Matches
padMenuStrings.h
1// outdated function that we used as a hack for trying to
2// straighten text rendering
3// pads strings with white space so that they get rendered properly in menus
4// takes the longest string as reference
5// may need to have a minimum length otherwise
6#include "pch.h"
7
8std::vector<std::string> padMenuStrings(const std::vector<std::string>& strs)
9{
10 int maxLength = INT_MIN;
11 for (auto s: strs)
12 {
13 maxLength = std::max<int>(maxLength, s.length());
14 }
15 std::vector<std::string> padded;
16
17 for (auto s: strs)
18 {
19 while(s.length() != maxLength)
20 {
21 s += " ";
22 }
23 padded.push_back(s);
24 }
25
26 return padded;
27}