{"id":19695487,"url":"https://github.com/tanis2000/binocle-c","last_synced_at":"2025-04-06T01:10:18.887Z","repository":{"id":42127709,"uuid":"192515187","full_name":"tanis2000/binocle-c","owner":"tanis2000","description":"A simple game engine in C","archived":false,"fork":false,"pushed_at":"2025-03-25T17:25:44.000Z","size":52920,"stargazers_count":120,"open_issues_count":0,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-30T00:08:40.433Z","etag":null,"topics":["c","engine","framework","gamedev","videogame"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"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/tanis2000.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":"2019-06-18T10:07:33.000Z","updated_at":"2025-03-21T16:02:13.000Z","dependencies_parsed_at":"2023-01-19T21:07:19.123Z","dependency_job_id":"65219d2f-febc-4ccd-805c-b7f9e395c3e9","html_url":"https://github.com/tanis2000/binocle-c","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanis2000%2Fbinocle-c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanis2000%2Fbinocle-c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanis2000%2Fbinocle-c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanis2000%2Fbinocle-c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tanis2000","download_url":"https://codeload.github.com/tanis2000/binocle-c/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419861,"owners_count":20936012,"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":["c","engine","framework","gamedev","videogame"],"created_at":"2024-11-11T19:28:06.843Z","updated_at":"2025-04-06T01:10:18.865Z","avatar_url":"https://github.com/tanis2000.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Binocle C version\n\n![Binocle Logo](images/binocle-logo-full.png)\n\nBinocle C version is a simple game engine written in pure C.\n\nThe previous incarnation was a C++ engine with way more features than this one, but I wanted to get back to the basics and trim everything down to a more manageable framework without all the bloat that C++ carries around.\n\nIt's born out of the need for the following features:\n\n- Cross-platform compilation (macOS, Windows, iOS, Android, Web)\n- OpenGL ES 2 support (but you can use any variant of OpenGL as long as it's supported by your hardware)\n\nNothing too fancy, but still something I always need when I make 2D or 3D games and prototypes.\n\nThe API is evolving all the time but the core is pretty stable. I keep adding and tweaking stuff based on my needs, so things may change without notice.\n\n[![Windows](https://github.com/tanis2000/binocle-c/actions/workflows/windows.yml/badge.svg)](https://github.com/tanis2000/binocle-c/actions/workflows/windows.yml)\n[![macOS](https://github.com/tanis2000/binocle-c/actions/workflows/macos.yml/badge.svg)](https://github.com/tanis2000/binocle-c/actions/workflows/macos.yml)\n[![Wasm](https://github.com/tanis2000/binocle-c/actions/workflows/wasm.yml/badge.svg)](https://github.com/tanis2000/binocle-c/actions/workflows/wasm.yml)\n[![iOS](https://github.com/tanis2000/binocle-c/actions/workflows/ios.yml/badge.svg)](https://github.com/tanis2000/binocle-c/actions/workflows/ios.yml)\n[![Android](https://github.com/tanis2000/binocle-c/actions/workflows/android.yml/badge.svg)](https://github.com/tanis2000/binocle-c/actions/workflows/android.yml)\n\n## Features\n\n- Cross-platform: macOS, Windows, iOS, Android, Web (Linux planned)\n- OpenGL API (ES 2/3 on mobile platforms) on all platforms\n- Metal API available on iOS and macOS\n- 2D Sprites\n- Spritesheets (TexturePacker format. LibGDX format is in the works)\n- Sprite batching\n- Music and sound effects\n- Bezier paths that can be used for anything\n- BitmapFont fonts\n- TrueType fonts\n- 2D Camera\n- 3D camera\n- 2D Collisions (boxes and circles)\n- Easing functions\n- Entity Component System\n- Timing functions\n- Viewport adapters for 2D pixel perfect images\n- Experimental hot code reloading for game code\n- Lua scripting through LuaJIT on supported platforms and fallback to Lua where LuaJIT is not available\n- Luasocket is included out of the box\n- 3D physics through Newton Dynamics (desktop platforms only)\n\n## Documentation\n\nThe full documentation is available on [Read the Docs](http://binocle-c.readthedocs.io/)\nPlease notice that the documentation is still a work in progress.\n\n## Getting in touch\n\nThere is no official place to support Binocle. You can either open an issue or just jump in Discord on the C/Dev server using this link: https://discord.gg/4rWrJvD \n\n## Installing\n\nThe easiest way to work with Binocle is to use the CLI project manager called `bone`.\nWith `bone` you can initialize a new project and automate the compilation and linking scripts. It's a quite young tool so please remember to make regular backups of your projects.\n\n### Installing `bone`\n\nYou can grab `bone` from the [GitHub repo](https://github.com/tanis2000/bone).\nYou can either download the binaries on the [Releases](https://github.com/tanis2000/bone/releases) page or compile it yourself.\n\n### Creating, building, running, updating and upgrading a project\n\nPlease refer to the [documentation of bone](https://github.com/tanis2000/bone/blob/master/README.md) to setup your first Binocle application.\n\n## Third party libraries\n\nBinocle sits on the shoulders of giants. I tried to keep the amount of external libraries to a minimum.\nThe current libraries are the following:\n\n- SDL by the almighty Ryan C. Gordon (OS abstraction)\n- sokol (backend for OpenGL and Metal)\n- sokol_time\n- miniaudio (cross-platform audio support)\n- zlib\n- Vorbis by the Xiph.Org Foundation\n- OGG by the Xiph.Org Foundation\n- [FreeType](http://www.freetype.org)\n- Dear ImGui\n- glew (for Windows OpenGL support)\n- Kazmath by Luke Benstead\n- stbimage\n- parson\n- Lua\n- LuaJIT\n- Newton Dynamics\n- Chipmunk (2D physics)\n\n## Coordinate system\n\nBinocle uses a right-handed coordinate system which is the same used by OpenGL\n\n## Contributing\n\nYou're welcome to try Binocle and contribute.\n\nRight now there are a few areas that could use some help:\n\n- Adding Linux support. It should work almost out of the box once you figure out the CMake scripts.\n- More examples\n- Complete the Lua bindings\n\n## Manually compiling the library\n\nIf you want to work on the library itself, just clone this repository and compile it on your own. The following are the build commands for each supported platform.\n\n### macOS\n\n```sh\nmkdir build\ncd build\ncmake -G Xcode -D DEBUG=1 -D BUILD_EXAMPLE=1 ../\nopen binocle.xcodeproj\n```\n\n### Windows\n\nI usually run the CMake GUI tool and select the Visual Studio generator there. That's pretty much all that's needed.\n\n### Android\n\nYou will need the Android SDK and NDK and the correct environment variables for this to work.\n\n```sh\nmkdir build\n\ncmake -H. -B./build/armeabi-v7a -D ANDROID_ABI=armeabi-v7a -D ANDROID_PLATFORM=android-33 -D DEBUG=1 -D BUILD_EXAMPLE=1 -D CMAKE_TOOLCHAIN_FILE=./cmake/android.toolchain.cmake -G Ninja\ncmake -H. -B./build/arm64-v8a -D ANDROID_ABI=arm64-v8a -D ANDROID_PLATFORM=android-33 -D DEBUG=1 -D BUILD_EXAMPLE=1 -D CMAKE_TOOLCHAIN_FILE=./cmake/android.toolchain.cmake -G Ninja\ncmake -H. -B./build/x86 -D ANDROID_ABI=x86 -D ANDROID_PLATFORM=android-33 -D DEBUG=1 -D BUILD_EXAMPLE=1 -D CMAKE_TOOLCHAIN_FILE=./cmake/android.toolchain.cmake -G Ninja\ncmake -H. -B./build/x86_64 -D ANDROID_ABI=x86_64 -D ANDROID_PLATFORM=android-33 -D DEBUG=1 -D BUILD_EXAMPLE=1 -D CMAKE_TOOLCHAIN_FILE=./cmake/android.toolchain.cmake -G Ninja\n\nninja -C build/armeabi-v7a -j8 \u0026\u0026 ninja -C build/arm64-v8a -j8 \u0026\u0026 ninja -C build/x86 -j8 \u0026\u0026 ninja -C build/x86_64 -j8\n\ncd ../platform/android/android-project\n./gradlew installDebug\n```\n\n### iOS\n\nYou will need the latest Xcode and its command line tools.\n\n```sh\nmkdir build\ncd build\ncmake -G Xcode -D DEBUG=1 -D IOS=1 -D BUILD_EXAMPLE=1 ../\nopen binocle.xcodeproj\n```\n\n#### iOS without Xcode\n\nIf you want to compile for the simulator replace:\n- BINOCLE_IOS_SDK=iphonesimulator\n- BINOCLE_IOS_ARCH=x86_64\n\n```sh\nmkdir build\ncd build\ncmake -D DEBUG=1 -D IOS=1 -D BUILD_EXAMPLE=1 -D BINOCLE_IOS_SDK=iphoneos -D BINOCLE_IOS_ARCH=arm64 ../\nmake -j8\n```\n\n### Emscripten (web)\n\nYou need a recent version of Emscripten installed on your system.\nIf you're using macOS, you can't just do a `brew install emscripten` to set it up. It will have issues.\nThe best way is to clone emscripten's repository and follow its setup guide.\nIn the end you will have a shell script to run to setup all the environment variables. Just replace its path in the script below.\n\n```sh\nmkdir build\ncd build\nsource \"/Users/tanis/Documents/emsdk/emsdk_env.sh\"\nemcmake cmake ../ -DCMAKE_BUILD_TYPE=Release -D BUILD_EXAMPLE=1\nmake -j8\ncd example/src\npython -m SimpleHTTPServer 8000\nopen http://localhost:8000/ExampleProject.html\n```\n\n### Generating the documentation\n\nTo generate the documentation just add the `-DBUILD_DOC=ON` option when running cmake.\n\n### HTTP Support\n\nBinocle supports HTTP requests through curl. The feature can be enabled by setting BINOCLE_HTTP.\nThis is only supported on desktop systems and the browser. There is no support planned for iOS and Android at the moment.\n\n#### macOS additional requirements\n\nOn macOS, when enabling HTTP support, you have to provide the path to OpenSSL as it will be linked as a dynamic library.\nIn order to do that please do the following before running cmake.\n\nOn Intel Mac:\n```shell\nexport PKG_CONFIG_PATH=/usr/local/opt/openssl@3/lib/pkgconfig\n```\n\nOn ARM Mac:\n```shell\nexport PKG_CONFIG_PATH=/opt/homebrew/opt/openssl@3/lib/pkgconfig\n```\n\n\n## Credits\n\nMany of the concepts come from Matt Thorson's Monocle engine (the name of this project is a kind of joke around Matt's engine name as you can guess).\n\nSome code has been developed while Prime31 was working on its own C# engine called Nez so there will surely be similarities and lines of code that are almost the same.\n\nThe ECS has been inspired by [Artemis](https://github.com/junkdog/artemis-odb) and some parts have been taken from [Diana](https://github.com/discoloda/Diana)\nOther pieces of code have been taken here and there on the web and I can't recall where they come from. If you see some code that looks familiar, please let me know and I'll give full credits.\n\nThe Metal backend and the glue code to keep both OpenGL and Metal as available backends has been taken from Andre Weissflog's exceptional Sokol library. I started implementing a first version based on it and I ended up reusing a lot of his code. In the future I will probably just adopt Sokol as the backend, but it was actually a good exercise to learn how to implement a cross-platform API with complete separation of platform-dependent code.\n\nThe logo has been created using the following images:\n\n- [GamePad](https://www.flaticon.com/free-icon/game-console_434898) by [Freepik](https://www.freepik.com/)\n- [binoculars](https://www.flaticon.com/free-icon/binoculars_125767) by [Gregor Cresnar](https://www.flaticon.com/authors/gregor-cresnar)\n\nThe idea of the final logo is from [@h_a_l_e_x](https://twitter.com/h_a_l_e_x)\n\nA big thank you to JetBrains for providing us Open Source license of CLion. If you do not know about them, please check out their site by clicking on the logo below. They make the best tool for C developers, hands-down\n[\u003cimg alt=\"JetBrains Logo (Main) logo\" src=\"https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png\" width=\"200\"/\u003e](https://jb.gg/OpenSource)\n[\u003cimg alt=\"CLion logo\" src=\"https://resources.jetbrains.com/storage/products/company/brand/logos/CLion.png\" width=\"200\"/\u003e](https://jb.gg/OpenSource)\n\n## Examples\n\nHere's an [examples' repository](https://github.com/tanis2000/binocle-c-examples) with a few examples to start with.\n\nThis repository also contains an example project that I use to debug and test new features.\nIt can be compiled by using the `-D BUILD_EXAMPLE=1` CMake directive.\n\n## Projects using Binocle\n\n* [Binocle Player](https://github.com/tanis2000/binocle-player) is a simple project based on Binocle to create 2D games using Lua. It is somewhat similar to Love2D.\n\n\n* ![Shadow Crash screenshot](images/screenshots/ld50-shadow-crash.gif)\n\n[Shadow Crash](https://tanis.itch.io/shadow-crash), my entry for Ludum Dare 50.\nYou can get the [source code here](https://github.com/tanis2000/binocle-player/tree/ld50)\n\n![Santa frowns to town screenshot](images/screenshots/ld43-binocle-cover.png)\n\n[Santa frowns to town](https://tanis.itch.io/santa-frowns-to-town), my entry for Ludum Dare 43.\nYou can get the [source code here](https://github.com/tanis2000/ld43-binocle)\n\n![Binocle Demo Tool screenshot](images/screenshots/binocle-demomaker-001.png)\n\nBinocle Demo Tool, my personal unreleased demo tool\n\n## License\n\nThe MIT License (MIT)\nCopyright (c) 2015-2024 Valerio Santinelli\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanis2000%2Fbinocle-c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftanis2000%2Fbinocle-c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanis2000%2Fbinocle-c/lists"}