opensiv3d

C++20 framework for creative coding 🎮🎨🎹 / Cross-platform support (Windows, macOS, Linux, and the Web)

https://github.com/siv3d/opensiv3d

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.9%) to scientific vocabulary

Keywords

c-plus-plus cpp cpp20 cross-platform game game-developement game-engine gamedev

Keywords from Contributors

mesh sequences interactive hacking
Last synced: 6 months ago · JSON representation

Repository

C++20 framework for creative coding 🎮🎨🎹 / Cross-platform support (Windows, macOS, Linux, and the Web)

Basic Info
  • Host: GitHub
  • Owner: Siv3D
  • License: mit
  • Language: C++
  • Default Branch: main
  • Homepage: https://siv3d.github.io/
  • Size: 1.69 GB
Statistics
  • Stars: 1,081
  • Watchers: 44
  • Forks: 146
  • Open Issues: 157
  • Releases: 8
Topics
c-plus-plus cpp cpp20 cross-platform game game-developement game-engine gamedev
Created almost 10 years ago · Last pushed 11 months ago
Metadata Files
Readme Contributing Funding License Citation Authors

README.md

Siv3D

Siv3D logo

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)

* Some features are limited to specific platforms

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 /
*SDK * | - Windows 10 / 11 (64-bit)
- Microsoft Visual C++ 2022 17.10
- Windows 10 SDK
- Intel / AMD CPU | | macOS | Download SDK /
*SDK * | - macOS Ventura / Sonoma / Sequoia
- Xcode 14.3 or newer
- Intel CPU / Apple Silicon (Rosetta mode)*
- OpenGL 4.1 compatible hardware | | Linux | Compiling for Linux /
*Linux * | - Ubuntu 20.04 LTS / 22.04 LTS
- GCC 9.3.0 (with Boost 1.71.0) / GCC 11.2 (with Boost 1.74.0)
- Intel / AMD CPU
- OpenGL 4.1 compatible hardware |

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

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

```cpp

include

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

```cpp

include

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))
        {
            //  | If ball intersects with top or bottom of the block
            if (it->bottom().intersects(ball) || it->top().intersects(ball))
            {
                //  Y  | Reverse the sign of the Y component of the ball's velocity
                ballVelocity.y *= -1;
            }
            else // 
            {
                //  X  | Reverse the sign of the X component of the ball's velocity
                ballVelocity.x *= -1;
            }

            //  | Remove the block from the array (the iterator becomes invalid)
            bricks.erase(it);

            //  | Do not check any more
            break;
        }
    }

    //  | If the ball hits the ceiling
    if ((ball.y < 0) && (ballVelocity.y < 0))
    {
        //  Y  | Reverse the sign of the Y component of the ball's velocity
        ballVelocity.y *= -1;
    }

    //  | If the ball hits the left or right wall
    if (((ball.x < 0) && (ballVelocity.x < 0))
        || ((Scene::Width() < ball.x) && (0 < ballVelocity.x)))
    {
        //  X  | Reverse the sign of the X component of the ball's velocity
        ballVelocity.x *= -1;
    }

    //  | If the ball hits the left or right wall
    if ((0 < ballVelocity.y) && paddle.intersects(ball))
    {
        //  | Change the direction (velocity vector) of the ball depending on the distance from the center of the paddle
        ballVelocity = Vec2{ (ball.x - paddle.center().x) * 10, -ballVelocity.y }.setLength(BallSpeedPerSec);
    }

    //  | Draw all the bricks
    for (const auto& brick : bricks)
    {
        //  Y  | Change the color of the brick depending on the Y coordinate
        brick.stretched(-1).draw(HSV{ brick.y - 40 });
    }

    //  | Hide the mouse cursor
    Cursor::RequestStyle(CursorStyle::Hidden);

    //  | Draw the ball
    ball.draw();

    //  | Draw the paddle
    paddle.rounded(3).draw();
}

} ```

3. Hello, 3D world!

Screenshot

```cpp

include

void Main() { // Resize the window and scene to 1280x720 Window::Resize(1280, 720);

// Background color (remove SRGB curve for a linear workflow)
const ColorF backgroundColor = ColorF{ 0.4, 0.6, 0.8 }.removeSRGBCurve();

// Texture for UV check (mipmapped. treat as SRGB texture in a linear workflow)
const Texture uvChecker{ U"example/texture/uv.png", TextureDesc::MippedSRGB };

// Multisample RenderTexture for a linear workflow
const MSRenderTexture renderTexture{ Scene::Size(), TextureFormat::R8G8B8A8_Unorm_SRGB, HasDepth::Yes };

// 3D debug camera (free camera)
// Vertical FOV: 30, Eye position: (10, 16, -32)
// Move: [W][S][A][D][E][X], View: [arrow keys]
DebugCamera3D camera{ renderTexture.size(), 30_deg, Vec3{ 10, 16, -32 } };

while (System::Update())
{
    // Update a camera
    camera.update(2.0);

    // Set up a camera in the current 3D scene
    Graphics3D::SetCameraTransform(camera);

    // [3D rendering]
    {
        // Clear renderTexture with the background color,
        // then make renderTexture the render target for the current 3D scene
        const ScopedRenderTarget3D target{ renderTexture.clear(backgroundColor) };

        // Draw a floor
        Plane{ 64 }.draw(uvChecker);

        // Draw a box
        Box{ -8,2,0,4 }.draw(ColorF{ 0.8, 0.6, 0.4 }.removeSRGBCurve());

        // Draw a sphere
        Sphere{ 0,2,0,2 }.draw(ColorF{ 0.4, 0.8, 0.6 }.removeSRGBCurve());

        // Draw a cylinder
        Cylinder{ 8, 2, 0, 2, 4 }.draw(ColorF{ 0.6, 0.4, 0.8 }.removeSRGBCurve());
    }

    // [2D rendering]
    {
        // Flush 3D rendering commands before multisample resolve
        Graphics3D::Flush();

        // Multisample resolve
        renderTexture.resolve();

        // Transfer renderTexture to the current 2D scene (default scene)
        Shader::LinearToScreen(renderTexture);
    }
}

} ```

Owner

  • Name: Siv3D
  • Login: Siv3D
  • Kind: organization

C++20 Framework for Creative Coding 🎮🎨🎹

GitHub Events

Total
  • Create event: 5
  • Release event: 1
  • Issues event: 45
  • Watch event: 82
  • Delete event: 8
  • Issue comment event: 59
  • Push event: 43
  • Pull request review event: 1
  • Pull request review comment event: 3
  • Pull request event: 32
  • Fork event: 15
Last Year
  • Create event: 5
  • Release event: 1
  • Issues event: 45
  • Watch event: 82
  • Delete event: 8
  • Issue comment event: 59
  • Push event: 43
  • Pull request review event: 1
  • Pull request review comment event: 3
  • Pull request event: 32
  • Fork event: 15

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 5,656
  • Total Committers: 70
  • Avg Commits per committer: 80.8
  • Development Distribution Score (DDS): 0.224
Past Year
  • Commits: 47
  • Committers: 9
  • Avg Commits per committer: 5.222
  • Development Distribution Score (DDS): 0.255
Top Committers
Name Email Commits
Ryo Suzuki r****b@g****m 4,391
kamenokonokotan k****n@g****m 713
wynd2608 w****8@o****p 331
Raclamusi 6****i 25
Satoshi Tanaka o****5@g****m 16
azaika t****a@g****m 15
kurokoji s****a@g****m 14
Tetsuro Matsumura m****b@g****m 10
fal_rnd f****r@g****m 8
masaka m****a@m****m 7
Ebishu-0309 7****u@t****g 7
taotao54321 t****1@g****m 6
CO-PARA7 c****7@g****m 6
agehama a****1@g****m 6
MurakamiShun e****3@g****m 5
sthairno s****o@o****p 5
tomolatoon t****0@g****m 5
itakawa 4****a 4
voidProc v****c 4
makia g****0@g****m 4
Ryoga.exe 4****e 3
fuyutsubaki p****y@g****m 3
おがめ 1****4 3
ボトム 1****m 3
yakisake 7****e 3
chobby c****5@g****m 2
dependabot[bot] 4****] 2
aoriika05 7****5 2
YASAI03 y****6@g****m 2
Shimizu Yuta s****5@g****m 2
and 40 more...
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 113
  • Total pull requests: 153
  • Average time to close issues: 3 months
  • Average time to close pull requests: 9 days
  • Total issue authors: 20
  • Total pull request authors: 21
  • Average comments per issue: 0.55
  • Average comments per pull request: 0.27
  • Merged pull requests: 137
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 34
  • Pull requests: 25
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 22 days
  • Issue authors: 7
  • Pull request authors: 11
  • Average comments per issue: 0.71
  • Average comments per pull request: 0.76
  • Merged pull requests: 17
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Reputeless (71)
  • Raclamusi (13)
  • comefrombottom (5)
  • sashi0034 (4)
  • tyanmahou (3)
  • tayu-t (2)
  • nokotan (2)
  • pillowtrucker (1)
  • polyester-CTRL (1)
  • m4saka (1)
  • ka-disco (1)
  • yksake (1)
  • Appbird (1)
  • Aikawa3311 (1)
  • zaligan (1)
Pull Request Authors
  • Reputeless (111)
  • Raclamusi (12)
  • sashi0034 (4)
  • m4saka (4)
  • yaito3014 (3)
  • Ogame3334 (3)
  • Appbird (2)
  • yksake (2)
  • npt-1707 (2)
  • aoriika05 (2)
  • leaf2326 (2)
  • Aikawa3311 (2)
  • aFumihikoKobayashi (2)
  • sumidawara (2)
  • Plinano (1)
Top Labels
Issue Labels
v0.6.14 (32) Type: Bug (21) v0.6.16 (19) v0.6.15 (15) proposal (4) v0.8.0 (3) v0.6.17 (3) Platform: Windows Desktop (3) Type: Enhancement (3) good first issue (2) v0.6.6 (1)
Pull Request Labels
v0.6.16 (23) v0.6.14 (12) v0.6.15 (6) Type: Bug (3) Type: Documentation (3) v0.8.0 (1) v0.6.17 (1) Type: Performance (1)

Dependencies

.github/actions/download-boost/action.yml actions
  • actions/cache v1 composite
.github/workflows/ci_web.yml actions
  • ./.github/actions/download-boost * composite
  • actions/checkout v3 composite
.github/workflows/ubuntu.yml actions
  • actions/checkout v3 composite