{"id":13439466,"url":"https://github.com/SiegeLord/RustAllegro","last_synced_at":"2025-03-20T08:31:11.822Z","repository":{"id":7979805,"uuid":"9382928","full_name":"SiegeLord/RustAllegro","owner":"SiegeLord","description":"A Rust wrapper and bindings of Allegro 5 game programming library","archived":false,"fork":false,"pushed_at":"2025-01-23T07:58:12.000Z","size":48914,"stargazers_count":93,"open_issues_count":7,"forks_count":17,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-18T06:11:23.779Z","etag":null,"topics":["allegro","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SiegeLord.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":"2013-04-12T00:07:05.000Z","updated_at":"2025-02-10T23:34:21.000Z","dependencies_parsed_at":"2023-11-24T10:48:23.210Z","dependency_job_id":"0c35e389-e7bc-4883-b3f4-9d4de97451b8","html_url":"https://github.com/SiegeLord/RustAllegro","commit_stats":{"total_commits":431,"total_committers":7,"mean_commits":61.57142857142857,"dds":0.4849187935034803,"last_synced_commit":"1dad319c2fc733a8af8e69531d788c2714b69e6b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiegeLord%2FRustAllegro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiegeLord%2FRustAllegro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiegeLord%2FRustAllegro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiegeLord%2FRustAllegro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SiegeLord","download_url":"https://codeload.github.com/SiegeLord/RustAllegro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244577709,"owners_count":20475350,"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":["allegro","rust"],"created_at":"2024-07-31T03:01:14.148Z","updated_at":"2025-03-20T08:31:11.781Z","avatar_url":"https://github.com/SiegeLord.png","language":"Rust","readme":"# RustAllegro\n\n![Build Status](https://github.com/SiegeLord/RustAllegro/actions/workflows/continuous-integration.yml/badge.svg)\n[![](http://meritbadge.herokuapp.com/allegro)](https://crates.io/crates/allegro)\n\nA thin [Rust](http://www.rust-lang.org/) wrapper of [Allegro 5](http://liballeg.org/).\n\n## Game loop example\n\n```rust\nextern crate allegro;\nextern crate allegro_font;\n\nuse allegro::*;\nuse allegro_font::*;\n\nallegro_main!\n{\n    let core = Core::init().unwrap();\n    let font_addon = FontAddon::init(\u0026core).unwrap();\n\n    let display = Display::new(\u0026core, 800, 600).unwrap();\n    let timer = Timer::new(\u0026core, 1.0 / 60.0).unwrap();\n    let font = Font::new_builtin(\u0026font_addon).unwrap();\n\n    let queue = EventQueue::new(\u0026core).unwrap();\n    queue.register_event_source(display.get_event_source());\n    queue.register_event_source(timer.get_event_source());\n\n    let mut redraw = true;\n    timer.start();\n    'exit: loop\n    {\n        if redraw \u0026\u0026 queue.is_empty()\n        {\n            core.clear_to_color(Color::from_rgb_f(0.0, 0.0, 0.0));\n            core.draw_text(\u0026font, Color::from_rgb_f(1.0, 1.0, 1.0),\n                (display.get_width() / 2) as f32, (display.get_height() / 2) as f32,\n                FontAlign::Centre, \"Welcome to RustAllegro!\");\n            core.flip_display();\n            redraw = false;\n        }\n\n        match queue.wait_for_event()\n        {\n            DisplayClose{..} =\u003e break 'exit,\n            TimerTick{..} =\u003e redraw = true,\n            _ =\u003e (),\n        }\n    }\n}\n```\n\n## Documentation\n\nSee [docs.rs](https://docs.rs/allegro/latest/allegro/). Note\nthat it is very incomplete. You'll likely want to refer back to Allegro's\n[documentation](http://liballeg.org/api.html) somewhat heavily at this time.\n\n## Packages\n\nThe included packages are:\n\nWrappers:\n\n* [allegro](https://crates.io/crates/allegro)\n* [allegro_acodec](https://crates.io/crates/allegro_acodec)\n* [allegro_audio](https://crates.io/crates/allegro_audio)\n* [allegro_dialog](https://crates.io/crates/allegro_dialog)\n* [allegro_font](https://crates.io/crates/allegro_font)\n* [allegro_image](https://crates.io/crates/allegro_image)\n* [allegro_primitives](https://crates.io/crates/allegro_primitives)\n* [allegro_ttf](https://crates.io/crates/allegro_ttf)\n\nBindings:\n\n* [allegro-sys](https://crates.io/crates/allegro-sys)\n* [allegro_acodec-sys](https://crates.io/crates/allegro_acodec-sys)\n* [allegro_audio-sys](https://crates.io/crates/allegro_audio-sys)\n* [allegro_dialog-sys](https://crates.io/crates/allegro_dialog-sys)\n* [allegro_font-sys](https://crates.io/crates/allegro_font-sys)\n* [allegro_image-sys](https://crates.io/crates/allegro_image-sys)\n* [allegro_primitives-sys](https://crates.io/crates/allegro_primitives-sys)\n* [allegro_ttf-sys](https://crates.io/crates/allegro_ttf-sys)\n\nExamples:\n\n* [allegro_examples](https://crates.io/crates/allegro_examples)\n\n## General usage notes\n\nThe `allegro-sys` package (and, transitively, the rest of the packages) detects\nwhich version of Allegro to bind by parsing the C header. The build script will\nlook for it in some common locations, but sometimes you will need to help it by\nspecifying the `ALLEGRO_INCLUDE_DIR` environment variable when invoking `cargo\nbuild`. This directory should contain the `allegro5` directory with all of the\nheaders inside it. The build script will define the following two metadata\nentries that the crates that depend on it can use to determine which version is\nused:\n\n* `sub_version` - The sub version of Allegro (e.g. for 5.1.10 the sub version is 1)\n\n* `wip_version` - The wip version of Allegro (e.g. for 5.1.10 the wip version is 10).\n\nNote that the `Core::init()` will attempt to verify that the binding\ncorresponds to the version of the library you're linking to.\n\nThere are a few features that might come in useful:\n\n* `link_none` - Do not try to link the standard Allegro libraries, in\n                case you want to link the monolith library or have other\n                needs.\n* `link_debug` - Link to the debug versions of the Allegro libraries. Can\n                 be combined with `link_static`.\n* `link_static` - Link to the static versions of the Allegro libraries.\n                  Note that you'll have to link the various dependency\n                  libraries yourself. Can be combined with `link_debug`.\n\nAdditionally, you can specify a link directory by setting a `ALLEGRO_LINK_DIR`.\n\n## Windows notes\n\nRustAllegro works well with the official pre-compiled binaries. First,\ndownload the official binaries from http://liballeg.org. You'll want to\nmatch the ABI of your Rust installation. GNU ABI on 32 bit can load\nAllegro 32 bit MSVC binaries, but otherwise you'll want to match the\nplatform and ABI exactly. Let's say you extract the binaries to\n`C:/allegro`. That directory will contain the include, bin and lib\ndirectories. To compile and run the RustAllegro examples, do the\nfollowing from the RustAllegro's `examples` directory:\n\n* If you're using MSYS:\n\n```\nexport ALLEGRO_INCLUDE_DIR=C:/allegro/include\nexport ALLEGRO_LINK_DIR=C:/allegro/lib\ncargo build\n```\n\n* If you're using cmd directly:\n\n```\nset ALLEGRO_INCLUDE_DIR=C:/allegro/include\nset ALLEGRO_LINK_DIR=C:/allegro/lib\ncargo build\n```\n\nNow you need to copy the Allegro DLLs next to the generated executables\n(which will probably be under target/debug directory). Now you should\nbe able to run the examples (make sure to run them from RustAllegro's\n`examples` directory, so they can find the various data files they\nrequire).\n","funding_links":[],"categories":["Libraries","代码","库 Libraries","库"],"sub_categories":["Game development","游戏开发","游戏开发 Game development"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSiegeLord%2FRustAllegro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSiegeLord%2FRustAllegro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSiegeLord%2FRustAllegro/lists"}