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

Method DrawStringDecal

olcPixelGameEngine.h:3999–4020  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3997 }
3998
3999 void PixelGameEngine::DrawStringDecal(const olc::vf2d& pos, const std::string& sText, const Pixel col, const olc::vf2d& scale)
4000 {
4001 olc::vf2d spos = { 0.0f, 0.0f };
4002 for (auto c : sText)
4003 {
4004 if (c == '\n')
4005 {
4006 spos.x = 0; spos.y += 8.0f * scale.y;
4007 }
4008 else if (c == '\t')
4009 {
4010 spos.x += 8.0f * float(nTabSizeInSpaces) * scale.x;
4011 }
4012 else
4013 {
4014 int32_t ox = (c - 32) % 16;
4015 int32_t oy = (c - 32) / 16;
4016 DrawPartialDecal(pos + spos, fontRenderable.Decal(), { float(ox) * 8.0f, float(oy) * 8.0f }, { 8.0f, 8.0f }, scale, col);
4017 spos.x += 8.0f * scale.x;
4018 }
4019 }
4020 }
4021
4022 void PixelGameEngine::DrawStringPropDecal(const olc::vf2d& pos, const std::string& sText, const Pixel col, const olc::vf2d& scale)
4023 {

Callers

nothing calls this directly

Calls 1

DecalMethod · 0.80

Tested by

no test coverage detected