{"id":22360814,"url":"https://github.com/renehorstmann/some","last_synced_at":"2025-07-30T13:32:02.766Z","repository":{"id":43833005,"uuid":"338605756","full_name":"renehorstmann/some","owner":"renehorstmann","description":"Sdl2 OpenGL Mini Engine.","archived":false,"fork":false,"pushed_at":"2023-06-29T19:50:17.000Z","size":1706,"stargazers_count":23,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T09:03:21.502Z","etag":null,"topics":["android","c","emscripten","engine","mobile","opengl","sdl2","wasm","webapp"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/renehorstmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-13T15:33:39.000Z","updated_at":"2024-11-23T00:22:51.000Z","dependencies_parsed_at":"2023-02-18T01:30:26.517Z","dependency_job_id":null,"html_url":"https://github.com/renehorstmann/some","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/renehorstmann/some","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renehorstmann%2Fsome","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renehorstmann%2Fsome/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renehorstmann%2Fsome/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renehorstmann%2Fsome/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/renehorstmann","download_url":"https://codeload.github.com/renehorstmann/some/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renehorstmann%2Fsome/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267875504,"owners_count":24158780,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"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":["android","c","emscripten","engine","mobile","opengl","sdl2","wasm","webapp"],"created_at":"2024-12-04T16:18:42.084Z","updated_at":"2025-07-30T13:32:02.379Z","avatar_url":"https://github.com/renehorstmann.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# some\r\n\r\n**Sdl2 OpenGL Mini Engine.**\r\n\r\nA small C game engine, that can be compiled to Desktop, Android, Web, ... \r\n\r\nUsing SDL2, OpenGL3.3, OpenGLES3.0, WebGL2.0 to be platform independent.\r\n\r\nsome's main goal is to create apps and games that run directly on the different platforms. \r\n\r\n**Also as a web version on smartphones!** \r\n\r\n## Getting started\r\n\r\nFork this repo and have fun. Have a look into some header files for some further explanation.\r\n\r\n## Live demo \r\nJust the hello world [livedemo](https://renehorstmann.github.io/some) compiled with emscripten.\r\nSee [main.c](src/main.c)\r\n\r\n## Tutorial\r\n\r\nIn the repository [some_examples](https://github.com/renehorstmann/some_examples) \r\nare some examples and modules to use for the some framework, like buttons, textinput, colorpicker, etc.\r\nThe examples are well documented and easy to follow.\r\n\r\n## Sponsoring\r\nYou want to support me?\r\n\u003e Buy Pixelc Premium on [Google Play](https://play.google.com/store/apps/details?id=de.horsimann.pixelcpremium).\r\nIts just like [Pixelc](https://github.com/renehorstmann/Pixelc), but with a dark background and gray scaled buttons.\r\n\r\n\u003e Buy coins in EXTREME COIN STACKER on  [Google Play](https://play.google.com/store/apps/details?id=de.horsimann.coinstacker).\r\n\r\n## Example Apps\r\n\r\n- [Pixelc](https://github.com/renehorstmann/Pixelc): A pixel art editor.\r\n- [Swarm](https://github.com/renehorstmann/GMTKgamejam21): GMTK GameJam21.\r\n- [Santas Day Off](https://github.com/renehorstmann/SantasDayOff): A christmas mini game.\r\n- [JumpHare](https://github.com/renehorstmann/JumpHare): Platformer game.\r\n- [Tea](https://github.com/renehorstmann/tea): A simple stupid tea timer.\r\n\r\n\r\n\r\n## Install and run\r\nOptions:\r\n- Desktop\r\n  - [Ubuntu](#install-for-ubuntu-or-wsl-ubuntu)\r\n  - [Windows 11 WSL Ubuntu](#install-for-windows-11-wsl-windows-subsystem-linux-ubuntu)\r\n  - [Windows Msys2](#install-windows-msys2)\r\n  - [Windows MSVC](#install-windows-msvc)\r\n- [In an Android App](#install-compile-and-run-directly-on-android)\r\n- [To an Android App](#android-app-with-androidstudio)\r\n- [Web](#compiling-for-web)\r\n\r\n### Install for Ubuntu or WSL Ubuntu\r\n- Install the needed libraries in the shell:\r\n```sh\r\n# update the system\r\nsudo apt update \u0026\u0026 sudo apt upgrade\r\n# install basic stuff for c coding\r\nsudo apt install build-essential gdb git cmake \r\n# install sdl stuff \r\n# \tnet, ttf are optional, see OPTION_SOCKET and OPTION_TTF\r\n#\tmixer is not part of the some engine, but useful\r\nsudo apt install libsdl2-dev libsdl2-image-dev libsdl2-net-dev libsdl2-ttf-dev libsdl2-mixer-dev\r\n# install curl (optional) for OPTION_FETCH \r\nsudo apt install libcurl4-openssl-dev\r\n```\r\n\r\n- [now run the hello world demo](#run-hello-world)\r\n\r\n\r\n### Install Windows 11 WSL (Windows Subsystem Linux) Ubuntu\r\nWith WSL you can use all the awesome unix tools in Windows with an Ubuntu terminal.\r\nBut you can not distribute your compiled programs, the users have to have WSL installed.\r\nSee Windows MSYS2 or MSVC below, if you want to create an .exe to distribute for Windows\r\n\r\n- run Powershell as admin\r\n```\r\nwsl --install\r\n```\r\n- see [Ubuntu](#install-for-ubuntu-or-wsl-ubuntu) with the Windows Ubuntu shell\r\n\r\n\r\n### Install Windows MSYS2\r\nMSYS2 is a package manager for Windows, that can install the compiler Mingw-w64, \r\nwhich is a port of the GCC-Compiler with wrapper POSIX headers for Windows.\r\n\r\n- install [MSYS2](https://www.msys2.org/)\r\n- update the package manager (as the site says: `pacman -Syu` ; restart ; `pacman -Su`)\r\n- In \"MSYS2 MSYS\" Terminal\r\n```sh\r\n# basic stuff for c coding\r\npacman -S --needed base-devel mingw-w64-x86_64-toolchain\r\npacman -S git mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja\r\n# install sdl stuff\r\n# \tnet, ttf are optional, see OPTION_SOCKET and OPTION_TTF\r\n#\tmixer is not part of the some engine, but useful\r\npacman -S mingw-w64-x86_64-glew mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_image mingw-w64-x86_64-SDL2_net mingw-w64-x86_64-SDL2_ttf mingw-w64-x86_64-SDL2_mixer\r\n# install curl (optional) for OPTION_FETCH \r\npacman -S mingw-w64-x86_64-curl\r\n```\r\n- add the following line at the end of the file .bashrc (runs on terminal startup) (run `nano ~/.bashrc`)\r\n```\r\n# add mingw32 lib to the path, in this dir should be the opengl libraries (dll)\r\nexport PATH=$PATH:/c/msys64/mingw64/x86_64-w64-mingw32/lib\r\n```\r\n- Close the terminal\r\n- If you use an IDE, you may need to add the PATH to ...mingw32/lib (see above) into the windows system variables\r\n\r\n- [now run the hello world demo](#run-hello-world)\r\n\r\n\r\n### Run Hello World\r\nIn Ubuntu, WSL Ubuntu or \"MSYS2 MinGW x64\" Terminal:\r\n```sh\r\n# clone the repo\r\ngit clone https://github.com/renehorstmann/some\r\n# mv and make a build dir\r\ncd some \u0026\u0026 mkdir build \u0026\u0026 cd build\r\n# run cmake\r\ncmake .. # [-DCMAKE_BUILD_TYPE=Release] for release mode\r\n# compile\r\ncmake --build . # [-- -j16] to compile with 16 threads... \r\n# run\r\n./some\r\n```\r\n\r\n### Install Windows MSVC\r\nMSVC is the Microsoft C(++) Compiler, that comes with Visual Studio.\r\nThe compiler can also be installed without the IDE.\r\n\r\n- install MSVC [Buildtools](https://visualstudio.microsoft.com/de/downloads/)\r\n  - scroll down to \"Tools for Visual Studio\"\r\n  - or install Visual Studio IDE directly if you want to use it\r\n  - you need at least MSVC Version 2019 16.8\r\n- install a [git client](https://git-scm.com/download/win)\r\n- install [cmake](https://cmake.org/download/) (add to system PATH)\r\n- install [vcpkg](https://vcpkg.io/en/getting-started.html)\r\n    - we already installed the MSVC compiler, so no need to install Visual Studio, if you dont want that IDE\r\n\r\n    - To install vcpk in PowerShell:\r\n  ```sh\r\n  cd C:\\\r\n  mkdir dev\r\n  cd dev\r\n  git clone https://github.com/Microsoft/vcpkg.git\r\n  .\\vcpkg\\bootstrap-vcpkg.bat -disableMetrics\r\n  cd vcpkg\r\n  ```\r\n- Install packages in Powershell\r\n```sh\r\ncd C:\\dev\\vcpkg\r\n# install sdl stuff\r\n# \tnet, ttf are optional, see OPTION_SOCKET and OPTION_TTF\r\n#\tmixer is not part of the some engine, but useful\r\n.\\vcpkg install glew:x64-windows sdl2:x64-windows sdl2-image:x64-windows sdl2-net:x64-windows sdl2-ttf:x64-windows sdl2-mixer:x64-windows\r\n# install curl (optional) for OPTION_FETCH \r\n.\\vcpkg install curl:x64-windows\r\n```\r\n\r\n- [now run the hello world demo with MSVC](#run-hello-world-with-msvc)\r\n\r\n### Run Hello World with MSVC\r\nIn the Powershell Terminal:\r\n```sh\r\n# clone the repo\r\ngit clone https://github.com/renehorstmann/some\r\n# mv and make a build dir\r\ncd some \r\nmkdir build\r\ncd build\r\n#\r\n# run cmake\r\n# Note: you may have to edit the toolchain path for vcpkg\r\ncmake .. -DCMAKE_TOOLCHAIN_FILE=C:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake # [-DCMAKE_BUILD_TYPE=Release] for release mode\r\n# compile\r\ncmake --build .\r\n# run\r\n.\\Debug\\some.exe\r\n```\r\n\u003e An IDE may also need the cmake option for the toolchain file\r\n\r\n### Install, compile and run directly on Android\r\nUseful to test and code on the go. \r\n\r\nIn fact, most of some's code, my games and apps were developed that way!\r\n\r\nI recommend using a good Touchscreen-Keyboard-App with the right settings.\r\nIn my case its the Samsung default keyboard (Samsung Galaxy Note 8, btw.).\r\nMy recommended settings for the Samsung Keyboard:\r\n- Smart typing / Keyboard swipe controls: **Cursor controls**\r\n\t- so its easy to navigate to the code with swipes instead of tipping on the line and position you want to editor\r\n- Keyboard layout and feedback / Keyboard layout: **Number keys** checked; **Alternative characters** checked\r\n\t- so you can insert glyphs with a long press on the key, instead of switching to the alt. chars. site\r\n\r\nI used the full/paid version of [CxxDroid](https://play.google.com/store/apps/details?id=ru.iiec.cxxdroid) (from Google Play), other c compilers with SDL support may work, too\r\n\r\n- Install F-Droid: https://f-droid.org/\r\n- In F-Droid, install Termux (https://termux.com/)\r\n- In Termux, clone the project\r\n```sh\r\n# update the system\r\npkg upgrade\r\n# install basic stuff\r\npkg install git\r\n# get access to the local file system of your android device from termux (needs the storage permission)\r\ntermux-setup-storage\r\n# cd to your file system\r\ncd ~/storage/shared\r\n# optional, create a c projects folder\r\nmkdir cprojects \u0026\u0026 cd cprojects\r\n# clone the repo\r\ngit clone https://github.com/renehorstmann/some\r\n```\r\n- In CxxDroid, install the following libraries (Menu/Install Libraries)\r\n  - SDL2\r\n  - SDL2-image\r\n  - SDL2-net (optional with OPTION_SOCKET)\r\n  - SDL2-ttf (optional with OPTION_TTF)\r\n  - SDL2-mixer (not part of the some engine, but useful)\r\n  - libcurl (optional with OPTION_FETCH)\r\n- Open a file from some in CxxDroid\r\n- You should now be able to compile and run directly on Android\r\n\r\n### Android App with AndroidStudio\r\nHave a look at the [some_android](https://github.com/renehorstmann/some_android) AndroidStudio project generator template.\r\n\r\n### Compiling for Web\r\nsome compiles fine as website with wasm and webgl, that can also be used on mobile browsers.\r\n\r\nUsing the [Emscripten compiler](https://emscripten.org/docs/getting_started/downloads.html)\r\n\r\nTested under Ubuntu and WSL Ubuntu (may work on Windows too, if the compile calls are changed).\r\n\r\n\r\nYou should have already cloned the project and `cd` to that dir:\r\n\r\n- Create a sub directory to compile the website\r\n```sh\r\nmkdir web \u0026\u0026 cp index.html web \u0026\u0026 cp icon/* web \u0026\u0026 cd web\r\n```\r\n\r\n- Copy all resources, because emscripten may not be able to use `../res`\r\n```sh\r\ncp -r ../res .\r\n```\r\n\r\n- Compile\r\n```sh\r\nemcc -O3 \\\r\n-I../include/ \\\r\n-s USE_SDL=2 -s USE_SDL_IMAGE=2 -s FULL_ES3=1 -s \\\r\nEXPORTED_FUNCTIONS='[\"_main\", \"_e_io_idbfs_synced\", \"_e_io_file_upload_done\"]' \\\r\n-s EXPORTED_RUNTIME_METHODS=FS,ccall \\\r\n-s SDL2_IMAGE_FORMATS='[\"png\"]' \\\r\n--preload-file ./res \\\r\n-s ALLOW_MEMORY_GROWTH=1 -s ASYNCIFY=1 -s EXIT_RUNTIME=1 \\\r\n-lidbfs.js \\\r\n-DPLATFORM_EMSCRIPTEN -DOPTION_GLES -DOPTION_SDL \\\r\n../src/e/*.c ../src/p/*.c ../src/r/*.c ../src/u/*.c ../src/*.c \\\r\n-o index.js\r\n```\r\n\r\n- Test the website (open a browser and call localhost:8000)\r\n```sh\r\npython3 -m http.server --bind localhost  # [port]\r\n```\r\n\r\n- Compile with all options:\r\n\u003e fetch is more reliable than websockets, so SDL_net and OPTION_SOCKET are missing here\r\n```sh\r\nemcc -O3 \\\r\n-I../include/ \\\r\n-s USE_SDL=2 -s USE_SDL_IMAGE=2 -s USE_SDL_MIXER=2 -s USE_SDL_TTF=2 -s FULL_ES3=1 -s \\\r\nEXPORTED_FUNCTIONS='[\"_main\", \"_e_io_idbfs_synced\", \"_e_io_file_upload_done\"]' \\\r\n-s EXPORTED_RUNTIME_METHODS=FS,ccall \\\r\n-s SDL2_IMAGE_FORMATS='[\"png\"]' \\\r\n--preload-file ./res \\\r\n-s ALLOW_MEMORY_GROWTH=1 -s ASYNCIFY=1 -s EXIT_RUNTIME=1 -s FETCH=1 \\\r\n-lidbfs.js \\\r\n-DPLATFORM_EMSCRIPTEN -DOPTION_GLES -DOPTION_SDL -DOPTION_TTF -DOPTION_FETCH \\\r\n../src/e/*.c ../src/p/*.c ../src/r/*.c ../src/u/*.c ../src/*.c \\\r\n-o index.js\r\n```\r\n\r\n## Naming\r\n\r\n### Functions\r\n\r\nA function like: `e_window_init` got its name of:\r\n\r\n- `e`: as namespace for the package e\r\n- `window`: module name\r\n- `init`: module function/method name\r\n\r\n### Components\r\n\r\nEach component may have some basic function names:\r\n\r\n```c\r\n*_init      // initializes a (single member) module\r\n*_new       // returns a new component\r\n*_new_*     // special new\r\n*_kill      // deinitialize a comp.\r\n\r\n*_update    // update the internals\r\n*_render    // ...\r\n```\r\n\r\n### More Style rules\r\n\r\nFor more style rules used in my projects, see [rhc/style](https://github.com/renehorstmann/rhc)\r\n\r\n## Packages\r\n\r\nThe some framework consists of a few packages, each for specific tasks:\r\n\r\n### e\r\n\r\ne_* is for window and environment management, like window, input, sdl stuff...\r\n\r\n- e_gui: [nuklear](https://github.com/Immediate-Mode-UI/Nuklear) based debug gui\r\n\r\n### r\r\n\r\nr_* is for OpenGL rendering ro_* is for render objects\r\n\r\n### u\r\n\r\nUtilities like setting up a 2D pose or loading an image\r\n\r\n### p\r\n\r\nPhysics (may be expanded later)\r\n\r\n### m\r\n\r\nglsl like math library for C, see [Mathc](https://github.com/renehorstmann/Mathc)\r\nRenamed to namespace `m`\r\n\r\n### s\r\n\r\nA C standard library addition, see [rhc](https://github.com/renehorstmann/rhc).\r\nRenamed to the namespace `s`\r\n\r\n\r\n\r\n## Author\r\n\r\nRené Horstmann\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the someLICENSE file for details\r\n\r\n- Used third party libraries:\r\n    - [SDL2](https://www.libsdl.org/) (zlib License)\r\n    - [Emscripten](emscripten.org) (MIT License)\r\n    - [nuklear](https://github.com/Immediate-Mode-UI/Nuklear) for debug gui windows (MIT License)\r\n    - [curl](https://curl.se/docs/copyright.html) (MIT like License)\r\n    - [sfd](https://github.com/rxi/sfd) for simple file dialogs (MIT License)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenehorstmann%2Fsome","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frenehorstmann%2Fsome","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenehorstmann%2Fsome/lists"}