SkillAgentSearch skills...

OpenSiv3D

C++20 framework for creative coding ๐ŸŽฎ๐ŸŽจ๐ŸŽน / Cross-platform support (Windows, macOS, Linux, and the Web)

Install / Use

/learn @Siv3D/OpenSiv3D
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<h1>Siv3D <a href="https://github.com/Siv3D/OpenSiv3D/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-4aaa4a"></a> <a href="https://discord.gg/mzevvsY"><img src="https://img.shields.io/badge/social-Discord-404eed"></a> <a href="https://twitter.com/search?q=Siv3D%20OR%20OpenSiv3D&src=typed_query&f=live"><img src="https://img.shields.io/badge/social-Twitter-1DA1F2"></a> <a href="https://github.com/sponsors/Reputeless"><img src="https://img.shields.io/badge/funding-GitHub_Sponsors-ea4aaa"></a></h1> <p align="center"><a href="https://siv3d.github.io/"><img src="https://raw.githubusercontent.com/Siv3D/File/master/v6/logo.png" width="480" alt="Siv3D logo"></a></p>

Siv3D (formerly known as OpenSiv3D) is a C++20 framework for creative coding (2D/3D games, media art, visualizers, and simulators). Siv3D applications run on Windows, macOS, Linux, and the Web.

Features

  • Graphics
    • Advanced 2D graphics
    • Basic 3D graphics (Wavefront OBJ, primitive shapes)
    • Custom vertex / pixel shaders (HLSL, GLSL)
    • Text rendering (Bitmap, SDF, MSDF)
    • PNG, JPEG, BMP, SVG, GIF, Animated GIF, TGA, PPM, WebP, TIFF
    • Unicode 15.1 emojis and 7,000+ icons
    • Image processing
    • Video rendering
  • Audio
    • WAVE, MP3, AAC, OggVorbis, Opus, MIDI, WMA*, FLAC*, AIFF*
    • Adjustable volume, pan, play speed and pitch
    • File streaming (WAVE, MP3, OggVorbis)
    • Fade in and fade out
    • Looping
    • Mixing busses
    • Filters (LPF, HPF, echo, reverb)
    • FFT
    • SoundFont rendering
    • Text to speech*
  • Input
    • Mouse
    • Keyboard
    • Gamepad
    • Webcam
    • Microphone
    • Joy-Con / Pro Controller
    • XInput*
    • Digital drawing tablet*
    • Leap Motion*
  • Window
    • Fullscreen mode
    • High DPI support
    • Window styles (sizable, borderless)
    • File dialog
    • Drag & drop
    • Message box
    • Toast notification*
  • Network and communication
    • HTTP client
    • Multiplayer (with Photon SDK)
    • TCP communication
    • Serial communication
    • Interprocess communication (pipe)
    • OSC (Open Sound Control)
  • Math
    • Vector and matrix classes (Point, Float2, Vec2, Float3, Vec3, Float4, Vec4, Mat3x2, Mat3x3, Mat4x4, SIMD_Float4, Quaternion)
    • 2D shape classes (Line, Circle, Ellipse, Rect, RectF, Triangle, Quad, RoundRect, Polygon, MultiPolygon, LineString, Spline2D, Bezier2, Bezier3)
    • 3D shape classes (Plane, InfinitePlane, Sphere, Box, OrientedBox, Ray, Line3D, Triangle3D, ViewFrustum, Disc, Cylinder, Cone)
    • Color classes (Color, ColorF, HSV)
    • Polar / cylindrical / spherical coordinates system
    • 2D / 3D shape intersection
    • 2D / 3D geometry processing
    • Rectangle packing
    • Planar subdivisions
    • Linear and gamma color space
    • Pseudo random number generators
    • Interpolation, easing, and smoothing
    • Perlin noise
    • Math parser
    • Navigation mesh
    • Extended arithmetic types (HalfFloat, int128, uint128, BigInt, BigFloat)
  • String and Text Processing
    • Advanced String class (String, StringView)
    • Unicode conversion
    • Regular expression
    • {fmt} style text formatting
    • Text reader / writer classes
    • CSV / INI / JSON / XML / TOML reader classes
    • CSV / INI / JSON writer classes
    • JSON Validation
  • Misc
    • Basic GUI (button, slider, radio buttons, checkbox, text box, color picker, list box, menu bar, table)
    • Integrated 2D physics engine (Box2D)
    • Advanced array / 2D array classes (Array, Grid)
    • Kd-tree
    • Disjoint set
    • Asynchronous asset file streaming
    • Data compression (zlib, Zstandard)
    • Transitions between scenes
    • File system
    • Directory watcher
    • QR code reader / writer
    • GeoJSON
    • Date and time
    • Stopwatch and timer
    • Logging
    • Serialization
    • UUID
    • Child process
    • Clipboard
    • Power status
    • Scripting (AngelScript)
    • OpenAI API (Chat, Vision, Image, Speech, Embedding)

<small>* Some features are limited to specific platforms</small>

How to Install Siv3D + Tutorial

  • (English) Getting Started with Siv3D: https://siv3d.github.io/en-us/
  • (ๆ—ฅๆœฌ่ชž) Siv3D ใ‚’ใฏใ˜ใ‚ใ‚ˆใ†: https://siv3d.github.io/ja-jp/

v0.6.16 | released 7 April 2025 | Release Notes

| Platform | SDK | Requirements | |:------------------:|:----------:|:------------------------------| | Windows | Download SDK /<br>SDK ใ‚’ใƒ€ใ‚ฆใƒณใƒญใƒผใƒ‰ | - Windows 10 / 11 (64-bit)<br>- Microsoft Visual C++ 2022 17.10<br>- Windows 10 SDK<br>- Intel / AMD CPU | | macOS | Download SDK /<br>SDK ใ‚’ใƒ€ใ‚ฆใƒณใƒญใƒผใƒ‰ | - macOS Ventura / Sonoma / Sequoia<br>- Xcode 14.3 or newer<br>- Intel CPU / Apple Silicon (Rosetta mode)*<br>- OpenGL 4.1 compatible hardware | | Linux | Compiling for Linux /<br>Linux ็‰ˆใฎใƒ“ใƒซใƒ‰ | - Ubuntu 20.04 LTS / 22.04 LTS<br>- GCC 9.3.0 (with Boost 1.71.0) / GCC 11.2 (with Boost 1.74.0)<br>- Intel / AMD CPU<br>- OpenGL 4.1 compatible hardware |

<small>* Native support for Apple Silicon is planned for Siv3D v0.8. Currently, Siv3D can be built and run using Rosetta emulation.</small>

Next Major Update

The next major update, Siv3D v0.8, is under development in the following repository.

  • https://github.com/Siv3D/siv8

Community

Miscellaneous

Supporting the Project

If you would like to support the project financially, visit my GitHub Sponsors page. Your support will accelerate the development of this exciting framework.

๐Ÿ’— https://github.com/sponsors/Reputeless

Examples

1. Hello, Siv3D!

Screenshot

# include <Siv3D.hpp>

void Main()
{
	// ่ƒŒๆ™ฏใฎ่‰ฒใ‚’่จญๅฎšใ™ใ‚‹ | Set the background color
	Scene::SetBackground(ColorF{ 0.6, 0.8, 0.7 });

	// ็”ปๅƒใƒ•ใ‚กใ‚คใƒซใ‹ใ‚‰ใƒ†ใ‚ฏใ‚นใƒใƒฃใ‚’ไฝœๆˆใ™ใ‚‹ | Create a texture from an image file
	const Texture texture{ U"example/windmill.png" };

	// ็ตตๆ–‡ๅญ—ใ‹ใ‚‰ใƒ†ใ‚ฏใ‚นใƒใƒฃใ‚’ไฝœๆˆใ™ใ‚‹ | Create a texture from an emoji
	const Texture emoji{ U"๐Ÿฆ–"_emoji };

	// ๅคชๆ–‡ๅญ—ใฎใƒ•ใ‚ฉใƒณใƒˆใ‚’ไฝœๆˆใ™ใ‚‹ | Create a bold font with MSDF method
	const Font font{ FontMethod::MSDF, 48, Typeface::Bold };

	// ใƒ†ใ‚ญใ‚นใƒˆใซๅซใพใ‚Œใ‚‹็ตตๆ–‡ๅญ—ใฎใŸใ‚ใฎใƒ•ใ‚ฉใƒณใƒˆใ‚’ไฝœๆˆใ—ใ€font ใซ่ฟฝๅŠ ใ™ใ‚‹ | Create a font for emojis in text and add it to font as a fallback
	const Font emojiFont{ 48, Typeface::ColorEmoji };
	font.addFallback(emojiFont);

	// ใƒœใ‚ฟใƒณใ‚’ๆŠผใ—ใŸๅ›žๆ•ฐ | Number of button presses
	int32 count = 0;

	// ใƒใ‚งใƒƒใ‚ฏใƒœใƒƒใ‚ฏใ‚นใฎ็Šถๆ…‹ | Checkbox state
	bool checked = false;

	// ใƒ—ใƒฌใ‚คใƒคใƒผใฎ็งปๅ‹•ใ‚นใƒ”ใƒผใƒ‰ | Player's movement speed
	double speed = 200.0;

	// ใƒ—ใƒฌใ‚คใƒคใƒผใฎ X ๅบงๆจ™ | Player's X position
	double playerPosX = 400;

	// ใƒ—ใƒฌใ‚คใƒคใƒผใŒๅณใ‚’ๅ‘ใ„ใฆใ„ใ‚‹ใ‹ | Whether player is facing right
	bool isPlayerFacingRight = true;

	while (System::Update())
	{
		// ใƒ†ใ‚ฏใ‚นใƒใƒฃใ‚’ๆใ | Draw the texture
		texture.draw(20, 20);

		// ใƒ†ใ‚ญใ‚นใƒˆใ‚’ๆใ | Draw text
		font(U"Hello, Siv3D!๐ŸŽฎ").draw(64, Vec2{ 20, 340 }, ColorF{ 0.2, 0.4, 0.8 });

		// ๆŒ‡ๅฎšใ—ใŸ็ฏ„ๅ›ฒๅ†…ใซใƒ†ใ‚ญใ‚นใƒˆใ‚’ๆใ | Draw text within a specified area
		font(U"Siv3D (ใ‚ทใƒ–ใ‚นใƒชใƒผใƒ‡ใ‚ฃใƒผ) ใฏใ€ใ‚ฒใƒผใƒ ใ‚„ใ‚ขใƒ—ใƒชใ‚’ๆฅฝใ—ใ็ฐกๅ˜ใช C++ ใ‚ณใƒผใƒ‰ใง้–‹็™บใงใใ‚‹ใƒ•ใƒฌใƒผใƒ ใƒฏใƒผใ‚ฏใงใ™ใ€‚")
			.draw(18, Rect{ 20, 430, 480, 200 }, Palette::Black);

		// ้•ทๆ–นๅฝขใ‚’ๆใ | Draw a rectangle
		Rect{ 540, 20, 80, 80 }.draw();

		// ่ง’ไธธ้•ทๆ–นๅฝขใ‚’ๆใ | Draw a rounded rectangle
		RoundRect{ 680, 20, 80, 200, 20 }.draw(ColorF{ 0.0, 0.4, 0.6 });

		// ๅ††ใ‚’ๆใ | Draw a circle
		Circle{ 580, 180, 40 }.draw(Palette::Seagreen);

		// ็Ÿขๅฐใ‚’ๆใ | Draw an arrow
		Line{ 540, 330, 760, 260 }.drawArrow(8, SizeF{ 20, 20 }, ColorF{ 0.4 });

		// ๅŠ้€ๆ˜Žใฎๅ††ใ‚’ๆใ | Draw a semi-transparent circle
		Circle{ Cursor::Pos(), 40 }.draw(ColorF{ 1.0, 0.0, 0.0, 0.5 });

		// ใƒœใ‚ฟใƒณ | Button
		if (SimpleGUI::Button(U"count: {}"_fmt(count), Vec2{ 520, 370 }, 120, (checked == false)))
		{
			// ใ‚ซใ‚ฆใƒณใƒˆใ‚’ๅข—ใ‚„ใ™ | Increase the count
			++count;
		}

		// ใƒใ‚งใƒƒใ‚ฏใƒœใƒƒใ‚ฏใ‚น | Checkbox
		SimpleGUI::CheckBox(checked, U"Lock \U000F033E", Vec2{ 660, 370 }, 120);

		// ใ‚นใƒฉใ‚คใƒ€ใƒผ | Slider
		SimpleGUI::Slider(U"speed: {:.1f}"_fmt(speed), speed, 100, 400, Vec2{ 520, 420 }, 140, 120);

		// ๅทฆใ‚ญใƒผใŒๆŠผใ•ใ‚Œใฆใ„ใŸใ‚‰ | If left key is pressed
		if (KeyLeft.pressed())
		{
			// ใƒ—ใƒฌใ‚คใƒคใƒผใŒๅทฆใซ็งปๅ‹•ใ™ใ‚‹ | Player moves left
			playerPosX = Max((playerPosX - speed * Scene::DeltaTime()), 60.0);
			isPlayerFacingRight = false;
		}

		// ๅณใ‚ญใƒผใŒๆŠผใ•ใ‚Œใฆใ„ใŸใ‚‰ | If right key is pressed
		if (KeyRight.pressed())
		{
			// ใƒ—ใƒฌใ‚คใƒคใƒผใŒๅณใซ็งปๅ‹•ใ™ใ‚‹ | Player moves right
			playerPosX = Min((playerPosX + speed * Scene::DeltaTime()), 740.0);
			isPlayerFacingRight = true;
		}

		// ใƒ—ใƒฌใ‚คใƒคใƒผใ‚’ๆใ | Draw the player
		emoji.scaled(0.75).mirrored(isPlayerFacingRight).drawAt(playerPosX, 540);
	}
}

2. Breakout

Screenshot

# include <Siv3D.hpp>

void Main()
{
	// 1 ใคใฎใƒ–ใƒญใƒƒใ‚ฏใฎใ‚ตใ‚คใ‚บ | Size of a single block
	constexpr Size BrickSize{ 40, 20 };

	// ใƒœใƒผใƒซใฎ้€Ÿใ•๏ผˆใƒ”ใ‚ฏใ‚ปใƒซ / ็ง’๏ผ‰ | Ball speed (pixels / second)
	constexpr double BallSpeedPerSec = 480.0;

	// ใƒœใƒผใƒซใฎ้€Ÿๅบฆ | Ball velocity
	Vec2 ballVelocity{ 0, -BallSpeedPerSec };

	// ใƒœใƒผใƒซ | Ball
	Circle ball{ 400, 400, 8 };

	// ใƒ–ใƒญใƒƒใ‚ฏใฎ้…ๅˆ— | Array of bricks
	Array<Rect> bricks;

	for (int32 y = 0; y < 5; ++y)
	{
		for (int32 x = 0; x < (Scene::Width() / BrickSize.x); ++x)
		{
			bricks << Rect{ (x * BrickSize.x), (60 + y * BrickSize.y), BrickSize };
		}
	}

	while (System::Update())
	{
		// ใƒ‘ใƒ‰ใƒซ | Paddle
		const Rect paddle{ Arg::center(Cursor::Pos().x, 500), 60, 10 };

		// ใƒœใƒผใƒซใ‚’็งปๅ‹•ใ•ใ›ใ‚‹ | Move the ball
		ball.moveBy(ballVelocity * Scene::DeltaTime());

		// ใƒ–ใƒญใƒƒใ‚ฏใ‚’้ †ใซใƒใ‚งใƒƒใ‚ฏใ™ใ‚‹ | Check bricks in sequence
		for (auto it = bricks.begin(); it != bricks.end(); ++it)
		{
			// ใƒ–ใƒญใƒƒใ‚ฏใจใƒœใƒผใƒซใŒไบคๅทฎใ—ใฆใ„ใŸใ‚‰ | If block and ball intersect
			if (it->intersects(ball))
			{
View on GitHub
GitHub Stars1.2k
CategoryCustomer
Updated3d ago
Forks156

Languages

C++

Security Score

100/100

Audited on Apr 5, 2026

No findings