{"id":22914498,"url":"https://github.com/cdacamar/basic-ui-template","last_synced_at":"2025-04-01T11:53:03.838Z","repository":{"id":254800789,"uuid":"844371138","full_name":"cdacamar/basic-ui-template","owner":"cdacamar","description":"Template for creating simple UIs","archived":false,"fork":false,"pushed_at":"2024-08-26T15:47:17.000Z","size":1533,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T06:44:30.521Z","etag":null,"topics":[],"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/cdacamar.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":"2024-08-19T05:50:35.000Z","updated_at":"2024-08-26T15:47:21.000Z","dependencies_parsed_at":"2024-08-26T07:46:10.610Z","dependency_job_id":null,"html_url":"https://github.com/cdacamar/basic-ui-template","commit_stats":null,"previous_names":["cdacamar/basic-ui-template"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdacamar%2Fbasic-ui-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdacamar%2Fbasic-ui-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdacamar%2Fbasic-ui-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdacamar%2Fbasic-ui-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdacamar","download_url":"https://codeload.github.com/cdacamar/basic-ui-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246635950,"owners_count":20809331,"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":"2024-12-14T05:15:28.777Z","updated_at":"2025-04-01T11:53:03.817Z","avatar_url":"https://github.com/cdacamar.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Basic UI Template\r\n\r\n**_Basic UI Template_** is a small rendering framework for building simple 2D UIs.\r\n\r\n### Major Features\r\n- Basic window creation / theming.\r\n- Simple primitives renderer (squares, circles, etc.).\r\n- Simple batch renderer.\r\n- Performant font rendering via [Freetype](https://freetype.org/) with UTF-8 support.\r\n- TOML config-driven behavior / UI coloring.\r\n- Simple widgets for displaying data: Window, scrollbox, textbox.\r\n\r\n---\r\n\r\n\u003cimg alt=\"Demo of the app running\" src=\"res/screenshot.png\"\u003e\r\n\r\n## Quick Start\r\n\r\nThis is streamlined primarily for Visual Studio 2022.\r\n\r\nOpen an x64 developer command prompt.\r\n```batch\r\n$ git clone https://github.com/cdacamar/basic-ui-template \u0026\u0026 cd basic-ui-template\r\n$ git submodule init \u0026\u0026 git submodule update\r\n$ mkdir build \u0026\u0026 cd build\r\n$ cmake .. -DCMAKE_TOOLCHAIN_FILE=\"%VCPKG_ROOT%\\scripts\\buildsystems\\vcpkg.cmake\"\r\n$ msbuild basic-ui-template.vcxproj\r\n$ Debug\\basic-ui-template\r\n```\r\n\r\n## High Level Documentation\r\n\r\nThis basic UI framework contains only primitives from which higher level systems must be built.  One good example is that there's no widget hierarchy provided, it is up to the app to build a sensible hierarchy which can process OS events properly.  In the template, the `main` function is responsible for processing all UI events, but should be replaced if building a real application.\r\n\r\nA very simple way to create a scrollable text window:\r\n\r\n```c++\r\nUI::Widgets::BasicWindow window; // Window container.\r\nUI::Widgets::ScrollBox scroll;   // Inner scroll box.\r\nUI::Widgets::BasicTextbox text;  // Content.\r\n\r\n// Set some text.\r\ntext.text(\"Hello, world!\");\r\n\r\n// Setup the scroll view.\r\nscroll.content_size(text.content_size(atlas)); // Note: atlas is provided at a higher level.\r\n\r\n// Setup window.\r\nwindow.title(\"Example Window\");\r\n\r\n// We can then render them in sequence.\r\nwindow.render(..., window_viewport);\r\nauto scroll_viewport = window.content_viewport(window_viewport);\r\nscroll.render(..., scroll_viewport);\r\nauto text_viewport = scroll.content_viewport(scroll_viewport);\r\ntext.offset(scroll.position());\r\ntext.render(..., text_viewport);\r\n```\r\n\r\nHandling OS events can be done via basic APIs (as available) on the widgets themselves:\r\n\r\n```c++\r\nauto result = window.mouse_down(ui_state, mouse_pos, window_viewport);\r\nif (result.area == UI::Widgets::WindowMouseArea::Content)\r\n{\r\n    auto scroll_viewport = window.content_viewport(window_viewport);\r\n    scroll.mouse_down(ui_state, current_mouse, scroll_viewport);\r\n}\r\n```\r\n\r\nAgain, a higher level system should replace hard-coded paths with a hierarchy in order to layer widgets.\r\n\r\n## License\r\n\r\nThe project is available under the [MIT](https://opensource.org/licenses/MIT) license.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdacamar%2Fbasic-ui-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdacamar%2Fbasic-ui-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdacamar%2Fbasic-ui-template/lists"}