| 4089 | } |
| 4090 | |
| 4091 | olc::vi2d PixelGameEngine::GetTextSize(const std::string& s) |
| 4092 | { |
| 4093 | olc::vi2d size = { 0,1 }; |
| 4094 | olc::vi2d pos = { 0,1 }; |
| 4095 | for (auto c : s) |
| 4096 | { |
| 4097 | if (c == '\n') { pos.y++; pos.x = 0; } |
| 4098 | else if (c == '\t') { pos.x += nTabSizeInSpaces; } |
| 4099 | else pos.x++; |
| 4100 | size.x = std::max(size.x, pos.x); |
| 4101 | size.y = std::max(size.y, pos.y); |
| 4102 | } |
| 4103 | return size * 8; |
| 4104 | } |
| 4105 | |
| 4106 | void PixelGameEngine::DrawString(const olc::vi2d& pos, const std::string& sText, Pixel col, uint32_t scale) |
| 4107 | { |
nothing calls this directly
no outgoing calls
no test coverage detected