{"id":13439579,"url":"https://github.com/PistonDevelopers/glfw-rs","last_synced_at":"2025-03-20T08:31:41.662Z","repository":{"id":4671487,"uuid":"5817736","full_name":"PistonDevelopers/glfw-rs","owner":"PistonDevelopers","description":"GLFW3 bindings and idiomatic wrapper for Rust.","archived":false,"fork":false,"pushed_at":"2024-05-22T09:52:59.000Z","size":1648,"stargazers_count":635,"open_issues_count":42,"forks_count":121,"subscribers_count":37,"default_branch":"master","last_synced_at":"2024-05-23T00:07:11.020Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PistonDevelopers.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":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-09-15T05:09:59.000Z","updated_at":"2024-06-14T15:27:32.963Z","dependencies_parsed_at":"2024-06-14T15:27:29.373Z","dependency_job_id":"19cd872e-d95f-425a-9f2e-3347b082d27b","html_url":"https://github.com/PistonDevelopers/glfw-rs","commit_stats":{"total_commits":845,"total_committers":101,"mean_commits":8.366336633663366,"dds":"0.48165680473372785","last_synced_commit":"0d232c8d8156aaa8baa1a0e0a2cdc451c5e2d111"},"previous_names":["bjz/glfw-rs"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PistonDevelopers%2Fglfw-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PistonDevelopers%2Fglfw-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PistonDevelopers%2Fglfw-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PistonDevelopers%2Fglfw-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PistonDevelopers","download_url":"https://codeload.github.com/PistonDevelopers/glfw-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221739734,"owners_count":16872779,"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":[],"created_at":"2024-07-31T03:01:15.291Z","updated_at":"2024-10-27T22:31:22.323Z","avatar_url":"https://github.com/PistonDevelopers.png","language":"Rust","funding_links":[],"categories":["Libraries","Rust","库 Libraries","库"],"sub_categories":["Graphics","图形 Graphics","图像","图像 Graphics"],"readme":"\u003c!--\n    Copyright 2013-2014 The GLFW-RS Developers. For a full listing of the authors,\n    refer to the AUTHORS file at the top-level directory of this distribution.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n--\u003e\n\n# glfw-rs\n\n[![Crates.io](https://img.shields.io/crates/v/glfw)](https://crates.io/crates/glfw)\n[![Docs.rs](https://docs.rs/glfw/badge.svg)](https://docs.rs/glfw)\n[![Build Status](https://travis-ci.org/PistonDevelopers/glfw-rs.svg?branch=master)](https://travis-ci.org/PistonDevelopers/glfw-rs)\n\nGLFW bindings and wrapper for The Rust Programming Language.\n\n## Example\n\n~~~rust\nextern crate glfw;\n\nuse glfw::{Action, Context, Key};\n\nfn main() {\n    let mut glfw = glfw::init(glfw::fail_on_errors).unwrap();\n\n    let (mut window, events) = glfw.create_window(300, 300, \"Hello this is window\", glfw::WindowMode::Windowed)\n        .expect(\"Failed to create GLFW window.\");\n\n    window.set_key_polling(true);\n    window.make_current();\n\n    while !window.should_close() {\n        glfw.poll_events();\n        for (_, event) in glfw::flush_messages(\u0026events) {\n            handle_window_event(\u0026mut window, event);\n        }\n    }\n}\n\nfn handle_window_event(window: \u0026mut glfw::Window, event: glfw::WindowEvent) {\n    match event {\n        glfw::WindowEvent::Key(Key::Escape, _, Action::Press, _) =\u003e {\n            window.set_should_close(true)\n        }\n        _ =\u003e {}\n    }\n}\n~~~\n\n## Using glfw-rs\n\n### Prerequisites\n\nMake sure you have [compiled and installed GLFW 3.x](http://www.glfw.org/docs/latest/compile.html).\nYou might be able to find it on your package manager, for example on OS X:\n`brew install glfw3` (you may need to run `brew tap homebrew/versions`).\nIf not you can download and build the library\n[from the source](http://www.glfw.org/docs/latest/compile.html) supplied on the\nGLFW website. Note that if you compile GLFW with CMake on Linux, you will have\nto supply the `-DCMAKE_C_FLAGS=-fPIC` argument. You may install GLFW to your\n`PATH`, otherwise you will have to specify the directory containing the library\nbinaries when you call `make` or `make lib`:\n\n~~~\nGLFW_LIB_DIR=path/to/glfw/lib/directory make\n~~~\n\n### Including glfw-rs in your project\n\nAdd this to your `Cargo.toml`:\n\n~~~toml\n[dependencies.glfw]\nversion = \"*\"\n~~~\n\n#### On Windows\n\nBy default, `glfw-rs` will try to compile the `glfw` library. If you want to link to your custom\nbuild of `glfw` or if the build doesn't work (which is probably the case on Windows), you can\ndisable this:\n\n~~~toml\n[dependencies.glfw]\nversion = \"*\"\ndefault-features = false\n~~~\n\n### Raw window handle 0.5.0 compatibility\n\nBy default, `glfw-rs` uses raw-window-handle at v0.6.0. If your project is depending on `glfw-rs`\nwith raw-window-handle v0.5.0, then use this line in your Cargo.toml:\n~~~\nglfw = { version = 0.56.0 , default-features = false, features = [\"with-window-handle-v0-5\"] }\n~~~\n\n## Support\n\nContact `bjz` on irc.mozilla.org [#rust](http://mibbit.com/?server=irc.mozilla.org\u0026channel=%23rust)\nand [#rust-gamedev](http://mibbit.com/?server=irc.mozilla.org\u0026channel=%23rust-gamedev),\nor [post an issue](https://github.com/bjz/glfw-rs/issues/new) on GitHub.\n\n## glfw-rs in use\n\n- [sebcrozet/kiss3d](https://github.com/sebcrozet/kiss3d)\n- [Jeaye/q3](https://github.com/Jeaye/q3)\n- [cyndis/rsmc](https://github.com/cyndis/rsmc/)\n- [ozkriff/zoc](https://github.com/ozkriff/zoc)\n\n## glfw-rs with other graphical APIs\n\nIn certain circumstances OpenGL which GLFW uses can conflict with the new handle that the \ngraphical API is also trying to use, causing crashes, to fix this add\n~~~rust\nglfw.window_hint(WindowHint::ClientApi(ClientApiHint::NoApi));\n~~~\nbefore creating the window. If using this however you cannot use certain built-in functions, \nsuch as `window.swap_buffers()`, `window.make_current()`, and `glfw.set_swap_interval()`, but\nthese should have equivalents provided by the graphical API.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPistonDevelopers%2Fglfw-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPistonDevelopers%2Fglfw-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPistonDevelopers%2Fglfw-rs/lists"}