{"id":19521868,"url":"https://github.com/inochi2d/inochi2d-c","last_synced_at":"2026-03-02T08:01:10.796Z","repository":{"id":41515542,"uuid":"509595134","full_name":"Inochi2D/inochi2d-c","owner":"Inochi2D","description":"A layer for using Inochi2D with non-D programming languages via a C ABI","archived":false,"fork":false,"pushed_at":"2023-07-16T13:12:36.000Z","size":38,"stargazers_count":26,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-26T00:45:58.843Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"D","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Inochi2D.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-01T21:40:31.000Z","updated_at":"2024-10-10T01:49:50.000Z","dependencies_parsed_at":"2024-11-11T00:35:33.320Z","dependency_job_id":"0c3fc6a3-1151-407f-8f17-74badc763bb4","html_url":"https://github.com/Inochi2D/inochi2d-c","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Inochi2D/inochi2d-c","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inochi2D%2Finochi2d-c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inochi2D%2Finochi2d-c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inochi2D%2Finochi2d-c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inochi2D%2Finochi2d-c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Inochi2D","download_url":"https://codeload.github.com/Inochi2D/inochi2d-c/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inochi2D%2Finochi2d-c/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29995910,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T01:47:34.672Z","status":"online","status_checked_at":"2026-03-02T02:00:07.342Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T00:35:31.115Z","updated_at":"2026-03-02T08:01:10.771Z","avatar_url":"https://github.com/Inochi2D.png","language":"D","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Inochi2D SDK for C ABIs\nThis repository contains the neccesary code to use the reference Inochi2D implementation outside of DLang, as well as with non-Inochi2D renderers.\n\n\n## Initializing and Closing Inochi2D\nYou will need to pass a function with the signature `double timingFunc()` to Inochi2D on initialization.  \n * timingFunc should return the current time of the application rendering the game in `sec.ms` format.\n * timingFunc is used for physics as well animation calculations\n\n```c\ndouble timingFunc() {\n    return glfwGetTime();\n}\n```\n\nTo initialize Inochi2D itself you will need to call `inInit` passing your timing function in.  \nRemember to run inCleanup when you're done using Inochi2D to unload the DLang runtime!\n\n```c\ninInit(\u0026timingFunc);\n    // Game and Inochi2D goodness happens here\ninCleanup();\n```\n\n## Loading a puppet\nUse `inLoadPuppet` to load a puppet, you will need to pass an UTF-8 encoded null-terminated string to this function.  \nUse `inDestroyPuppet` to destroy a puppet when it no longer is needed.\n\n```c\n    InPuppet* puppet = inLoadPuppet(\"myPuppet.inp\");\n    // Do stuff\n\n    inDestroyPuppet(puppet);\n```\n\n## Getting arrays from Inochi2D\n\nSuch functions take arguments including two: `Type** arr_ptr, size_t* len_ptr`:\n\n0) If arr_ptr == null, length is written into `*len_ptr`. End.\n1) If *arr_ptr == null, an array allocated by D is written into `*arr_ptr`.\n2) Otherwise, fill the buffer passed by 'arr_ptr' with length.\n\nUser can use these in following way.\n\n0) D manages the memory: Call function with `*arr_ptr==NULL`.\n1) C manages the memory:\n    \n    1) call function with `arr_ptr==NULL`. function returns length of the buffer.\n    2) call function with array pre-allocated (`*buff != NULL`) given the length. function fills values to provided array.\n    \nExample:\n\n```c\nstruct {\n    size_t len;\n    InParameter **cont;\n} parameters;\n// let D allocate memory\nparameters.cont = NULL;\ninPuppetGetParameters(myPuppet, \u0026parameters.cont, \u0026parameters.len);\nfor (size_t i = 0; i \u003c parameters.len; i++) {\n    char *name = inParameterGetName(parameters.cont[i]);\n    bool isVec2 = inParameterIsVec2(parameters.cont[i]);\n    printf(\"Parameter #%zu: %s is%s vec2.\\n\", i, name, isVec2 ? \"\" : \" not\");\n}\n```\n\n## Using Inochi2D with your own renderer\nInochi2D requires the following GPU accellerated features to be present:\n * Framebuffer support (Inochi2D needs 2)\n * sRGB-\u003eLinear RGB conversion support\n * Premultiplied Alpha support\n * Vertex buffers\n * Stencil buffers\n * Pixel shaders\n * ROP support or method to emulate porter-duff blending in shader\n * At least 4096x4096 texture resolution support\n\nOptionally the following features may be present  \n * SPIR-v shader support (For per-part shaders)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finochi2d%2Finochi2d-c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finochi2d%2Finochi2d-c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finochi2d%2Finochi2d-c/lists"}