Skip to content

Instantly share code, notes, and snippets.

@Reputeless
Created June 29, 2022 14:18
Show Gist options
  • Save Reputeless/62de5ce914b8ba8f4e8b470c998b359c to your computer and use it in GitHub Desktop.
Save Reputeless/62de5ce914b8ba8f4e8b470c998b359c to your computer and use it in GitHub Desktop.
# include <Siv3D.hpp>
void Main()
{
Window::Resize(1280, 720);
// Set background color to sky blue
Scene::SetBackground(ColorF{ 0.8, 0.9, 1.0 });
// Create a new font
const Font font{ 60 };
// Coordinates of the emoji
Vec2 emojiPos{ 300, 150 };
// Print a text
Print << U"Push [A] key";
while (System::Update())
{
// Put a text in the middle of the screen
font(U"Hello, Siv3D!").drawAt(Scene::Center(), Palette::Black);
// Draw a red transparent circle that follows the mouse cursor
Circle{ Cursor::Pos(), 40 }.draw(ColorF{ 1, 0, 0, 0.5 });
// When [A] key is down
if (KeyA.down())
{
// Print a randomly selected text
Print << Sample({ U"Hello!", U"こんにちは", U"你好", U"안녕하세요?" });
}
// When [Button] is pushed
if (SimpleGUI::Button(U"Button", Vec2{ 640, 40 }))
{
// Move the coordinates to a random position in the screen
emojiPos = RandomVec2(Scene::Rect());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment