{"id":19662712,"url":"https://github.com/brunexgeek/waitkey","last_synced_at":"2025-02-27T03:22:25.555Z","repository":{"id":70676631,"uuid":"152359332","full_name":"brunexgeek/waitkey","owner":"brunexgeek","description":"Single-file portable implementation of 'waitKey' function","archived":false,"fork":false,"pushed_at":"2023-08-16T15:08:55.000Z","size":19,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-10T01:53:01.787Z","etag":null,"topics":["c99","gnu-linux","interactive","keyboard","keypress","single-file","terminal","windows","xterm"],"latest_commit_sha":null,"homepage":null,"language":"C","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/brunexgeek.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":"2018-10-10T03:43:43.000Z","updated_at":"2024-12-17T10:21:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"b573cf14-21f2-4dca-b2ee-87cc2e0d6510","html_url":"https://github.com/brunexgeek/waitkey","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunexgeek%2Fwaitkey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunexgeek%2Fwaitkey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunexgeek%2Fwaitkey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunexgeek%2Fwaitkey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brunexgeek","download_url":"https://codeload.github.com/brunexgeek/waitkey/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240971289,"owners_count":19886719,"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":["c99","gnu-linux","interactive","keyboard","keypress","single-file","terminal","windows","xterm"],"created_at":"2024-11-11T16:12:10.542Z","updated_at":"2025-02-27T03:22:25.538Z","avatar_url":"https://github.com/brunexgeek.png","language":"C","readme":"# waitkey  ![MIT License](https://img.shields.io/github/license/mashape/apistatus.svg) ![Compatible with GNU/Linux and Windows](https://img.shields.io/badge/compatible-gnu/linux%20%7C%20windows-lightgray.svg)\n\n\nSingle-file implementation of *waitKey* functionality compatible with GNU/Linux and Windows. No need for external dependencies.\n\nThe idea is to provide a function that waits for the user to press any key and return its code. The key pressed is not echoed on the screen.\n\n```c\n// adds the actual implementation with this inclusion\n#define WK_IMPLEMENTATION\n#include \"waitkey.h\"\n\n...\n\nint input = WkWaitKey();\nif (input == WKK_UP) {\n    printf(\"You pressed up arrow\\n\");\n}\n```\n\nThe `WkWaitKey` function can detect every printable ASCII character and some special keys (e.g. arrows, insert, page down).\n\nOther functions:\n\n* `WkGetKeyName`: returns the name of a key (e.g. \"WKK_A\" for WKK_A).\n* `WkGetTerminal`: returns the name of the current terminal (e.g. \"xterm\").\n* `WkSetColor`: set the current foreground and/or background color.\n* `WkResetColor`: set the foreground and background colors to its default.\n* `WkGetScreenSize`: returns the amount of rows and columns in the screen.\n\n## Supported terminals\n\nCurrently this implementation can identify and work with the following terminals:\n\n* xterm\n* linux\n* windows\n\nBy default, *xterm* (GNU/Linux) or *windows* (Windows) is used if no terminal can be identified.\n\n## How to use\n\nJust copy `waitkey.h` to your project and include it wherever needed. You must set the macro `WK_IMPLEMENTATION` before one (and *only* one) of the inclusions to add the actual implementation (because everything is inside the header file).\n\n## Why not use the library *XYZ*?\n\nThe main goal here is to provide a minimal *waitkey* functionality without depending on extra libraries and provide support for both GNU/Linux and Windows. If you need something more ~~fancy~~ complete, you probably should use *ncurses* or other stuff.\n\n## License\n\nAll code in this repository is available under [MIT License](https://opensource.org/licenses/MIT).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunexgeek%2Fwaitkey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrunexgeek%2Fwaitkey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunexgeek%2Fwaitkey/lists"}