{"id":26798125,"url":"https://github.com/olson-sean-k/gaudium","last_synced_at":"2025-07-07T08:12:43.477Z","repository":{"id":145360843,"uuid":"156297294","full_name":"olson-sean-k/gaudium","owner":"olson-sean-k","description":"Cross-platform display and input abstraction.","archived":false,"fork":false,"pushed_at":"2019-11-20T06:57:20.000Z","size":153,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-07T08:12:22.811Z","etag":null,"topics":["event","gamepad","input","joystick","keyboard","mouse","rust","windowing"],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/olson-sean-k.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,"zenodo":null}},"created_at":"2018-11-05T23:27:19.000Z","updated_at":"2021-08-31T07:57:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"2a757ad1-06a0-41c2-8afb-d6252643f3a1","html_url":"https://github.com/olson-sean-k/gaudium","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/olson-sean-k/gaudium","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olson-sean-k%2Fgaudium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olson-sean-k%2Fgaudium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olson-sean-k%2Fgaudium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olson-sean-k%2Fgaudium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/olson-sean-k","download_url":"https://codeload.github.com/olson-sean-k/gaudium/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olson-sean-k%2Fgaudium/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264040959,"owners_count":23548075,"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":["event","gamepad","input","joystick","keyboard","mouse","rust","windowing"],"created_at":"2025-03-29T19:17:10.296Z","updated_at":"2025-07-07T08:12:43.471Z","avatar_url":"https://github.com/olson-sean-k.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Gaudium](https://raw.githubusercontent.com/olson-sean-k/gaudium/master/doc/gaudium.png)\n\n**Gaudium** is a Rust library for cross-platform display and input abstraction.\n\n[![CI](https://travis-ci.org/olson-sean-k/gaudium.svg?branch=master)](https://travis-ci.org/olson-sean-k/gaudium)\n[![Documentation](https://docs.rs/gaudium/badge.svg)](https://doc.rs/gaudium)\n[![Crate](https://img.shields.io/crates/v/gaudium.svg)](https://crates.io/crates/gaudium)\n\n## Event Threads and Reactors\n\nAn _event thread_ is used to process events dispatched from the target\nplatform. An event thread manages state and marshals events to a _reactor_,\nwhich allows user code to react to these events. This user code is always\nexecuted on the event thread and typically runs within platform code (within an\nOS or process event loop, etc.).\n\nReactors can immediately handle events within the event thread or further\ndispatch events as needed.\n\n```rust\nuse gaudium::platform::{Binding, WindowBuilderExt};\nuse gaudium::prelude::*;\nuse gaudium::reactor::{EventThread, FromContext, Reactor, ThreadContext};\nuse gaudium::window::{Window, WindowBuilder, WindowHandle};\nuse std::sync::mpsc::{self, Sender};\nuse std::thread::{self, JoinHandle};\n\nstruct TestReactor {\n    window: Window,\n    tx: Sender\u003cEvent\u003e,\n    handle: JoinHandle\u003c()\u003e,\n}\n\nimpl FromContext\u003cBinding\u003e for TestReactor {\n    fn from_context(context: \u0026ThreadContext) -\u003e (WindowHandle, Self) {\n        let window = WindowBuilder::default()\n            .with_title(\"Gaudium\")\n            .build(context)\n            .expect(\"\");\n        let (tx, rx) = mpsc::channel();\n        let handle = thread::spawn(move || {\n            while let Ok(event) = rx.recv() {\n                println!(\"{:?}\", event);\n            }\n        });\n        (window.handle(), TestReactor { window, tx, handle })\n    }\n}\n\nimpl Reactor\u003cBinding\u003e for TestReactor {\n    fn react(\u0026mut self, _: \u0026ThreadContext, event: Event) -\u003e Reaction {\n        match event {\n            Event::Window {\n                event: WindowEvent::Closed(..),\n                ..\n            } =\u003e Abort,\n            Event::Application { .. } =\u003e Continue(()),\n            _ =\u003e self.tx.send(event).map(|_| ()).into(),\n        }\n    }\n\n    fn abort(self) {\n        let TestReactor { tx, handle, .. } = self;\n        drop(tx);\n        let _ = handle.join();\n    }\n}\n\nEventThread::\u003cTestReactor\u003e::run_and_abort()\n```\n\nThe above example creates a reactor with a window (see below) and spawns another\nthread that prints the events it receives from a channel. The reactor causes the\napplication to stop when the window is closed and otherwise sends remote events\nto the other thread to be printed.\n\n## Input\n\nGaudium provides input events for keyboards, mice, and game controllers,\nincluding gamepads and joysticks. Gamepads and joysticks are handled in as\ngeneric a fashion as possible, with no symbolic mappings. The `framework` module\n(in `gaudium-core` and `gaudium`) provides additional tools for managing state\nand creating application-specific mappings for input devices.\n\n## Displays and Windowing\n\nA _window_ is a rendering target and event sink. Conceptually, a window is\npresented on a _display_, which is a physical device that presents a window to\nthe user. On platforms that support desktop environments, a window can be\ndirectly manipulated by users, but on some platforms a window is a thin\nabstraction for an entire display and only one window can be created per\nprocess. On some platforms, closing or dropping a window causes the event thread\nto abort.\n\n## Platforms and Crates\n\nAt this time, Gaudium is very experimental and incomplete. Development is done\nexlcusively against the [Windows SDK](https://crates.io/crates/winapi), but\nGaudium abstracts this code and additional platform support is planned.\nAnything in the `0.0.*` series is very unstable! Platform support is summarized\nin the following table:\n\n| Platform    | Operating Systems | Status      |\n|-------------|-------------------|-------------|\n| Windows SDK | Windows           | In Progress |\n| Wayland     | Linux             | Planned     |\n| WASM        | n/a               | Planned     |\n\nGaudium is comprised of multiple crates. The `gaudium-core` crate provides the\nabstraction layer and core constructs. Various `gaudium-platform-*` crates\nprovide implementations for platforms. Finally, the `gaudium` crate is an\noptional facade that automatically chooses a suitable platform implementation\nand re-exports types with bindings to that platform and common extension\ntraits.\n\nNote that _platforms_ do not always map one-to-one to _targets_ or _operating\nsystems_. Platform crates may be viable on more than one target or operating\nsystem. An implementation is chosen by depending on a viable platform crate and\nbinding its API with `gaudium-core`.\n\nPlatform-specific features are exposed by extension traits in the `platform`\nmodule of `gaudium` or directly from platform crates. For example, by using the\n`platform::WindowExt` trait from `gaudium` on Windows, coordinates on a display\ncan be transformed to a window's local coordinate system and child windows can\nbe created within a parent window. These extension traits form an implicit API\nthat is shared across platform crates, so commonly supported operations can be\nused without conditional code or compilation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folson-sean-k%2Fgaudium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folson-sean-k%2Fgaudium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folson-sean-k%2Fgaudium/lists"}