{"id":18648753,"url":"https://github.com/andreondra/iminputbinder","last_synced_at":"2025-06-14T08:08:47.427Z","repository":{"id":162489601,"uuid":"625264909","full_name":"andreondra/ImInputBinder","owner":"andreondra","description":"Input key/button binding widget for Dear ImGui.","archived":false,"fork":false,"pushed_at":"2023-05-06T09:51:21.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-17T20:08:20.534Z","etag":null,"topics":["addon","dearimgui","imgui","keybinding","settings"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreondra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-04-08T15:18:59.000Z","updated_at":"2024-03-14T18:55:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"589a0e96-557f-4373-b494-6fba6c86bb7a","html_url":"https://github.com/andreondra/ImInputBinder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andreondra/ImInputBinder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreondra%2FImInputBinder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreondra%2FImInputBinder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreondra%2FImInputBinder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreondra%2FImInputBinder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreondra","download_url":"https://codeload.github.com/andreondra/ImInputBinder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreondra%2FImInputBinder/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259783060,"owners_count":22910299,"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":["addon","dearimgui","imgui","keybinding","settings"],"created_at":"2024-11-07T06:33:41.720Z","updated_at":"2025-06-14T08:08:47.412Z","avatar_url":"https://github.com/andreondra.png","language":"C++","readme":"# ImInputBinder\nInput binding widget for Dear ImGui library. The widget was developed for the [Universal System Emulator](https://github.com/andreondra/use). Check out the project for an example of usage.\n\n## How to build and run the example\n### Linux\nIn the project directory execute:\n```shell\nmkdir build\ncd build\ncmake -DBUILD_EXAMPLE=ON ..\nmake\n./ImInputBinderExample\n```\n\n## How to use\n### Prerequisites\n- C++11 (C++17 to run the example),\n- `imgui.h` available the in include path.\n\n### 1) Get the sources\nYou can add the widget to your project directly by downloading ZIP of the repo and adding ImInputBinder.h to your include path\nand ImInputBinder.cpp to your build.\n\nOr, if you use CMake, you can download the sources using this CMake snippet:\n```cmake\ninclude(FetchContent)\nFetchContent_Declare(\n        ImInputBinder\n        GIT_REPOSITORY https://github.com/andreondra/ImInputBinder\n        GIT_PROGRESS TRUE\n)\nFetchContent_MakeAvailable(ImInputBinder)\ninclude_directories(${ImInputBinder_SOURCE_DIR})\nfile(GLOB ImInputBinder_sources ${ImInputBinder_SOURCE_DIR}/ImInputBinder.cpp)\n\n# Do not forget to add ${ImInputBinder_sources} to your build. For example like this:\nadd_executable(your_app mySource1.cpp mySource2.cpp mySourceX.cpp ${ImInputBinder_sources})\n```\n### 2) Add to code\n#### Setup\nYou have to create an instance of ImInputBinder:\n```c++\nImInputBinder imInputBinder;\n```\n\nThen you add actions. The action is a representation of a reaction to the specified user input. It consists of:\n- `name_id`: a unique name,\n- `key`: a key (or a button) which will trigger callbacks,\n- `pressCallback` and `releaseCallback`: callbacks for press and release of the specified key/button,\n\n```c++\nimInputBinder.addAction({\n    .name_id =\"Example Up Arrow\",\n    .key = ImGuiKey_UpArrow,\n    .pressCallback = [](){ std::cout \u003c\u003c \"Example Up Arrow press callback.\" \u003c\u003c std::endl; },\n    .releaseCallback = [](){ std::cout \u003c\u003c \"Example Up Arrow release callback.\" \u003c\u003c std::endl; },\n});\n```\n\nYou can also add multiple actions at a same time using addActions:\n```c++\nimInputBinder.addActions({\n    {\n        .name_id = \"Test A key press\",\n        .key = ImGuiKey_A,\n        .pressCallback = [](){ std::cout \u003c\u003c \"A key pressed!\" \u003c\u003c std::endl; }\n    },\n    {\n            .name_id = \"Test B key release\",\n            .key = ImGuiKey_B,\n            .releaseCallback = [](){ std::cout \u003c\u003c \"B key released!\" \u003c\u003c std::endl; }\n    },\n});\n```\n\nThen you can load existing bindings from a file. You can specify a file name, stream in a binary mode, or nothing and\na default file will be used.\n```c++\nimInputBinder.loadBindings(\"myfile.iib\");\n```\n\n#### Running\nAfter the setup is complete, you have the call `imInputBinder.update()` periodically to check for keys pressed.\n\nTo show a configuration dialog, call `imInputBinder.renderEditorWindow()` to render the dialog in its own window, or\n`imInputBinder.renderEditor()` to render only contents (you have to provide the ImGui window).\n\n#### Saving the state\nTo save the state, you can call `imInputBinder.saveBindings()` with same parameters as `loadBindings()`.\n\n## License\nThis project is licensed under the MIT license.\n\n© 2023, Ondrej Golasowski\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreondra%2Fiminputbinder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreondra%2Fiminputbinder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreondra%2Fiminputbinder/lists"}