{"modulePath":"github.com/ebitengine/debugui","version":"v0.3.1","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package debugui\n\n## Functions\n\n```go\nfunc DrawText(dst *ebiten.Image, str string, options *text.DrawOptions)\n```\nDrawText draws the text on the destination image with the given options, in the same way as debugui's widget text drawing.\n\nNote that you have to specify the scale at the options when the context scale is not 1.\n\n## Types\n\n```go\ntype ContainerLayout struct {\n\t// Bounds is the bounds of the widget.\n\tBounds image.Rectangle\n\n\t// BodyBounds is the bounds of the body area of the container.\n\tBodyBounds image.Rectangle\n\n\t// ContentSize is the size of the content.\n\t// ContentSize can be larger than Bounds or BodyBounds. In this case, the widget should be scrollable.\n\tContentSize image.Point\n\n\t// ScrollOffset is the offset of the scroll.\n\tScrollOffset image.Point\n}\n```\nContainerLayout represents the layout of a container widget.\n\n```go\ntype Context struct {\n\t// contains filtered or unexported fields\n}\n```\nContext is the main context for the debug UI.\n\n```go\nfunc (c *Context) Button(text string) EventHandler\n```\nButton creates a button widget with the given text.\n\nButton returns an EventHandler to handle click events. A returned EventHandler is never nil.\n\nA Button widget is uniquely determined by its call location. Function calls made in different locations will create different widgets. If you want to generate different widgets with the same function call in a loop (such as a for loop), use \\[IDScope].\n\n```go\nfunc (c *Context) Checkbox(state *bool, label string) EventHandler\n```\nCheckbox creates a checkbox with the given boolean state and text label.\n\nA Checkbox widget is uniquely determined by its call location. Function calls made in different locations will create different widgets. If you want to generate different widgets with the same function call in a loop (such as a for loop), use \\[IDScope].\n\n```go\nfunc (c *Context) ClosePopup(popupID PopupID)\n```\nClosePopup closes a popup window.\n\n```go\nfunc (c *Context) DrawOnlyWidget(f func(screen *ebiten.Image))\n```\nDrawOnlyWidget adds a widget that only draws the given function without user interaction.\n\n```go\nfunc (c *Context) Dropdown(selectedIndex *int, options []string) EventHandler\n```\nDropdown creates a dropdown menu widget that allows users to select from a list of options. selectedIndex is a pointer to the currently selected option index (0-based). options is a slice of strings representing the available choices. Returns an EventHandler that triggers when the selection changes.\n\n```go\nfunc (c *Context) GridCell(f func(bounds image.Rectangle))\n```\nGridCell creates a grid cell with the content defined by the function f.\n\n```go\nfunc (c *Context) Header(label string, initialExpansion bool, f func())\n```\nHeader creates a header widget with the given label.\n\ninitialExpansion specifies whether the header is initially expanded. f is called to render the content of the header. The content is only rendered when the header is expanded.\n\nA Header widget is uniquely determined by its call location. Function calls made in different locations will create different widgets. If you want to generate different widgets with the same function call in a loop (such as a for loop), use \\[IDScope].\n\n```go\nfunc (c *Context) IDScope(name string, f func())\n```\nIDScope creates a new scope for widget IDs. IDScope creates a unique scope based on the caller's position and the given name string.\n\nIDScope is useful when you want to create multiple widgets at the same position e.g. in a for loop.\n\nIDScope is a low level API. For a simple loop, use \\[Loop] instead.\n\n```go\nfunc (c *Context) Loop(count int, f func(i int))\n```\nLoop creates a loop to iterate by the given count. Loop creates a unique ID scope for each iteration.\n\n```go\nfunc (c *Context) NumberField(value *int, step int) EventHandler\n```\nNumberField creates a number field to modify the value of an int value.\n\nstep is the amount to increment or decrement the value when the user drags the mouse cursor.\n\nNumberField returns an EventHandler to handle value change events. A returned EventHandler is never nil.\n\nA NumberField widget is uniquely determined by its call location. Function calls made in different locations will create different widgets. If you want to generate different widgets with the same function call in a loop (such as a for loop), use \\[IDScope].\n\n```go\nfunc (c *Context) NumberFieldF(value *float64, step float64, digits int) EventHandler\n```\nNumberFieldF creates a number field to modify the value of a float64 value.\n\nstep is the amount to increment or decrement the value when the user drags the mouse cursor. digits is the number of decimal places to display.\n\nNumberFieldF returns an EventHandler to handle value change events. A returned EventHandler is never nil.\n\nA NumberFieldF widget is uniquely determined by its call location. Function calls made in different locations will create different widgets. If you want to generate different widgets with the same function call in a loop (such as a for loop), use \\[IDScope].\n\n```go\nfunc (c *Context) OpenPopup(popupID PopupID)\n```\nOpenPopup opens a popup window at the current pointing position.\n\n```go\nfunc (c *Context) Panel(f func(layout ContainerLayout))\n```\nPanel creates a new panel with the contents defined by the function f. Panel can have scroll bars, and the contents of the panel can be scrolled.\n\n```go\nfunc (c *Context) Popup(f func(layout ContainerLayout, popupID PopupID)) PopupID\n```\nPopup creates a popup window with the content defined by the provided function, and returns the PopupID of the popup window.\n\nBy default, the popup window is hidden. To show the popup window, call OpenPopup with the PopupID returned by this function.\n\n```go\nfunc (c *Context) Scale() int\n```\nScale returns the scale of the UI.\n\n```go\nfunc (c *Context) SetGridLayout(widths []int, heights []int)\n```\nSetGridLayout sets the grid layout. widths and heights are the sizes of each column and row.\n\nIf a size is 0, the default size is used. If a size is negative, the size represents the ratio of the remaining space. For example, if widths is \\[]int{100, -1}, the first column is 100 pixels and the second column takes the remaining space. If widths is \\[]int{100, -1, -2}, the first column is 100 pixels, the second column takes 1/3 of the remaining space, and the third column takes 2/3 of the remaining space.\n\nIf widths is nil, one column width with -1 is used for windows, and 0 (the default size) is used for popups. If heights is nil, 0 (the default size) is used.\n\nWhen the number of items exceeds the number of grid cells, a new row starts with the same grid layout.\n\n```go\nfunc (c *Context) SetScale(scale int)\n```\nSetScale sets the scale of the UI.\n\nThe scale affects the rendering result of the UI.\n\nThe default scale is 1.\n\n```go\nfunc (c *Context) SetScroll(scroll image.Point)\n```\nSetScroll sets the scroll offset of the current container.\n\n```go\nfunc (c *Context) SetTextFieldValue(value string)\n```\nSetTextFieldValue sets the value of the current text field.\n\nIf the last widget is not a text field, this function does nothing.\n\n```go\nfunc (c *Context) Slider(value *int, low, high int, step int) EventHandler\n```\nSlider creates a slider widget with the given int value, range, and step.\n\nlow and high specify the range of the slider.\n\nSlider returns an EventHandler to handle value change events. A returned EventHandler is never nil.\n\nA Slider widget is uniquely determined by its call location. Function calls made in different locations will create different widgets. If you want to generate different widgets with the same function call in a loop (such as a for loop), use \\[IDScope].\n\n```go\nfunc (c *Context) SliderF(value *float64, low, high float64, step float64, digits int) EventHandler\n```\nSliderF creates a slider widget with the given float64 value, range, step, and number of digits.\n\nlow and high specify the range of the slider. digits specifies the number of digits to display after the decimal point.\n\nSliderF returns an EventHandler to handle value change events. A returned EventHandler is never nil.\n\nA SliderF widget is uniquely determined by its call location. Function calls made in different locations will create different widgets. If you want to generate different widgets with the same function call in a loop (such as a for loop), use \\[IDScope].\n\n```go\nfunc (c *Context) Text(text string)\n```\nText creates a text label.\n\n```go\nfunc (c *Context) TextField(buf *string) EventHandler\n```\nTextField creates a text field to modify the value of a string buf.\n\nTextField returns an EventHandler to handle events when the value is confirmed, such as on blur or Enter key press. A returned EventHandler is never nil.\n\nA TextField widget is uniquely determined by its call location. Function calls made in different locations will create different widgets. If you want to generate different widgets with the same function call in a loop (such as a for loop), use \\[IDScope].\n\n```go\nfunc (c *Context) TreeNode(label string, f func())\n```\nTreeNode creates a tree node widget with the given label.\n\nA TreeNode widget is uniquely determined by its call location. Function calls made in different locations will create different widgets. If you want to generate different widgets with the same function call in a loop (such as a for loop), use \\[IDScope].\n\n```go\nfunc (c *Context) Window(title string, initialBounds image.Rectangle, f func(layout ContainerLayout))\n```\nWindow creates a new window with the contents defined by the function f.\n\ntitle is the title of the window. rect is the initial size and position of the window.\n\n```go\ntype DebugUI struct {\n\t// contains filtered or unexported fields\n}\n```\nDebugUI is a debug UI.\n\nThe zero value for DebugUI is ready to use.\n\n```go\nfunc (d *DebugUI) Draw(screen *ebiten.Image)\n```\nDraw draws the debug UI.\n\nDraw should be called once in the game's Draw function.\n\n```go\nfunc (d *DebugUI) Update(f func(ctx *Context) error) (InputCapturingState, error)\n```\nUpdate updates the debug UI.\n\nUpdate returns true if the debug UI is capturing input, e.g. when a widget has focus. Otherwise, Update returns false.\n\nUpdate should be called once in the game's Update function.\n\n```go\ntype EventHandler interface {\n\t// On registers a callback function to be called when the event occurs.\n\tOn(func())\n}\n```\nEventHandler is an interface for handling events in a widget.\n\n```go\ntype InputCapturingState int\n```\nInputCapturingState is a bit mask that indicates the input capturing state of the debug UI.\n\n```go\nconst (\n\t// InputCapturingStateHover indicates that a pointing device is hovering over a widget.\n\tInputCapturingStateHover InputCapturingState = 1 \u003c\u003c iota\n\n\t// InputCapturingStateFocus indicates that a widget like a text field is focused.\n\tInputCapturingStateFocus\n)\n```\n\n```go\ntype PopupID widgetID\n```\nPopupID is the ID of a popup window.\n\n","path":"github.com/ebitengine/debugui","name":"debugui","synopsis":"","isRedistributable":true}
