[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-6276":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":30,"lastSyncTime":31,"discoverSource":32},6276,"sokol","floooh\u002Fsokol","floooh","minimal cross-platform standalone C headers","https:\u002F\u002Ffloooh.github.io\u002Fsokol-html5",null,"C",9966,642,123,114,0,1,20,121,15,39.42,"zlib License",false,"master",true,[],"2026-06-12 02:01:17","\u003Cp align=\"center\">\n    \u003Cimg src=\"assets\u002Flogo_full_large.png\" style=\"width: 60%\" \u002F>\u003Cbr\u002F>\u003Cbr\u002F>Simple\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fnothings\u002Fstb\u002Fblob\u002Fmaster\u002Fdocs\u002Fstb_howto.txt\">STB-style\u003C\u002Fa>\n    cross-platform libraries for C and C++, written in C.\u003Cbr\u002F>\u003Cbr\u002F>\n\u003C\u002Fp>\n\n# Sokol\n\n[**See what's new**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002FCHANGELOG.md) (**21-Apr-2026**: new header: sokol_letterbox.h)\n\n[![Build](\u002F..\u002F..\u002Factions\u002Fworkflows\u002Fmain.yml\u002Fbadge.svg)](\u002F..\u002F..\u002Factions\u002Fworkflows\u002Fmain.yml) [![Bindings](\u002F..\u002F..\u002Factions\u002Fworkflows\u002Fgen_bindings.yml\u002Fbadge.svg)](\u002F..\u002F..\u002Factions\u002Fworkflows\u002Fgen_bindings.yml) [![build](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-zig\u002Factions\u002Fworkflows\u002Fmain.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-zig\u002Factions\u002Fworkflows\u002Fmain.yml) [![build](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-nim\u002Factions\u002Fworkflows\u002Fmain.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-nim\u002Factions\u002Fworkflows\u002Fmain.yml) [![Odin](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-odin\u002Factions\u002Fworkflows\u002Fmain.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-odin\u002Factions\u002Fworkflows\u002Fmain.yml)[![Rust](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-rust\u002Factions\u002Fworkflows\u002Fmain.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-rust\u002Factions\u002Fworkflows\u002Fmain.yml)[![Dlang](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-d\u002Factions\u002Fworkflows\u002Fbuild.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-d\u002Factions\u002Fworkflows\u002Fbuild.yml)[![C3](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-c3\u002Factions\u002Fworkflows\u002Fbuild.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-c3\u002Factions\u002Fworkflows\u002Fbuild.yml)\n\n## Examples and Related Projects\n\n- [Live Samples](https:\u002F\u002Ffloooh.github.io\u002Fsokol-html5\u002Findex.html) via WASM ([source](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-samples))\n\n- [Doom Shareware](https:\u002F\u002Ffloooh.github.io\u002Fdoom-sokol\u002F) ported to the Sokol headers ([source](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fdoom-sokol))\n\n- [Syntonic Dentiforms Redux](https:\u002F\u002Faras-p.github.io\u002FSyntonicDentiforms\u002F) demo remaster by Aras Pranckevičius ([blog post](https:\u002F\u002Faras-p.info\u002Fblog\u002F2026\u002F04\u002F13\u002FSyntonic-Dentiforms-redux\u002F)).\n\n- [Everybody Wants to Crank the World](https:\u002F\u002Faras-p.github.io\u002Fdemo-pd-cranktheworld\u002F) demo by\nAras Pranckevičius, PC\u002Fweb port via sokol ([source](https:\u002F\u002Fgithub.com\u002Faras-p\u002Fdemo-pd-cranktheworld)).\n\n- [sokol_gp.h](https:\u002F\u002Fgithub.com\u002Fedubart\u002Fsokol_gp) a 2D shape drawing library on top of sokol_gfx.h\n\n- [NanoVG backend](https:\u002F\u002Fgithub.com\u002Fvinnyhorgan\u002Fnanovg) a sokol_gfx backend for the amazing [NanoVG](https:\u002F\u002Fgithub.com\u002Fmemononen\u002Fnanovg) library.\n\n- [Dear ImGui starterkit](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fcimgui-sokol-starterkit) a self-contained starterkit for writing Dear ImGui apps in C.\n\n- [qoiview](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fqoiview) a basic viewer for the new QOI image file format\n\n- [Tiny 8-bit emulators](https:\u002F\u002Ffloooh.github.io\u002Ftiny8bit\u002F)\n\n- A 'single-file' [Pacman clone in C99](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fpacman.c\u002F), also available in [Zig](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fpacman.zig\u002F)\n\n- [Soluna](https:\u002F\u002Fgithub.com\u002Fcloudwu\u002Fsoluna), a framework to make 2D games in Lua by @cloudwu\n\n- [Deep Future](https:\u002F\u002Fgithub.com\u002Fcloudwu\u002Fdeepfuture): ...and a game implemented with Soluna\n\n- [Solar Storm](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F2754920\u002FSolar_Storm\u002F), a turn-based scifi artillery game built with Odin and Sokol, released on Steam.\n\n- [Spanking Runners (Samogonki)](https:\u002F\u002Fstore.steampowered.com\u002Fapp\u002F2599800\u002FSpanking_Runners\u002F), arcade racing in a bright and unusual world, released on Steam.\n\n- [MEG-4](https:\u002F\u002Fbztsrc.gitlab.io\u002Fmeg4) a virtual fantasy console emulator in C89, ported to sokol\n\n- A [Minigolf game](https:\u002F\u002Fmgerdes.github.io\u002Fminigolf.html) ([source](https:\u002F\u002Fgithub.com\u002Fmgerdes\u002Fminigolf)).\n\n- [hIghQube](https:\u002F\u002Fgithub.com\u002FRuiVarela\u002FhIghQube) A game demo that used sokol rendering extensively\n\n- [Senos](https:\u002F\u002Fgithub.com\u002FRuiVarela\u002FSenos) A music app that uses sokol as backend\n\n- ['Dealer's Dungeon'](https:\u002F\u002Fdealers-dungeon.com\u002Fdemo\u002F) ([lower graphics quality](https:\u002F\u002Fdealers-dungeon.com\u002Fdemo\u002F?q=3),\n[source](https:\u002F\u002Fgithub.com\u002Fbqqbarbhg\u002Fspear))\n\n- ['Brick Warrior'](https:\u002F\u002Fgithub.com\u002Fchrishulbert\u002Fbrickwarrior) - a 1990's Breakout clone ported to Sokol :)\n\n- [LearnOpenGL examples ported to sokol-gfx (may be outdated)](https:\u002F\u002Fzeromake.github.io\u002Flearnopengl-examples\u002F) ([git repo](https:\u002F\u002Fgithub.com\u002Fzeromake\u002Flearnopengl-examples))\n\n- [Command line tools](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-tools) (shader compiler)\n\n- [How to build without a build system](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-samples#how-to-build-without-a-build-system):\nuseful details for integrating the Sokol headers into your own project with your favourite C\u002FC++ build system\n\n## Core libraries\n\n- [**sokol\\_gfx.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Fsokol_gfx.h): 3D-API wrapper (GL\u002FGLES3\u002FWebGL2 + Metal + D3D11 + WebGPU)\n- [**sokol\\_app.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Fsokol_app.h): app framework wrapper (entry + window + 3D-context + input)\n- [**sokol\\_time.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Fsokol_time.h): time measurement\n- [**sokol\\_audio.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Fsokol_audio.h): minimal buffer-streaming audio playback\n- [**sokol\\_fetch.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Fsokol_fetch.h): asynchronous data streaming from HTTP and local filesystem\n- [**sokol\\_args.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Fsokol_args.h): unified cmdline\u002FURL arg parser for web and native apps\n- [**sokol\\_log.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Fsokol_log.h): provides a standard logging callback for the other sokol headers\n\n## Utility libraries\n\n- [**sokol\\_imgui.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Futil\u002Fsokol_imgui.h): sokol_gfx.h rendering backend for [Dear ImGui](https:\u002F\u002Fgithub.com\u002Focornut\u002Fimgui)\n- [**sokol\\_nuklear.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Futil\u002Fsokol_nuklear.h): sokol_gfx.h rendering backend for [Nuklear](https:\u002F\u002Fgithub.com\u002FImmediate-Mode-UI\u002FNuklear)\n- [**sokol\\_gl.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Futil\u002Fsokol_gl.h): OpenGL 1.x style immediate-mode rendering API on top of sokol_gfx.h\n- [**sokol\\_fontstash.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Futil\u002Fsokol_fontstash.h): sokol_gl.h rendering backend for [fontstash](https:\u002F\u002Fgithub.com\u002Fmemononen\u002Ffontstash)\n- [**sokol\\_gfx\\_imgui.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Futil\u002Fsokol_gfx_imgui.h): debug-inspection UI for sokol_gfx.h (implemented with Dear ImGui)\n- [**sokol\\_app\\_imgui.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Futil\u002Fsokol_app_imgui.h): debug-inspection UI for sokol_app.h (implemented with Dear ImGui)\n- [**sokol\\_debugtext.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Futil\u002Fsokol_debugtext.h): a simple text renderer using vintage home computer fonts\n- [**sokol\\_memtrack.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Futil\u002Fsokol_memtrack.h): easily track memory allocations in sokol headers\n- [**sokol\\_shape.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Futil\u002Fsokol_shape.h): generate simple shapes and plug them into sokol-gfx resource creation structs\n- [**sokol\\_color.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Futil\u002Fsokol_color.h): X11 style color constants and functions for creating sg_color objects\n- [**sokol\\_spine.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Futil\u002Fsokol_spine.h): a sokol-style wrapper around the Spine C runtime (http:\u002F\u002Fen.esotericsoftware.com\u002Fspine-in-depth)\n- [**sokol\\_letterbox.h**](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol\u002Fblob\u002Fmaster\u002Futil\u002Fsokol_letterbox.h): compute viewport params for rendering fixed-aspect-ratio content in a variable-aspect-ratio canvas\n\n## 'Official' Language Bindings\n\nThese are automatically updated on changes to the C headers:\n\n- [sokol-zig](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-zig)\n- [sokol-odin](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-odin)\n- [sokol-nim](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-nim)\n- [sokol-rust](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-rust)\n- [sokol-d](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-d)\n- [sokol-jai](https:\u002F\u002Fgithub.com\u002Fcolinbellino\u002Fsokol-jai)\n- [sokol-c3](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-c3)\n\n## Notes\n\nWebAssembly is a 'first-class citizen', one important motivation for the\nSokol headers is to provide a collection of cross-platform APIs with a\nminimal footprint on the web platform while still being useful.\n\nThe core headers are standalone and can be used independently from each other.\n\n### Why C:\n\n- easier integration with other languages\n- easier integration into other projects\n- adds only minimal size overhead to executables\n\nA blog post with more background info: [A Tour of sokol_gfx.h](http:\u002F\u002Ffloooh.github.io\u002F2017\u002F07\u002F29\u002Fsokol-gfx-tour.html)\n\n# sokol_gfx.h:\n\n- simple, modern wrapper around GLES3\u002FWebGL2, GL3.3, D3D11, Metal, and WebGPU\n- buffers, images, shaders, pipeline-state-objects and render-passes\n- does *not* handle window creation or 3D API context initialization\n- does *not* provide shader dialect cross-translation (**BUT** there's now an 'official' shader-cross-compiler solution which\nseamlessly integrates with sokol_gfx.h and IDEs: [see here for details](https:\u002F\u002Fgithub.com\u002Ffloooh\u002Fsokol-tools\u002Fblob\u002Fmaster\u002Fdocs\u002Fsokol-shdc.md)\n\n# sokol_app.h\n\nA minimal cross-platform application-wrapper library:\n\n- unified application entry\n- single window or canvas for 3D rendering\n- 3D context initialization\n- event-based keyboard, mouse and touch input\n- supported platforms: Win32, MacOS, Linux (X11), iOS, WASM, Android, UWP\n- supported 3D-APIs: GL3.3 (GLX\u002FWGL), Metal, D3D11, GLES3\u002FWebGL2\n\nThe vanilla Hello-Triangle using sokol_gfx.h, sokol_app.h and the\nsokol-shdc shader compiler (shader code not shown):\n\n```c\n#include \"sokol_app.h\"\n#include \"sokol_gfx.h\"\n#include \"sokol_log.h\"\n#include \"sokol_glue.h\"\n#include \"triangle-sapp.glsl.h\"\n\nstatic struct {\n    sg_pipeline pip;\n    sg_bindings bind;\n    sg_pass_action pass_action;\n} state;\n\nstatic void init(void) {\n    sg_setup(&(sg_desc){\n        .environment = sglue_environment(),\n        .logger.func = slog_func,\n    });\n\n    float vertices[] = {\n         0.0f,  0.5f, 0.5f,     1.0f, 0.0f, 0.0f, 1.0f,\n         0.5f, -0.5f, 0.5f,     0.0f, 1.0f, 0.0f, 1.0f,\n        -0.5f, -0.5f, 0.5f,     0.0f, 0.0f, 1.0f, 1.0f\n    };\n    state.bind.vertex_buffers[0] = sg_make_buffer(&(sg_buffer_desc){\n        .data = SG_RANGE(vertices),\n    });\n\n    state.pip = sg_make_pipeline(&(sg_pipeline_desc){\n        .shader = sg_make_shader(triangle_shader_desc(sg_query_backend())),\n        .layout = {\n            .attrs = {\n                [ATTR_triangle_position].format = SG_VERTEXFORMAT_FLOAT3,\n                [ATTR_triangle_color0].format = SG_VERTEXFORMAT_FLOAT4\n            }\n        },\n    });\n\n    state.pass_action = (sg_pass_action) {\n        .colors[0] = { .load_action=SG_LOADACTION_CLEAR, .clear_value={0.0f, 0.0f, 0.0f, 1.0f } }\n    };\n}\n\nvoid frame(void) {\n    sg_begin_pass(&(sg_pass){ .action = state.pass_action, .swapchain = sglue_swapchain() });\n    sg_apply_pipeline(state.pip);\n    sg_apply_bindings(&state.bind);\n    sg_draw(0, 3, 1);\n    sg_end_pass();\n    sg_commit();\n}\n\nvoid cleanup(void) {\n    sg_shutdown();\n}\n\nsapp_desc sokol_main(int argc, char* argv[]) {\n    (void)argc; (void)argv;\n    return (sapp_desc){\n        .init_cb = init,\n        .frame_cb = frame,\n        .cleanup_cb = cleanup,\n        .width = 640,\n        .height = 480,\n        .window_title = \"Triangle\",\n        .icon.sokol_default = true,\n        .logger.func = slog_func,\n    };\n}\n```\n\n# sokol_audio.h\n\nA minimal audio-streaming API:\n\n- you provide a mono- or stereo-stream of 32-bit float samples which sokol_audio.h forwards into platform-specific backends\n- two ways to provide the data:\n    1. directly fill backend audio buffer from your callback function running in the audio thread\n    2. alternatively push small packets of audio data from your main loop,\n    or a separate thread created by you\n- platform backends:\n    - Windows: WASAPI\n    - macOS\u002FiOS: CoreAudio\n    - Linux: ALSA\n    - emscripten: WebAudio + ScriptProcessorNode (doesn't use the emscripten-provided OpenAL or SDL Audio wrappers)\n\nA simple mono square-wave generator using the callback model:\n\n```c\n\u002F\u002F the sample callback, running in audio thread\nstatic void stream_cb(float* buffer, int num_frames, int num_channels) {\n    assert(1 == num_channels);\n    static uint32_t count = 0;\n    for (int i = 0; i \u003C num_frames; i++) {\n        buffer[i] = (count++ & (1\u003C\u003C3)) ? 0.5f : -0.5f;\n    }\n}\n\nint main() {\n    \u002F\u002F init sokol-audio with default params\n    saudio_setup(&(saudio_desc){\n        .stream_cb = stream_cb,\n        .logger.func = slog_func,\n    });\n\n    \u002F\u002F run main loop\n    ...\n\n    \u002F\u002F shutdown sokol-audio\n    saudio_shutdown();\n    return 0;\n```\n\nThe same code using the push-model\n\n```c\n#define BUF_SIZE (32)\nint main() {\n    \u002F\u002F init sokol-audio with default params, no callback\n    saudio_setup(&(saudio_desc){\n        .logger.func = slog_func,\n    });\n    assert(saudio_channels() == 1);\n\n    \u002F\u002F a small intermediate buffer so we don't need to push\n    \u002F\u002F individual samples, which would be quite inefficient\n    float buf[BUF_SIZE];\n    int buf_pos = 0;\n    uint32_t count = 0;\n\n    \u002F\u002F push samples from main loop\n    bool done = false;\n    while (!done) {\n        \u002F\u002F generate and push audio samples...\n        int num_frames = saudio_expect();\n        for (int i = 0; i \u003C num_frames; i++) {\n            \u002F\u002F simple square wave generator\n            buf[buf_pos++] = (count++ & (1\u003C\u003C3)) ? 0.5f : -0.5f;\n            if (buf_pos == BUF_SIZE) {\n                buf_pos = 0;\n                saudio_push(buf, BUF_SIZE);\n            }\n        }\n        \u002F\u002F handle other per-frame stuff...\n        ...\n    }\n\n    \u002F\u002F shutdown sokol-audio\n    saudio_shutdown();\n    return 0;\n}\n```\n\n# sokol_fetch.h\n\nLoad entire files, or stream data asynchronously over HTTP (emscripten\u002Fwasm)\nor the local filesystem (all native platforms).\n\nSimple C99 example loading a file into a static buffer:\n\n```c\n#include \"sokol_fetch.h\"\n#include \"sokol_log.h\"\n\nstatic void response_callback(const sfetch_response*);\n\n#define MAX_FILE_SIZE (1024*1024)\nstatic uint8_t buffer[MAX_FILE_SIZE];\n\n\u002F\u002F application init\nstatic void init(void) {\n    ...\n    \u002F\u002F setup sokol-fetch with default config:\n    sfetch_setup(&(sfetch_desc_t){ .logger.func = slog_func });\n\n    \u002F\u002F start loading a file into a statically allocated buffer:\n    sfetch_send(&(sfetch_request_t){\n        .path = \"hello_world.txt\",\n        .callback = response_callback\n        .buffer_ptr = buffer,\n        .buffer_size = sizeof(buffer)\n    });\n}\n\n\u002F\u002F per frame...\nstatic void frame(void) {\n    ...\n    \u002F\u002F need to call sfetch_dowork() once per frame to 'turn the gears':\n    sfetch_dowork();\n    ...\n}\n\n\u002F\u002F the response callback is where the interesting stuff happens:\nstatic void response_callback(const sfetch_response_t* response) {\n    if (response->fetched) {\n        \u002F\u002F data has been loaded into the provided buffer, do something\n        \u002F\u002F with the data...\n        const void* data = response->buffer_ptr;\n        uint64_t data_size = response->fetched_size;\n    }\n    \u002F\u002F the finished flag is set both on success and failure\n    if (response->failed) {\n        \u002F\u002F oops, something went wrong\n        switch (response->error_code) {\n            SFETCH_ERROR_FILE_NOT_FOUND: ...\n            SFETCH_ERROR_BUFFER_TOO_SMALL: ...\n            ...\n        }\n    }\n}\n\n\u002F\u002F application shutdown\nstatic void shutdown(void) {\n    ...\n    sfetch_shutdown();\n    ...\n}\n```\n\n# sokol_time.h:\n\nSimple cross-platform time measurement:\n\n```c\n#include \"sokol_time.h\"\n...\n\u002F* initialize sokol_time *\u002F\nstm_setup();\n\n\u002F* take start timestamp *\u002F\nuint64_t start = stm_now();\n\n...some code to measure...\n\n\u002F* compute elapsed time *\u002F\nuint64_t elapsed = stm_since(start);\n\n\u002F* convert to time units *\u002F\ndouble seconds = stm_sec(elapsed);\ndouble milliseconds = stm_ms(elapsed);\ndouble microseconds = stm_us(elapsed);\ndouble nanoseconds = stm_ns(elapsed);\n\n\u002F* difference between 2 time stamps *\u002F\nuint64_t start = stm_now();\n...\nuint64_t end = stm_now();\nuint64_t elapsed = stm_diff(end, start);\n\n\u002F* compute a 'lap time' (e.g. for fps) *\u002F\nuint64_t last_time = 0;\nwhile (!done) {\n    ...render something...\n    double frame_time_ms = stm_ms(stm_laptime(&last_time));\n}\n```\n\n# sokol_args.h\n\nUnified argument parsing for web and native apps. Uses argc\u002Fargv on native\nplatforms and the URL query string on the web.\n\nExample URL with one arg:\n\nhttps:\u002F\u002Ffloooh.github.io\u002Ftiny8bit\u002Fkc85.html?type=kc85_4\n\nThe same as command line app:\n\n> kc85 type=kc85_4\n\nParsed like this:\n\n```c\n#include \"sokol_args.h\"\n\nint main(int argc, char* argv[]) {\n    sargs_setup(&(sargs_desc){ .argc=argc, .argv=argv });\n    if (sargs_exists(\"type\")) {\n        if (sargs_equals(\"type\", \"kc85_4\")) {\n            \u002F\u002F start as KC85\u002F4\n        }\n        else if (sargs_equals(\"type\", \"kc85_3\")) {\n            \u002F\u002F start as KC85\u002F3\n        }\n        else {\n            \u002F\u002F start as KC85\u002F2\n        }\n    }\n    sargs_shutdown();\n    return 0;\n}\n```\n\nSee the sokol_args.h header for a more complete documentation, and the [Tiny\nEmulators](https:\u002F\u002Ffloooh.github.io\u002Ftiny8bit\u002F) for more interesting usage examples.\n","sokol 是一个提供跨平台独立 C 头文件的项目，旨在简化图形和音频处理。它包括多个简洁的库，如图形渲染、音频播放、输入处理等，所有这些都以 C 语言编写，并遵循类似 STB 的风格。sokol 支持多种编程语言绑定（如 Rust, D, Nim 等），并且具有高度的可移植性。该项目特别适合需要快速开发跨平台多媒体应用的场景，无论是游戏还是其他对性能有要求的应用程序。其简单易用的设计理念和强大的功能使其成为开发者工具箱中的宝贵资源。",2,"2026-06-11 03:06:12","top_language"]