Siv3D: C++ Library for Creative Coding¶

# include <Siv3D.hpp>
void Main()
{
// Set background color to sky blue
Scene::SetBackground(ColorF(0.8, 0.9, 1.0));
// Create a new font
const Font font(60);
// Create a new texture that contains a cat emoji
const Texture cat(Emoji(U"🐈"));
// Coordinates of the cat
Vec2 catPos(640, 450);
while (System::Update())
{
// Put a message in the middle of the screen
font(U"Hello, Siv3D!🐣").drawAt(Scene::Center(), Palette::Black);
// Display the texture with animated size
cat.resized(100 + Periodic::Sine0_1(1s) * 20).drawAt(catPos);
// Draw a translucent red 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 `Hello!`
Print << U"Hello!";
}
// When [Move the cat] button is pushed
if (SimpleGUI::Button(U"Move the cat", Vec2(600, 20)))
{
// Move the cat's coordinates to a random position in the screen
catPos = RandomVec2(Scene::Rect());
}
}
}
Getting started¶
Requirements¶
Windows¶
- Windows 7 SP1 / 8.1 / 10 (64-bit)
- Visual Studio 2019 version 16.4-
- Install Desktop development with C++ from the Visual Studio Installer
macOS¶
- macOS Mojave v10.14 or newer
- Xcode 11.3 or newer
Linux¶
Linux users must build OpenSiv3D from source. See Linux/README for further information.
Installing OpenSiv3D SDK v0.4.3¶
Windows¶
- Download OpenSiv3D Installer for Windows Desktop and run the installer.
Note
Use the Control Panel to uninstall OpenSiv3D SDK.
macOS¶
- Download OpenSiv3D Project Templates for macOS and extract its contents.
- (for macOS Catalina users) Move the SDK folder into
User/Applicationsfolder to prevent a file access permissions dialog from being displayed when a Xcode project is executed. Some folders such asUser/DesktopandUser/Downloadsrequire extra access permission.
Building an OpenSiv3D Application¶
Windows¶
- Lanuch Visual Studio 2019 and open a New Project Dialog by clicking Create a new project.
- Select OpenSiv3D(X.X.X) project and then click Next.
- Type a name for the project.
- Click OK to create the project.
- On the Build menu, click Build Solution.
- On the Debug menu, click Start Debugging.
macOS¶
- Open the project file
examples/empty/empty.xcodeprojin Xcode. - Click Run button ▶️ to build and run the application.
- (for macOS Catalina users) A file access permissions dialog can be inactivated by placing the project folder under
User/Applicationsfolder.
💗 Sponsors¶
- sknjpn
- アゲハマ
- chobby75
- papparappara
- (anonymous 😀)
- minachun
- Fuyutsubaki
- (anonymous 😊)
- (anonymous 🐝)
- (anonymous 🐠)
- 野菜ジュース