{"id":13339432,"url":"https://github.com/nxrighthere/Unigine-C","last_synced_at":"2025-03-11T13:30:56.984Z","repository":{"id":110173134,"uuid":"259047972","full_name":"nxrighthere/Unigine-C","owner":"nxrighthere","description":"Native transpiled C API of the Unigine","archived":false,"fork":false,"pushed_at":"2022-03-13T12:01:33.000Z","size":1282,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-24T00:24:53.285Z","etag":null,"topics":["bindings","game-engine","gamedev","single-header","unigine"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nxrighthere.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":"2020-04-26T14:15:03.000Z","updated_at":"2024-10-22T12:15:32.000Z","dependencies_parsed_at":"2023-03-14T06:15:39.479Z","dependency_job_id":null,"html_url":"https://github.com/nxrighthere/Unigine-C","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nxrighthere%2FUnigine-C","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nxrighthere%2FUnigine-C/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nxrighthere%2FUnigine-C/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nxrighthere%2FUnigine-C/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nxrighthere","download_url":"https://codeload.github.com/nxrighthere/Unigine-C/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243042732,"owners_count":20226693,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["bindings","game-engine","gamedev","single-header","unigine"],"created_at":"2024-07-29T19:20:01.362Z","updated_at":"2025-03-11T13:30:56.972Z","avatar_url":"https://github.com/nxrighthere.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e \n  \u003cimg src=\"https://i.imgur.com/s3r4mxS.png\" alt=\"alt logo\"\u003e\n\u003c/p\u003e\n\nThis repository provides a single-header, native C API of the [Unigine](https://unigine.com) engine transpiled from managed code for bindings in programming languages such as Rust, Zig, Nim, and many others. It can be used with any C-compatible compiler such as GCC, Clang, or MSVC. The header doesn't provide any high-level abstractions of the API and lacks opaque pointers for type-safety. Out of the box, Unigine supports C++ and C# languages, consider learning API from there.\n\nUsage\n--------\nCreate a new or use an existing Unigine C++ project, recreate `source` folder with C sources, copy `UnigineWrapper_x64.dll` from `SDK\\bin` directory to the `bin` directory of the project. Compile an executable by linking against `UnigineWrapper_x64.dll` library. Run the executable. Batch files in the root directory of the project can be edited accordingly.\n\nThe engine API can be used in two ways: by using unformatted imported functions directly, or by using macro aliases that follow C naming conventions.\n\n##### Minimal executable\n```c\n#include \"unigine.h\"\n\nint main(int argumentsCount, char** arguments) {\n\tvoid* engine = unigine_engine_initialize(UNIGINE_VERSION, \"Game\", NULL, NULL, argumentsCount, arguments, NULL, NULL);\n\n\tunigine_engine_main(engine, NULL, NULL, NULL);\n\tunigine_engine_deinitialize();\n}\n```\n\n##### Basic systems\n```c\n#include \"unigine.h\"\n\n// System logic\n\nint game_system_logic_start(void) {\n\t/* Write here code to be called on engine initialization */\n\n\tunigine_console_run(\"show_messages 1\");\n\tunigine_log_message(\"Hello, Unigine from C!\\n\");\n\n\treturn 1;\n}\n\nint game_system_logic_destroy(void) {\n\t/* Write here code to be called on engine shutdown */\n\n\treturn 1;\n}\n\nint game_system_logic_destroy_render_resources(void) {\n\t/* Write here code to be called when the video mode is changed or application is restarted */\n\n\treturn 1;\n}\n\nint game_system_logic_update(void) {\n\t/* Write here code to be called before updating each render frame */\n\n\treturn 1;\n}\n\nint game_system_logic_post_update(void) {\n\t/* Write here code to be called after updating each render frame */\n\n\treturn 1;\n}\n\n// World logic\n\nint game_world_logic_start(void) {\n\t/* Write here code to be called on world initialization: initialize resources for your world scene during the world start */\n\n\treturn 1;\n}\n\nint game_world_logic_destroy(void) {\n\t/* Write here code to be called on world shutdown: delete resources that were created during world script execution to avoid memory leaks */\n\n\treturn 1;\n}\n\nint game_world_logic_destroy_render_resources(void) {\n\t/* Write here code to be called when the video mode is changed or application is restarted */\n\n\treturn 1;\n}\n\nvoid game_world_logic_update_async_thread(int32_t id, int32_t size) {\n\t/* Write here code to be called after execution of all update sync thread functions */\n}\n\nvoid game_world_logic_update_sync_thread(int32_t id, int32_t size) {\n\t/* Write here code to be called before the update and the post-update functions */\n}\n\nint game_world_logic_update(void) {\n\t/* Write here code to be called before updating each render frame: specify all graphics-related functions you want to be called every frame while your application executes */\n\n\treturn 1;\n}\n\nint game_world_logic_post_update(void) {\n\t/* Write here code to be called after updating each render frame: correct behavior after the state of the node has been updated */\n\n\treturn 1;\n}\n\nint game_world_logic_update_physics(void) {\n\t/* Write here code to be called before updating each physics frame: control physics in your application and put non-rendering calculations */\n\n\treturn 1;\n}\n\nint game_world_logic_swap(void) {\n\t/* Write here code to be called before updating each render frame */\n\n\treturn 1;\n}\n\nint game_world_logic_save(const void* stream) {\n\t/* Write here code to be called when the world is saving its state, save custom user data to a file */\n\n\treturn 1;\n}\n\nint game_world_logic_restore(const void* stream) {\n\t/* Write here code to be called when the world is restoring its state, restore custom user data to a file here */\n\n\treturn 1;\n}\n\nint main(int argumentsCount, char** arguments) {\n\tvoid* engine = unigine_engine_initialize(UNIGINE_VERSION, \"Game\", NULL, NULL, argumentsCount, arguments, NULL, NULL);\n\n\tvoid* systemFunctions[5] = {\n\t\t\u0026game_system_logic_start,\n\t\t\u0026game_system_logic_destroy,\n\t\t\u0026game_system_logic_destroy_render_resources,\n\t\t\u0026game_system_logic_update,\n\t\t\u0026game_system_logic_post_update\n\t};\n\n\tvoid* worldFunctions[11] = {\n\t\t\u0026game_world_logic_start,\n\t\t\u0026game_world_logic_destroy,\n\t\t\u0026game_world_logic_destroy_render_resources,\n\t\t\u0026game_world_logic_update_async_thread,\n\t\t\u0026game_world_logic_update_sync_thread,\n\t\t\u0026game_world_logic_update,\n\t\t\u0026game_world_logic_post_update,\n\t\t\u0026game_world_logic_update_physics,\n\t\t\u0026game_world_logic_swap,\n\t\t\u0026game_world_logic_save,\n\t\t\u0026game_world_logic_restore\n\t};\n\n\tvoid* systemLogic = unigine_system_logic_construct(systemFunctions);\n\tvoid* worldLogic = unigine_world_logic_construct(worldFunctions);\n\n\tunigine_engine_main(engine, systemLogic, worldLogic, NULL);\n\tunigine_system_logic_destruct(systemLogic);\n\tunigine_world_logic_destruct(worldLogic);\n\tunigine_engine_deinitialize();\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnxrighthere%2FUnigine-C","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnxrighthere%2FUnigine-C","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnxrighthere%2FUnigine-C/lists"}