button

package
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: MIT

Index

Constants

This section is empty.

Variables

View Source
var DefaultFont font.Face

DefaultFont is a package-level font face used for drawing text. Ensure that you set this variable (e.g., in your initialization code) to a valid font.Face.

Functions

This section is empty.

Types

type Button

type Button struct {
	Bounds            Rect
	Label             string
	BackgroundColor   color.RGBA
	HoverColor        color.RGBA
	PressedColor      color.RGBA
	BorderColor       color.RGBA
	TextColor         color.RGBA
	FontSize          int32
	FontFace          font.Face
	IsHovered         bool
	IsPressed         bool
	AnimationProgress float32
	Padding           float32
	CornerRadius      float32
	Enabled           bool
	Invisible         bool
	Uneditable        bool
	UseRoundedCorners bool
	UsePointyStyle    bool    // New field for pointy buttons
	PointyAmount      float32 // How pointy the buttons are (arrow length)
	// contains filtered or unexported fields
}

func NewButton

func NewButton(x, y, width, height float32, label string) *Button

func (*Button) Draw

func (b *Button) Draw(screen *ebiten.Image)

Draw draws the button onto the given screen.

func (*Button) IsClicked

func (b *Button) IsClicked() bool

IsClicked returns true if the button was clicked this frame.

func (*Button) IsInvisible

func (b *Button) IsInvisible() bool

func (*Button) IsRoundedCorners

func (b *Button) IsRoundedCorners() bool

func (*Button) IsUneditable

func (b *Button) IsUneditable() bool

func (*Button) SetColorScheme

func (btn *Button) SetColorScheme(scheme colorscheme.ColorScheme)

func (*Button) SetColors

func (b *Button) SetColors(background, hover, pressed, border, text color.RGBA)

func (*Button) SetCornerRadius

func (b *Button) SetCornerRadius(radius float32)

func (*Button) SetEnabled

func (b *Button) SetEnabled(enabled bool)

func (*Button) SetFontSize

func (b *Button) SetFontSize(size int32)

func (*Button) SetInvisible

func (b *Button) SetInvisible(invisible bool)

func (*Button) SetPadding

func (b *Button) SetPadding(padding float32)

func (*Button) SetPointyAmount

func (b *Button) SetPointyAmount(amount float32)

func (*Button) SetPointyStyle

func (b *Button) SetPointyStyle(pointy bool)

func (*Button) SetRoundedCorners

func (b *Button) SetRoundedCorners(rounded bool)

func (*Button) SetUneditable

func (b *Button) SetUneditable(uneditable bool)

func (*Button) Update

func (b *Button) Update()

Update should be called every frame.

type Rect

type Rect struct {
	X, Y, W, H float32
}

Rect defines a rectangle with float32 coordinates.

func NewRect

func NewRect(x, y, w, h float32) Rect

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL