textwrapper

package module
v0.0.0-...-7ae82d4 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 8 Imported by: 1

README

Ebiten Text Wrapper

Little addon to the ebiten engine for creating wrappable text from a string slice. Currently only supports left to right horizontal wrapping.

USE AT YOUR OWN RISK

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NRGBAtoFloat32

func NRGBAtoFloat32(newColor color.NRGBA) (float32, float32, float32, float32)

Color Util

Types

type TextWrapper

type TextWrapper struct {
	X, Y, W, H                                         float64     //Width must be greater than 0,
	Color                                              color.NRGBA //Any image.Color should work
	Scroll, ScrollMax, ScrollCurrentMax, ScrollVisible int         //Based off height (H)
	// contains filtered or unexported fields
}

func NewTextWrapper

func NewTextWrapper(width float64, height float64, fontData []byte) *TextWrapper

Create

func (*TextWrapper) Draw

func (t *TextWrapper) Draw(screen *ebiten.Image)

Render

func (*TextWrapper) GetFace

func (t *TextWrapper) GetFace() *text.GoTextFace

func (*TextWrapper) ScrollDown

func (t *TextWrapper) ScrollDown(scrollAmount int)

func (*TextWrapper) ScrollUp

func (t *TextWrapper) ScrollUp(scrollAmount int)

func (*TextWrapper) SetSize

func (t *TextWrapper) SetSize(newSize float64, lineHeight float64)

func (*TextWrapper) SetText

func (t *TextWrapper) SetText(newText []string)

Actions Set text allows you to use mutltiple lines of input in the form of a string slice. New lines will be inserted where needed as the text wraps across the bounds set by the W (width) property of the TextWrapper

func (*TextWrapper) SetTextFromBytes

func (t *TextWrapper) SetTextFromBytes(byt []byte)

Jump to

Keyboard shortcuts

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