MCPcopy Create free account
hub / github.com/OneLoneCoder/olcPixelGameEngine / DrawStringPropDecal

Method DrawStringPropDecal

olcPixelGameEngine.h:4022–4043  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4020 }
4021
4022 void PixelGameEngine::DrawStringPropDecal(const olc::vf2d& pos, const std::string& sText, const Pixel col, const olc::vf2d& scale)
4023 {
4024 olc::vf2d spos = { 0.0f, 0.0f };
4025 for (auto c : sText)
4026 {
4027 if (c == '\n')
4028 {
4029 spos.x = 0; spos.y += 8.0f * scale.y;
4030 }
4031 else if (c == '\t')
4032 {
4033 spos.x += 8.0f * float(nTabSizeInSpaces) * scale.x;
4034 }
4035 else
4036 {
4037 int32_t ox = (c - 32) % 16;
4038 int32_t oy = (c - 32) / 16;
4039 DrawPartialDecal(pos + spos, fontRenderable.Decal(), { float(ox) * 8.0f + float(vFontSpacing[c - 32].x), float(oy) * 8.0f }, { float(vFontSpacing[c - 32].y), 8.0f }, scale, col);
4040 spos.x += float(vFontSpacing[c - 32].y) * scale.x;
4041 }
4042 }
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 {

Callers

nothing calls this directly

Calls 1

DecalMethod · 0.80

Tested by

no test coverage detected