...

Package messeji

Overview ▾

Package messeji provides text widgets for Ebiten.

Index ▾

type InputField
    func NewInputField(face font.Face) *InputField
    func (f *InputField) SetChangedFunc(changedFunc func(r rune) (accept bool))
    func (f *InputField) SetHandleKeyboard(handle bool)
    func (f *InputField) SetSelectedFunc(selectedFunc func() (accept bool))
    func (f *InputField) Update() error
type TextField
    func NewTextField(face font.Face) *TextField
    func (f *TextField) Draw(screen *ebiten.Image)
    func (f *TextField) LineHeight() int
    func (f *TextField) Padding() int
    func (f *TextField) Rect() image.Rectangle
    func (f *TextField) SetAutoHideScrollBar(autoHide bool)
    func (f *TextField) SetBackgroundColor(c color.Color)
    func (f *TextField) SetFollow(follow bool)
    func (f *TextField) SetFont(face font.Face)
    func (f *TextField) SetForegroundColor(c color.Color)
    func (f *TextField) SetHandleKeyboard(handle bool)
    func (f *TextField) SetLineHeight(height int)
    func (f *TextField) SetPadding(padding int)
    func (f *TextField) SetPrefix(text string)
    func (f *TextField) SetRect(r image.Rectangle)
    func (f *TextField) SetScrollBarVisible(scrollVisible bool)
    func (f *TextField) SetScrollBarWidth(width int)
    func (f *TextField) SetSingleLine(single bool)
    func (f *TextField) SetSuffix(text string)
    func (f *TextField) SetText(text string)
    func (f *TextField) SetVisible(visible bool)
    func (f *TextField) SetWordWrap(wrap bool)
    func (f *TextField) Text() string
    func (f *TextField) Update() error
    func (f *TextField) Visible() bool
    func (f *TextField) WordWrap() bool
    func (f *TextField) Write(p []byte) (n int, err error)

Package files

doc.go inputfield.go textfield.go

type InputField

InputField is a text input field. Call Update and Draw when your Game's Update and Draw methods are called.

Note: A position and size must be set via SetRect before the field will appear. Keyboard events are not handled by default, and may be enabled via SetHandleKeyboard.

type InputField struct {
    *TextField
    // contains filtered or unexported fields
}

func NewInputField

func NewInputField(face font.Face) *InputField

NewInputField returns a new InputField. See type documentation for more info.

func (*InputField) SetChangedFunc

func (f *InputField) SetChangedFunc(changedFunc func(r rune) (accept bool))

SetChangedFunc sets a handler which is called when the text buffer is changed. The handler may return true to add the rune to the text buffer.

func (*InputField) SetHandleKeyboard

func (f *InputField) SetHandleKeyboard(handle bool)

SetHandleKeyboard sets a flag controlling whether keyboard input should be handled by the field. This can be used to facilitate focus changes between multiple inputs.

func (*InputField) SetSelectedFunc

func (f *InputField) SetSelectedFunc(selectedFunc func() (accept bool))

SetSelectedFunc sets a handler which is called when the enter key is pressed. Providing a nil function value will remove the existing handler (if set). The handler may return true to skip adding a newline to the text.

func (*InputField) Update

func (f *InputField) Update() error

Update updates the input field. This function should be called when Game.Update is called.

type TextField

TextField is a text display field. Call Update and Draw when your Game's Update and Draw methods are called.

Note: A position and size must be set via SetRect before the field will appear. Keyboard events are not handled by default, and may be enabled via SetHandleKeyboard.

type TextField struct {
    sync.Mutex
    // contains filtered or unexported fields
}

func NewTextField

func NewTextField(face font.Face) *TextField

NewTextField returns a new TextField. See type documentation for more info.

func (*TextField) Draw

func (f *TextField) Draw(screen *ebiten.Image)

Draw draws the field on the screen. This function should be called when Game.Draw is called.

func (*TextField) LineHeight

func (f *TextField) LineHeight() int

LineHeight returns the line height for the field.

func (*TextField) Padding

func (f *TextField) Padding() int

Padding returns the amount of padding around the text within the field.

func (*TextField) Rect

func (f *TextField) Rect() image.Rectangle

Rect returns the position and size of the field.

func (*TextField) SetAutoHideScrollBar

func (f *TextField) SetAutoHideScrollBar(autoHide bool)

SetAutoHideScrollBar sets whether the scroll bar is automatically hidden when the entire text buffer is visible.

func (*TextField) SetBackgroundColor

func (f *TextField) SetBackgroundColor(c color.Color)

SetBackgroundColor sets the color of the background of the field.

func (*TextField) SetFollow

func (f *TextField) SetFollow(follow bool)

SetFollow sets whether the field should automatically scroll to the end when content is added to the buffer.

func (*TextField) SetFont

func (f *TextField) SetFont(face font.Face)

SetFont sets the font face of the text within the field.

func (*TextField) SetForegroundColor

func (f *TextField) SetForegroundColor(c color.Color)

SetForegroundColor sets the color of the text within the field.

func (*TextField) SetHandleKeyboard

func (f *TextField) SetHandleKeyboard(handle bool)

SetHandleKeyboard sets a flag controlling whether keyboard input should be handled by the field. This can be used to facilitate focus changes between multiple inputs.

func (*TextField) SetLineHeight

func (f *TextField) SetLineHeight(height int)

SetLineHeight sets a custom line height for the field. Setting a line height of 0 restores the automatic line height detection based on the font.

func (*TextField) SetPadding

func (f *TextField) SetPadding(padding int)

SetPadding sets the amount of padding around the text within the field.

func (*TextField) SetPrefix

func (f *TextField) SetPrefix(text string)

SetPrefix sets the text shown before the content of the field.

func (*TextField) SetRect

func (f *TextField) SetRect(r image.Rectangle)

SetRect sets the position and size of the field.

func (*TextField) SetScrollBarVisible

func (f *TextField) SetScrollBarVisible(scrollVisible bool)

SetScrollBarVisible sets whether the scroll bar is visible on the screen.

func (*TextField) SetScrollBarWidth

func (f *TextField) SetScrollBarWidth(width int)

SetScrollBarWidth sets the width of the scroll bar.

func (*TextField) SetSingleLine

func (f *TextField) SetSingleLine(single bool)

SetSingleLine sets whether the field displays all text on a single line. When enabled, the field scrolls horizontally. Otherwise, it scrolls vertically.

func (*TextField) SetSuffix

func (f *TextField) SetSuffix(text string)

SetSuffix sets the text shown before the content of the field.

func (*TextField) SetText

func (f *TextField) SetText(text string)

SetText sets the text in the field.

func (*TextField) SetVisible

func (f *TextField) SetVisible(visible bool)

SetVisible sets whether the field is visible on the screen.

func (*TextField) SetWordWrap

func (f *TextField) SetWordWrap(wrap bool)

SetWordWrap sets a flag which, when enabled, causes text to wrap without breaking words.

func (*TextField) Text

func (f *TextField) Text() string

Text returns the text in the field.

func (*TextField) Update

func (f *TextField) Update() error

Update updates the field. This function should be called when Game.Update is called.

func (*TextField) Visible

func (f *TextField) Visible() bool

Visible returns whether the field is currently visible on the screen.

func (*TextField) WordWrap

func (f *TextField) WordWrap() bool

WordWrap returns the current text wrap mode.

func (*TextField) Write

func (f *TextField) Write(p []byte) (n int, err error)

Write writes to the field's buffer.

Subdirectories

Name Synopsis
..
examples
messeji
game
mobile