block

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Filled style
	Filled = 1
	// Border to draw only border
	Border = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	// contains filtered or unexported fields
}

Block object implementation

func New

func New(styleBlock uint8) (*Block, error)

New create block object

func (Block) Click

func (B Block) Click()

Click define a click on object

func (Block) Clone

func (B Block) Clone(r *sdl.Renderer) (*Block, error)

Clone object and return a new

func (*Block) Close

func (B *Block) Close() error

Close sdl ressources needest to object

func (Block) Draw

func (B Block) Draw(wg *sync.WaitGroup, r *sdl.Renderer)

Draw the object

func (Block) GetColor

func (B Block) GetColor() (r, g, b, a uint8)

GetColor object (current color by status)

func (Block) GetPosition

func (B Block) GetPosition() (int32, int32)

GetPosition object (x, y)

func (Block) GetSize

func (B Block) GetSize() (int32, int32)

GetSize object (width, height)

func (Block) GetStatus

func (B Block) GetStatus() uint8

GetStatus object

func (*Block) Init

func (B *Block) Init(r *sdl.Renderer) error

Init object to draw it. If error occurred, object can't be drawn

func (Block) IsInit

func (B Block) IsInit() bool

IsInit return status initialize

func (Block) IsOver

func (B Block) IsOver(xRef, yRef int32) bool

IsOver define if object and position parameters matches

func (*Block) MoveTo

func (B *Block) MoveTo(x, y int32)

MoveTo by increment position with x and y parameters

func (*Block) SetAction

func (B *Block) SetAction(f func(...interface{}), d ...interface{})

SetAction to get it on click button

func (*Block) SetStatus

func (B *Block) SetStatus(s uint8)

SetStatus change object's status

func (*Block) SetVariantStyle

func (B *Block) SetVariantStyle(red, green, blue, opacity uint8, status ...uint8) error

SetVariantStyle define styles to interact with object.

func (*Block) UpdateColor

func (B *Block) UpdateColor(red, green, blue, opacity uint8, r *sdl.Renderer)

UpdateColor to change color of initialized object

func (*Block) UpdatePosition

func (B *Block) UpdatePosition(x, y int32)

UpdatePosition object

func (*Block) UpdateSize

func (B *Block) UpdateSize(w, h int32)

UpdateSize object

Jump to

Keyboard shortcuts

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