{"id":19998107,"url":"https://github.com/gob52/gob_unifiedbutton","last_synced_at":"2025-05-04T14:30:53.093Z","repository":{"id":163912777,"uuid":"639302787","full_name":"GOB52/gob_unifiedButton","owner":"GOB52","description":"Add software touch buttons for CoreS3 and Tough, and commonality with conventional buttons (M5.BtnX)","archived":false,"fork":false,"pushed_at":"2024-06-26T09:07:38.000Z","size":202,"stargazers_count":9,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-26T10:37:05.467Z","etag":null,"topics":["m5gfx","m5stack-cores3","m5tough","m5unified"],"latest_commit_sha":null,"homepage":"https://gob52.github.io/gob_unifiedButton/","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/GOB52.png","metadata":{"files":{"readme":"README.ja.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":"2023-05-11T07:36:01.000Z","updated_at":"2024-06-25T06:19:49.000Z","dependencies_parsed_at":"2023-11-25T06:19:39.649Z","dependency_job_id":"e22a4bb0-1fd9-40b1-98a8-e5016411b401","html_url":"https://github.com/GOB52/gob_unifiedButton","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GOB52%2Fgob_unifiedButton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GOB52%2Fgob_unifiedButton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GOB52%2Fgob_unifiedButton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GOB52%2Fgob_unifiedButton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GOB52","download_url":"https://codeload.github.com/GOB52/gob_unifiedButton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224393947,"owners_count":17303725,"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":["m5gfx","m5stack-cores3","m5tough","m5unified"],"created_at":"2024-11-13T05:07:23.309Z","updated_at":"2025-05-04T14:30:53.087Z","avatar_url":"https://github.com/GOB52.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gob_unifiedButton\n\n![gob_unifiedButton](https://github.com/GOB52/gob_unifiedButton/assets/26270227/590cde0d-f4b6-4fe6-8cae-e25d27b32f8b)\n\n[English](README.md)\n\n## 概要\n物理ボタン、タッチボタンを持たない CoreS3、Tough 上にソフトウェアタッチボタンを追加し、 M5.BtnX 経由で状態を取得できるようにしたライブラリです。  \n\n~~将来的に [M5Unified](https://github.com/m5stack/M5Unified) に同様の機能がつくまでの暫定としてお使いください。~~  \nM5Unified 0.2.3 より、 **M5.setTouchButtonHeightByRatio(uint8_t ratio)** が追加され、画面を M5.BtnX として使用できるようになりました。  \n今後はこちらの機能を使うと良いでしょう。\n\nCoreS3、Tough 以外では処理をしないので、Basic, Gray, Core2 等と共通のソースで作っている方にも有用です。  \n\nなお CoreS3SE では M5Unified を使用していればも画面外の部分が Core2 同様にボタンとして機能します。(CoreS3 ではその部分はタッチとして機能しません)\n\n\n## 必要なもの\n* [M5Unified](https://github.com/m5stack/M5Unified) 0.1.16 以降\n* [M5GFX](https://github.com/m5stack/M5GFX) 0.1.16 以降\n\n**M5Unifiedを前提としているため、M5Core3.hなどデバイス固有のヘッダを使用している場合は適用できません。**\n\n## 導入\n環境によって適切な方法でインストールしてください\n* git clone や Zip ダウンロードからの展開\n* platformio.ini\n```ini\nlib_deps = gob/gob_unifiedButton\n```\n* ArduinoIDE ライブラリマネージャからのインストール\n\n## 使い方\n```cpp\n#include \u003cM5Unified.h\u003e\n#include \u003cgob_unifiedButton.hpp\u003e\n\ngoblib::UnifiedButton unifiedButton;\n\nvoid setup()\n{\n    M5.begin();\n    unifiedButton.begin(\u0026M5.Display);\n}\n\nvoid loop()\n{\n    M5.update();\n    unifiedButton.update(); // M5.update() の後に呼ぶ事 (0.1.0 から後呼びに変更されました)\n\n    // M5.BtnX 経由で同様に状態取得\n    if(M5.BtnA.wasHold())\n    {\n        // ...\n    }\n    else if(M5.BtnA.wasClicked())\n    {\n        // ...\n    }\n\n    // ボタンを描画する\n    unifiedButton.draw();\n}\n```\n\n## ボタンのテキストフォント変更\nM5GFX で使用できるフォントを設定できます。\n```cpp\n    unifiedButton.setFont(\u0026fonts::Font4);\n```\n\n## 外観変更\nbegin で指定、または changeAppearance で変更できます。\n\n|引数 goblib::UnifiedButton::appearance\\_t|外観|\n|---|---|\n|bottom| 画面下側にボタンを表示 (default)|\n|top|画面上側にボタンを表示|\n|transparent\\_bottom|bottom と同様の位置に透明ボタンを配置|\n|transparent\\_top|top と同様の位置に透明ボタンを配置|\n|transparent_all|画面全体に透明ボタンを配置(縦3分割)|\n\n## ボタンのカスタマイズ\nLGFX\\_Button\\* を取得できます。  \n```cpp\nvoid setup()\n{\n    M5.begin();\n    unifiedButton.begin(\u0026M5.Display);\n\n    auto btnA = unifiedButton.getButtonA();\n    // 独自形状、色、テキストのボタンを再作成\n    btnA-\u003einitButton(unifiedButton.gfx(), 40, 120, 80, 240 ,TFT_GREEN, TFT_BLUE, TFT_WHITE, \"[A]\");\n    // ラベル変更\n\tbtnA-\u003esetLabelText(\"Own\");\n}\n```\nLGFX\\_Button については[こちら](https://github.com/m5stack/M5GFX/blob/master/src/lgfx/v1/LGFX_Button.hpp)を参照してください。\n\n\n## ドキュメント\n[Doxygen](https://www.doxygen.nl/) 用の[設定ファイル](docs/Doxyfile)と[シェルスクリプト](docs/doxy.sh)で作成できます。  \n出力先は doc/html です。\n```\nbash docs/doxy.sh\n```\n\nまたは[GitHub Pages](https://gob52.github.io/gob_unifiedButton/)を参照してください。\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgob52%2Fgob_unifiedbutton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgob52%2Fgob_unifiedbutton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgob52%2Fgob_unifiedbutton/lists"}