| 4157 | } |
| 4158 | |
| 4159 | olc::vi2d PixelGameEngine::GetTextSizeProp(const std::string& s) |
| 4160 | { |
| 4161 | olc::vi2d size = { 0,1 }; |
| 4162 | olc::vi2d pos = { 0,1 }; |
| 4163 | for (auto c : s) |
| 4164 | { |
| 4165 | if (c == '\n') { pos.y += 1; pos.x = 0; } |
| 4166 | else if (c == '\t') { pos.x += nTabSizeInSpaces * 8; } |
| 4167 | else pos.x += vFontSpacing[c - 32].y; |
| 4168 | size.x = std::max(size.x, pos.x); |
| 4169 | size.y = std::max(size.y, pos.y); |
| 4170 | } |
| 4171 | |
| 4172 | size.y *= 8; |
| 4173 | return size; |
| 4174 | } |
| 4175 | |
| 4176 | void PixelGameEngine::DrawStringProp(const olc::vi2d& pos, const std::string& sText, Pixel col, uint32_t scale) |
| 4177 | { |
no outgoing calls
no test coverage detected