{"id":28393572,"url":"https://github.com/pistondevelopers/dev_menu","last_synced_at":"2025-06-26T11:32:21.385Z","repository":{"id":30325794,"uuid":"33878093","full_name":"PistonDevelopers/dev_menu","owner":"PistonDevelopers","description":"In-game developer menu for Piston and gfx-rs","archived":false,"fork":false,"pushed_at":"2023-11-14T20:34:59.000Z","size":41,"stargazers_count":17,"open_issues_count":3,"forks_count":7,"subscribers_count":42,"default_branch":"master","last_synced_at":"2025-06-24T21:51:37.107Z","etag":null,"topics":[],"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/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}},"created_at":"2015-04-13T15:54:34.000Z","updated_at":"2023-07-25T13:55:48.000Z","dependencies_parsed_at":"2023-01-14T16:45:52.747Z","dependency_job_id":null,"html_url":"https://github.com/PistonDevelopers/dev_menu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PistonDevelopers/dev_menu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PistonDevelopers%2Fdev_menu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PistonDevelopers%2Fdev_menu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PistonDevelopers%2Fdev_menu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PistonDevelopers%2Fdev_menu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PistonDevelopers","download_url":"https://codeload.github.com/PistonDevelopers/dev_menu/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PistonDevelopers%2Fdev_menu/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262056189,"owners_count":23251618,"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":"2025-05-31T16:38:46.883Z","updated_at":"2025-06-26T11:32:21.372Z","avatar_url":"https://github.com/PistonDevelopers.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dev_menu [![Build Status](https://travis-ci.org/PistonDevelopers/dev_menu.png?branch=master)](https://travis-ci.org/PistonDevelopers/dev_menu)\nIn-game developer menu for Piston and [gfx-rs](https://github.com/gfx-rs/gfx-rs)\n\n[Documentation](http://www.piston.rs/docs/dev_menu/dev_menu/)\n\n## Usage\n\nA `Menu` instance can be intitialized to operate on some particular type, for example a \"Settings\" struct:\n\n```Rust\npub struct Settings {\n\tsetting_a: bool,\n\tsetting_b: f32,\n\t// ... etc\n}\n\n...\n\nlet mut menu = dev_menu::Menu\u003cSettings\u003e::new();\n\n```\n\nMenu items display in a vertical list, and the selection can be changed with the up and down arrow keys.\n\nItems can be added to the menu with `add_item`. An `ActionItem`, when selected, executes a given closure when the spacebar or left or right arrow keys are hit. For example, it can be used to toggle a boolean setting as follows:\n\n```Rust\nmenu.add_item(dev_menu::MenuItem::action_item(\n\t\"Toggle Setting A\", // Label for the item\n\tBox::new(|ref mut settings| { settings.setting_a = !settings.setting_a; }) // Closure to execute\n));\n```\n\nA `SliderItem`, when selected, can be used to increment or decrement a particular value while the right or left arrow keys are held down, using a pair of accessor closures to get or set the value within the settings object. It will also display the current value to the right of the label. For example:\n\n```Rust\nmenu.add_item(dev_menu::MenuItem::slider_item(\n\t\"Setting B = \", // Label for the item. Value will show to the right\n\t[-5.0, 5.0], // Valid range for the value\n\t0.01, // Value to increment / decrement by on each update, while key is held down\n\tBox::new(|ref settings| { settings.setting_b }), // Closure for retrieving value\n\tBox::new(|ref mut settings, value| { settings.setting_b = value }), // Closure for setting value\n));\n```\n\n\nTo update and render the menu, using the Piston event loop:\n\n```Rust\nfor e in window.events() {\n\n\t// Send event to menu, with the settings object that should be accessed and/or modified\n\tmenu.event(\u0026e, \u0026mut settings);\n\n\t...\n\n\te.render(|args| {\n\n\t\t...\n\n\t\t// Draw the menu with gfx_debug_draw::DebugRenderer\n\t\tmenu.draw(\u0026settings, \u0026mut debug_renderer);\n\n\t\t...\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpistondevelopers%2Fdev_menu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpistondevelopers%2Fdev_menu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpistondevelopers%2Fdev_menu/lists"}