{"id":20157510,"url":"https://github.com/lehuyh/boltui","last_synced_at":"2026-06-05T18:31:07.913Z","repository":{"id":211673375,"uuid":"729659888","full_name":"LehuyH/BoltUI","owner":"LehuyH","description":"⚡C++ GUIs In a Flash!","archived":false,"fork":false,"pushed_at":"2024-04-15T21:55:22.000Z","size":538,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T12:50:35.118Z","etag":null,"topics":["beginner-friendly","cpp","cs1","gui","library"],"latest_commit_sha":null,"homepage":"https://lehuyh.github.io/BoltUI/","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/LehuyH.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":"2023-12-09T23:34:18.000Z","updated_at":"2023-12-10T06:48:50.000Z","dependencies_parsed_at":"2023-12-10T06:19:34.287Z","dependency_job_id":"9fb4c62d-ca83-40cd-93b4-9dd5d592dc51","html_url":"https://github.com/LehuyH/BoltUI","commit_stats":null,"previous_names":["lehuyh/boltui"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LehuyH%2FBoltUI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LehuyH%2FBoltUI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LehuyH%2FBoltUI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LehuyH%2FBoltUI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LehuyH","download_url":"https://codeload.github.com/LehuyH/BoltUI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241596276,"owners_count":19988044,"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":["beginner-friendly","cpp","cs1","gui","library"],"created_at":"2024-11-13T23:46:32.420Z","updated_at":"2025-03-03T02:14:26.248Z","avatar_url":"https://github.com/LehuyH.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"#  BoltUI ⚡\n[![Run on Replit](https://replit.com/badge)](https://replit.com/@LehuyH/BoltUI-Starter)\n\nBoltUI simplifies the creation of graphical user interfaces (GUIs) in C++ by redirecting program output to a web-based interface. This package aims to provide a seamless experience for new C++ developers by replacing `iostream` functionalities like `cout` and `cin` with web-based UI components.\n\n## Why Use BoltUI?\n\n \n-  **Simplified UI Creation:** Easily redirect C++ output to a web interface.\n\n- **Cross-Platform:** With WebAssembly, your BoltUI program can run across all modern browsers.\n\n-  **Developer-Friendly:** Reduce friction for new C++ developers entering the realm of GUI development.\n\n-  **Rich Outputs:** Incorporate images, markdown formatting, and user interactions within the C++ program output.\n\n  \n\n## 🛠️ Installation\n\n  \n\n### Prerequisites\n\n1.  **Emscripten:** Install [Emscripten](https://emscripten.org/docs/getting_started/downloads.html) to compile C++ to WebAssembly.\n\n  \n\n### Steps\n\n  \n\n1.  **Clone the Repository:**  `git clone https://github.com/LehuyH/boltui.git`\n\n2.  **Include `boltui.hpp`:** Add `#include \"boltui.hpp\"` in your C++ project.\n\n  \n## 🚀 Quick Start Example\n\n```cpp\n#include \"boltui.hpp\"\n\nusing namespace std;\n\nint main(){\n  UI ui;\n\n  ui \u003c\u003c ui.markdown(\"# Hello, welcome to the Cat Shop!\");\n\n  ui \u003c\u003c ui.markdown(\"## Who do you want to adopt ?\");\n\n  ui.font(\"monospace\");\n  ui \u003c\u003c ui.setw(20) \u003c\u003c \"Whiskers\" \u003c\u003c ui.setw(20) \u003c\u003c\n  ui.image(\"http://placekitten.com/300/200\") \n  \u003c\u003c endl;\n\n  ui \u003c\u003c endl \u003c\u003c endl \u003c\u003c endl;\n\n  ui \u003c\u003c ui.setw(20) \u003c\u003c \"Meowtastic\" \u003c\u003c ui.setw(20) \u003c\u003c\n  ui.image(\"http://placekitten.com/200/200\") \n  \u003c\u003c endl;\n\n  ui \u003c\u003c endl \u003c\u003c endl \u003c\u003c endl;\n  ui.font(\"sans\");\n\n  return 0;\n\n}\n```\n\nOutputs the following:\n![Quick Start Example](/.github/quickstart.png)\n\n## 🧰 Usage\n\nBoltUI provides a set of functionalities to streamline C++ console output and interaction. \nFirst create a new instance of the `UI` class like so:\n```cpp\nUI ui;\n```\n\nNow, you can use all of BoltUI's feature. Here are some common functions and their usage:\n\n### Output Functions\n\n- `UI\u0026 operator\u003c\u003c(const std::string\u0026 input)`: Outputs a string to the UI.\n  ```cpp\n  ui \u003c\u003c \"Hello, World!\";\n  ```\n\n- `UI\u0026 operator\u003c\u003c(int input)`: Outputs an integer to the UI.\n  ```cpp\n  int num = 42;\n  ui \u003c\u003c num;\n  ```\n\n- `UI\u0026 operator\u003c\u003c(float input)`: Outputs a float number to the UI.\n  ```cpp\n  float value = 3.14f;\n  ui \u003c\u003c value;\n  ```\n\n- `UI\u0026 operator\u003c\u003c(bool input)`: Outputs a boolean value to the UI.\n  ```cpp\n  bool status = true;\n  ui \u003c\u003c status;\n  ```\n\n### Input Functions\n\n- `UI\u0026 operator\u003e\u003e(std::string\u0026 input)`: Reads a line of text from the UI.\n  ```cpp\n  string userInput;\n  ui \u003e\u003e userInput;\n  ```\n\n- `UI\u0026 operator\u003e\u003e(int\u0026 num)`: Reads an integer value from the UI.\n  ```cpp\n  int number;\n  ui \u003e\u003e number;\n  ```\n\n- `UI\u0026 operator\u003e\u003e(float\u0026 num)`: Reads a float value from the UI.\n  ```cpp\n  float value;\n  ui \u003e\u003e value;\n  ```\n\n- `UI\u0026 operator\u003e\u003e(bool\u0026 num)`: Reads a boolean value from the UI.\n  ```cpp\n  bool status;\n  ui \u003e\u003e status;\n  ```\n\n### Formatting Functions\n\n- `UI\u0026 setw(int width)`: Sets the field width for the next output.\n  ```cpp\n  ui.setw(10) \u003c\u003c \"Field Width\";\n  ```\n\n- `UI\u0026 setfill(const std::string\u0026 input)`: Sets the fill character for the next output.\n  ```cpp\n  ui.setfill('*') \u003c\u003c \"Filled Text\";\n  ```\n\n- `UI\u0026 getline(std::string\u0026 input)`: Reads a line of text from the UI and stores it in the given string.\n  ```cpp\n  string userInput;\n  ui.getline(userInput);\n  ```\n  \n### Special Functions\n\n- `UI\u0026 markdown(std::string input)`: Renders a Markdown-formatted string in the UI.\n  ```cpp\n  ui.markdown(\"# Title\\n## Subtitle\\n- Bullet point 1\\n- Bullet point 2\");\n  ```\n\n- `UI\u0026 image(std::string input)`: Displays an image in the UI using its URL.\n  ```cpp\n  ui.image(\"https://example.com/image.png\");\n  ```\n\n## 🔨 Build\n\nTo compile and build your C++ code with BoltUI, follow these steps:\n\n1. Run the following command in your terminal:\n\n```sh\nem++ boltui.cpp (ADD OTHER SOURCE FILES HERE) -s WASM=1 -o ./dist/main.js -s EXPORTED_RUNTIME_METHODS=getValue -s NO_EXIT_RUNTIME=1 -s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE='$stringToNewUTF8' -s ASYNCIFY\n```\n\nReplace `(ADD OTHER SOURCE FILES HERE)` with any additional source files your project requires.\n\n2. This command will generate the necessary output in the `./dist` directory.\n\n3. You can then upload the contents of the `./dist` folder to any static hosting service to run your application.\n\n## 📜 License\n\nBoltUI is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flehuyh%2Fboltui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flehuyh%2Fboltui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flehuyh%2Fboltui/lists"}