{"id":19695435,"url":"https://github.com/tanis2000/minigame-rust","last_synced_at":"2025-04-29T10:31:17.411Z","repository":{"id":41274867,"uuid":"93539739","full_name":"tanis2000/minigame-rust","owner":"tanis2000","description":"A simple game made in Rust that runs on desktop and mobile","archived":false,"fork":false,"pushed_at":"2020-01-23T15:21:49.000Z","size":2386,"stargazers_count":122,"open_issues_count":2,"forks_count":19,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-05T15:03:17.846Z","etag":null,"topics":["android","desktop","game","game-dev","game-development","game-engine","gamedev","ios","macos","mobile","rust","windows"],"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":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-06T16:27:03.000Z","updated_at":"2024-10-14T04:30:50.000Z","dependencies_parsed_at":"2022-09-21T00:00:29.986Z","dependency_job_id":null,"html_url":"https://github.com/tanis2000/minigame-rust","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanis2000%2Fminigame-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanis2000%2Fminigame-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanis2000%2Fminigame-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanis2000%2Fminigame-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tanis2000","download_url":"https://codeload.github.com/tanis2000/minigame-rust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251483763,"owners_count":21596597,"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":["android","desktop","game","game-dev","game-development","game-engine","gamedev","ios","macos","mobile","rust","windows"],"created_at":"2024-11-11T19:27:52.262Z","updated_at":"2025-04-29T10:31:12.383Z","avatar_url":"https://github.com/tanis2000.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# minigame\n\nThis is a basic sample game made with Rust that runs on both desktop and mobile platforms.\n\nSupported platforms:\n\n- Windows\n- macOS\n- Linux\n- iOS\n- Android\n- Browser\n\nRight now it's been tested on macOS, iOS, Android and the browser and it works as long as you do some steps by hand.\nThe idea is to have the whole show running on its own without the need of any manual steps.\n\n## Screenshot\n\n![Screenshot of the game](doc/screenshot.png)\n\n## Hot code reloading\n\nThis is a feature that is only available on the desktop but it's very handy when working with gameplay code.\n\nEdit `src/test_shared.rs` and run `cargo build` to see hot reloading in action.\n\nRun `cargo run` to run with the dynamic library\nRun `cargo run --no-default-features` to run the application with all of the code statically linked and with hotloading disabled.\n\n## Installing needed targets for mobile\n\n```sh\n# iOS. Note: you need *all* five targets\nrustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-ios i386-apple-ios\n\n# Android\nrustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android\n```\n\n## Building without hot reloading\n\n```sh\ncargo build --no-default-features --lib\n```\n\n## Building the Rust library for iOS\n\nminigame supports building for both the iOS simulator and real devices.\n\n### Building for the iOS simulator\n\nTo build for iOS simulator:\n\n```sh\ncargo build --no-default-features --target x86_64-apple-ios --lib\n```\n\nThis command will also download SDL2 and compile it for both the simulator and iOS device\n\n### Building for an iOS device\n\nTo build for iOS simulator:\n\n```sh\ncargo build --no-default-features --target aarch64-apple-ios --lib\n```\n\nThis command will also download SDL2 and compile it for both the simulator and iOS device\n\n## Compiling the iOS project\n\nJust open the `ios/minigame/minigame.xcodeproj` Xcode project and run it and you should be done.\n\n## Building the Android standalone toolchain\n\n```sh\n/Users/tanis/Documents/android-sdk/ndk-bundle/build/tools/make_standalone_toolchain.py --arch arm --install-dir /Users/tanis/Documents/android-ndk-arm\n/Users/tanis/Documents/android-sdk/ndk-bundle/build/tools/make_standalone_toolchain.py --arch arm64 --install-dir /Users/tanis/Documents/android-ndk-arm64\n/Users/tanis/Documents/android-sdk/ndk-bundle/build/tools/make_standalone_toolchain.py --arch x86 --install-dir /Users/tanis/Documents/android-ndk-x86\n/Users/tanis/Documents/android-sdk/ndk-bundle/build/tools/make_standalone_toolchain.py --arch x86_64 --install-dir /Users/tanis/Documents/android-ndk-x86_64\n```\n\n## Configuration for Android linking\n\nFor the time being you have to use a standalone toolchain. I'm pretty sure this can be solved with some clever\ncode in `build.rs` by setting the correct sysroot, but that's something left for later.\n\nEdit `.cargo/config` and add the following:\n\n```toml\n[target.armv7-linux-androideabi]\nlinker = \"/Users/tanis/Documents/android-ndk-arm/bin/arm-linux-androideabi-gcc\"\n\n[target.aarch64-linux-android]\nlinker = \"/Users/tanis/Documents/android-ndk-arm64/bin/aarch64-linux-android-gcc\"\n\n[target.i686-linux-android]\nlinker = \"/Users/tanis/Documents/android-ndk-x86/bin/i686-linux-android-gcc\"\n\n[target.x86_64-linux-android]\nlinker = \"/Users/tanis/Documents/android-ndk-x86_64/bin/x86_64-linux-android-gcc\"\n\n```\n\n## Building the SDL2 library for Android\n\n```sh\ncd android/Minigame/sdl\n../gradlew assemble\n```\n\n## Building the Rust library for Android\n\nThe following used to work until I introduced dependent cargo libraries that wrap C/C++ code. It looks like `.cargo/config` parameters aren't being passed down the line, so we need a workaround.\n\n```sh\ncargo build --no-default-features --target armv7-linux-androideabi --lib\ncargo build --no-default-features --target i686-linux-android --lib\ncargo build --no-default-features --target x86_64-linux-android --lib\n```\n\nThe workaround is to use the following and pass the reference to C, CXX and AR by hand (ugly!):\n\n```sh\nCC=/Users/tanis/Documents/android-ndk-arm/bin/arm-linux-androideabi-gcc CXX=/Users/tanis/Documents/android-ndk-arm/bin/arm-linux-androideabi-g++ AR=/Users/tanis/Documents/android-ndk-arm/bin/arm-linux-androideabi-ar cargo build --no-default-features --target armv7-linux-androideabi --lib\n\nCC=/Users/tanis/Documents/android-ndk-x86/bin/i686-linux-android-gcc CXX=/Users/tanis/Documents/android-ndk-x86/bin/i686-linux-android-g++ AR=/Users/tanis/Documents/android-ndk-x86/bin/i686-linux-android-ar cargo build --no-default-features --target i686-linux-android --lib\n\nCC=/Users/tanis/Documents/android-ndk-x86_64/bin/x86_64-linux-android-gcc CXX=/Users/tanis/Documents/android-ndk-x86_64/bin/x86_64-linux-android-g++ AR=/Users/tanis/Documents/android-ndk-x86_64/bin/x86_64-linux-android-ar cargo build --no-default-features --target x86_64-linux-android --lib\n```\n\n## Copying the Rust library to the Android project\n\n```sh\ncp target/armv7-linux-androideabi/debug/libminigame.so android/Minigame/app/src/main/jniLibs/armeabi/\ncp target/armv7-linux-androideabi/debug/libminigame.so android/Minigame/app/src/main/jniLibs/armeabi-v7a/\ncp target/i686-linux-android/debug/libminigame.so android/Minigame/app/src/main/jniLibs/x86/\ncp target/x86_64-linux-android/debug/libminigame.so android/Minigame/app/src/main/jniLibs/x86_64/\n```\n\n## Buiding the actual Android application\n\n```sh\ncd android/Minigame/app\n../gradlew assemble\n```\n\n## Building for the web\n\n### Using Emscripten\n\nRun the following command:\n\n```sh\nRUST_BACKTRACE=1 cargo web start --no-default-features --target wasm32-unknown-emscripten\n```\n\n## Credits\n\nGame background art by [RottingPixels](https://opengameart.org/content/2d-nature-platformer-tileset-16x16)\nGame art by [ansumuz](https://opengameart.org/content/sunny-land-2d-pixel-art-pack)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanis2000%2Fminigame-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftanis2000%2Fminigame-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanis2000%2Fminigame-rust/lists"}