{"id":23182166,"url":"https://github.com/cbodonnell/ebui","last_synced_at":"2025-08-02T11:32:58.783Z","repository":{"id":267736413,"uuid":"902190621","full_name":"cbodonnell/ebui","owner":"cbodonnell","description":"UI Framework for Ebitengine","archived":false,"fork":false,"pushed_at":"2025-04-02T13:12:35.000Z","size":125,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T14:25:02.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","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/cbodonnell.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-12-12T04:52:15.000Z","updated_at":"2025-03-23T13:55:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"33954ea5-e8d1-4f33-b299-3d9dc67a4b75","html_url":"https://github.com/cbodonnell/ebui","commit_stats":null,"previous_names":["cbodonnell/ebui"],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/cbodonnell/ebui","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbodonnell%2Febui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbodonnell%2Febui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbodonnell%2Febui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbodonnell%2Febui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cbodonnell","download_url":"https://codeload.github.com/cbodonnell/ebui/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbodonnell%2Febui/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268378965,"owners_count":24240907,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-18T08:19:31.277Z","updated_at":"2025-08-02T11:32:58.741Z","avatar_url":"https://github.com/cbodonnell.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EBUI - Ebitengine UI Framework\n\nEBUI is a UI framework for [Ebitengine](https://ebitengine.org/), providing a set of components and layouts for building game interfaces and tools.\n\n## Features\n\n- **Component-Based Architecture**: Build UIs using reusable, composable components\n- **Flexible Layout System**: Arrange components using various layout strategies\n- **Event System**: Handle user interactions with a flexible event system\n- **Component Library**:\n  - Labels with text alignment options\n  - Buttons with customizable colors and states\n  - Text inputs with selection and clipboard support\n  - Scrollable content containers\n  - Windows with drag-and-drop functionality\n\n## Installation\n\n```bash\ngo get github.com/cbodonnell/ebui\n```\n\n## Quick Start\n\n```go\npackage main\n\nimport (\n\t\"image/color\"\n\t\"log\"\n\n\t\"github.com/cbodonnell/ebui\"\n\t\"github.com/hajimehoshi/ebiten/v2\"\n)\n\ntype Game struct {\n\tui *ebui.Manager\n}\n\nfunc NewGame() *Game {\n\t// Create a root container\n\troot := ebui.NewLayoutContainer(\n\t\tebui.WithSize(800, 600),\n\t\tebui.WithLayout(ebui.NewVerticalStackLayout(0, ebui.AlignCenter)),\n\t)\n\n\t// Create a label\n\tlabel := ebui.NewLabel(\n\t\t\"Welcome to EBUI!\",\n\t\tebui.WithSize(800, 40),\n\t\tebui.WithColor(color.White),\n\t)\n\n\t// Create a button\n\tbutton := ebui.NewButton(\n\t\tebui.WithSize(120, 40),\n\t\tebui.WithLabelText(\"Click Me\"),\n\t\tebui.WithClickHandler(func() {\n\t\t\tlog.Println(\"Button clicked!\")\n\t\t}),\n\t)\n\n\t// Create a container to center the button\n\tbuttonContainer := ebui.NewLayoutContainer(\n\t\tebui.WithSize(800, 40),\n\t\tebui.WithLayout(ebui.NewHorizontalStackLayout(0, ebui.AlignCenter)),\n\t)\n\n\t// Add button to button container\n\tbuttonContainer.AddChild(button)\n\n\t// Add label and button container to root\n\troot.AddChild(label)\n\troot.AddChild(buttonContainer)\n\n\treturn \u0026Game{\n\t\t// Create a UI manager using the root component\n\t\tui: ebui.NewManager(root),\n\t}\n}\n\nfunc (g *Game) Update() error {\n\treturn g.ui.Update()\n}\n\nfunc (g *Game) Draw(screen *ebiten.Image) {\n\tg.ui.Draw(screen)\n}\n\nfunc (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int) {\n\treturn 800, 600\n}\n\nfunc main() {\n\tebiten.SetWindowSize(800, 600)\n\tebiten.SetWindowTitle(\"EBUI Example\")\n\tif err := ebiten.RunGame(NewGame()); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n```\n\nMore comprehensive examples can be found in the [examples](examples) directory.\n\n## Core Concepts\n\n### Components\n\nComponents are the building blocks of EBUI. Every UI element implements the `Component` interface:\n\n```go\ntype Component interface {\n    Identifiable\n    EbitenLifecycle\n    SetPosition(pos Position)\n    GetPosition() Position\n    SetSize(size Size)\n    GetSize() Size\n    SetParent(parent Container)\n    GetParent() Container\n    SetPadding(padding Padding)\n    GetPadding() Padding\n    Contains(x, y float64) bool\n    GetAbsolutePosition() Position\n}\n```\n\n### Containers\n\nContainers are components that can hold other components. EBUI provides several types of containers:\n\n- **BaseContainer**: Basic container with no layout management\n- **LayoutContainer**: Container that arranges children using a layout strategy\n- **ScrollableContainer**: Container with scrolling capability\n- **ZIndexedContainer**: Container that manages component layering\n- **WindowManager**: Special container for managing multiple windows\n\n### Layouts\n\nEBUI provides flexible layout options:\n\n- **Vertical Stack Layout**: Arrange components vertically\n- **Horizontal Stack Layout**: Arrange components horizontally\n- Custom layouts can be implemented by implementing the `Layout` interface\n\n### Event System\n\nThe event system supports:\n- Mouse events (click, hover, drag)\n- Keyboard input\n- Focus management\n- Event bubbling and capturing\n\n## Components\n\n### Label\n\n```go\nlabel := ebui.NewLabel(\n    \"Hello World\",\n    ebui.WithSize(200, 40),\n    ebui.WithJustify(ebui.JustifyCenter),\n    ebui.WithColor(color.Black),\n    ebui.WithFont(basicfont.Face7x13), // Default font\n)\n```\n\n### Button\n\n```go\nbutton := ebui.NewButton(\n    ebui.WithSize(120, 40),\n    ebui.WithLabelText(\"Click Me\"),\n    ebui.WithButtonColors(ebui.ButtonColors{\n        Default: color.RGBA{200, 200, 200, 255},\n        Hovered: color.RGBA{220, 220, 220, 255},\n        Pressed: color.RGBA{170, 170, 170, 255},\n    }),\n)\n```\n\n### Text Input\n\n```go\ninput := ebui.NewTextInput(\n    ebui.WithSize(200, 40),\n    ebui.WithInitialText(\"Hello\"),\n    ebui.WithOnChange(func(text string) {\n        println(\"Text changed:\", text)\n    }),\n)\n```\n\n### Scrollable Container\n\n```go\nscrollable := ebui.NewScrollableContainer(\n    ebui.WithSize(300, 400),\n    ebui.WithLayout(ebui.NewVerticalStackLayout(10, ebui.AlignStart)),\n)\n```\n\n### Window\n\n```go\nwindowManager := ebui.NewWindowManager(\n\tebui.WithSize(800, 600),\n)\nwindow := windowManager.CreateWindow(400, 300,\n    ebui.WithWindowTitle(\"My Window\"),\n    ebui.WithWindowColors(ebui.WindowColors{\n        Background: color.RGBA{240, 240, 240, 255},\n        Header:     color.RGBA{200, 200, 200, 255},\n        Border:     color.RGBA{0, 0, 0, 255},\n    }),\n)\n```\n\n## Debugging\n\nEBUI includes a debug mode that visualizes component bounds and layout information. Set the global `Debug` variable to `true` to enable debug mode:\n\n```go\nebui.Debug = true\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to open issues or submit pull requests.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbodonnell%2Febui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcbodonnell%2Febui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbodonnell%2Febui/lists"}