Thanks Oso-Grande/Sopadeoso For these awesom and stupidly clever Text Rotation routines... duh XD
| 4043 | } |
| 4044 | // Thanks Oso-Grande/Sopadeoso For these awesom and stupidly clever Text Rotation routines... duh XD |
| 4045 | void PixelGameEngine::DrawRotatedStringDecal(const olc::vf2d& pos, const std::string& sText, const float fAngle, const olc::vf2d& center, const Pixel col, const olc::vf2d& scale) |
| 4046 | { |
| 4047 | olc::vf2d spos = center; |
| 4048 | for (auto c : sText) |
| 4049 | { |
| 4050 | if (c == '\n') |
| 4051 | { |
| 4052 | spos.x = center.x; spos.y -= 8.0f; |
| 4053 | } |
| 4054 | else if (c == '\t') |
| 4055 | { |
| 4056 | spos.x += 8.0f * float(nTabSizeInSpaces) * scale.x; |
| 4057 | } |
| 4058 | else |
| 4059 | { |
| 4060 | int32_t ox = (c - 32) % 16; |
| 4061 | int32_t oy = (c - 32) / 16; |
| 4062 | DrawPartialRotatedDecal(pos, fontRenderable.Decal(), fAngle, spos, { float(ox) * 8.0f, float(oy) * 8.0f }, { 8.0f, 8.0f }, scale, col); |
| 4063 | spos.x -= 8.0f; |
| 4064 | } |
| 4065 | } |
| 4066 | } |
| 4067 | |
| 4068 | void PixelGameEngine::DrawRotatedStringPropDecal(const olc::vf2d& pos, const std::string& sText, const float fAngle, const olc::vf2d& center, const Pixel col, const olc::vf2d& scale) |
| 4069 | { |