-
-
Save Reputeless/dc5bbdd1dd2137634894 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include <Siv3D.hpp> | |
void Main() | |
{ | |
const Font font(20); | |
while (System::Update()) | |
{ | |
const String string = L"The quick brown fox jumps over the lazy dog\nあいう え お か き くけこ"; | |
std::vector<Vec2> offsets; | |
auto kineticFunction = [&](KineticTypography& k) | |
{ | |
offsets.push_back(k.pos); // 座標を記録 | |
k.pos.y = -1000; // 記録したら画面外に飛ばす | |
}; | |
font.drawKinetic(string, Vec2::Zero, kineticFunction); | |
size_t index = 0; | |
for (auto ch : string) | |
{ | |
if (Char(ch).isSpace) | |
{ | |
continue; | |
} | |
const TextureRegion textureRegion = font.getTexture(ch); | |
if (textureRegion.size.x == 0) | |
{ | |
continue; | |
} | |
if (index >= offsets.size()) | |
{ | |
break; | |
} | |
textureRegion | |
.rotate(Mouse::Pos().x/100.0) | |
.draw(offsets[index]); | |
++index; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment