Documentation ¶
Overview ¶
Package messeji provides text widgets for Ebitengine.
Index ¶
- type Alignment
- type InputField
- func (f *InputField) HandleKeyboardEvent(key ebiten.Key, r rune) (handled bool, err error)
- 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 (f *TextField) Draw(screen *ebiten.Image)
- func (f *TextField) ForegroundColor() color.RGBA
- func (f *TextField) HandleKeyboardEvent(key ebiten.Key, r rune) (handled bool, err error)
- func (f *TextField) HandleMouseEvent(cursor image.Point, pressed bool, clicked bool) (handled bool, err error)
- 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) SetAutoResize(resize bool)
- func (f *TextField) SetBackgroundColor(c color.RGBA)
- func (f *TextField) SetFollow(follow bool)
- func (f *TextField) SetFont(faceSource *text.GoTextFaceSource, size int, mutex *sync.Mutex)
- func (f *TextField) SetForegroundColor(c color.RGBA)
- func (f *TextField) SetHandleKeyboard(handle bool)
- func (f *TextField) SetHorizontal(h Alignment)
- func (f *TextField) SetLast(text string)
- func (f *TextField) SetLineHeight(height int)
- func (f *TextField) SetMask(r rune)
- func (f *TextField) SetPadding(padding int)
- func (f *TextField) SetPrefix(text string)
- func (f *TextField) SetRect(r image.Rectangle)
- func (f *TextField) SetScrollBarColors(area color.RGBA, handle color.RGBA)
- func (f *TextField) SetScrollBarVisible(scrollVisible bool)
- func (f *TextField) SetScrollBarWidth(width int)
- func (f *TextField) SetScrollBorderColors(top color.RGBA, right color.RGBA, bottom color.RGBA, left color.RGBA)
- func (f *TextField) SetScrollBorderSize(size int)
- func (f *TextField) SetSingleLine(single bool)
- func (f *TextField) SetSuffix(text string)
- func (f *TextField) SetText(text string)
- func (f *TextField) SetVertical(v Alignment)
- 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)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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.
func NewInputField ¶
func NewInputField(fontSource *text.GoTextFaceSource, fontSize int, fontMutex *sync.Mutex) *InputField
NewInputField returns a new InputField. See type documentation for more info.
func (*InputField) HandleKeyboardEvent ¶
func (f *InputField) HandleKeyboardEvent(key ebiten.Key, r rune) (handled bool, err error)
HandleKeyboardEvent passes the provided key or rune to the Inputfield.
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 clear the text buffer.
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.
func NewTextField ¶
func NewTextField(fontSource *text.GoTextFaceSource, fontSize int, fontMutex *sync.Mutex) *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) ForegroundColor ¶
ForegroundColor returns the color of the text within the field.
func (*TextField) HandleKeyboardEvent ¶
HandleKeyboardEvent passes the provided key or rune to the TextField.
func (*TextField) HandleMouseEvent ¶
func (*TextField) LineHeight ¶
LineHeight returns the line height for the field.
func (*TextField) SetAutoHideScrollBar ¶
SetAutoHideScrollBar sets whether the scroll bar is automatically hidden when the entire text buffer is visible.
func (*TextField) SetAutoResize ¶
SetAutoResize sets whether the font is automatically scaled down when it is too large to fit the entire text buffer on one line.
func (*TextField) SetBackgroundColor ¶
SetBackgroundColor sets the color of the background of the field.
func (*TextField) SetFollow ¶
SetFollow sets whether the field should automatically scroll to the end when content is added to the buffer.
func (*TextField) SetForegroundColor ¶
SetForegroundColor sets the color of the text within the field.
func (*TextField) SetHandleKeyboard ¶
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) SetHorizontal ¶
SetHorizontal sets the horizontal alignment of the text within the field.
func (*TextField) SetLast ¶
SetLast sets the text of the last line of the field. Newline characters are replaced with spaces.
func (*TextField) SetLineHeight ¶
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) SetMask ¶
SetMask sets the rune used to mask the text buffer contents. Set to 0 to disable.
func (*TextField) SetPadding ¶
SetPadding sets the amount of padding around the text within the field.
func (*TextField) SetScrollBarColors ¶
SetScrollBarColors sets the color of the scroll bar area and handle.
func (*TextField) SetScrollBarVisible ¶
SetScrollBarVisible sets whether the scroll bar is visible on the screen.
func (*TextField) SetScrollBarWidth ¶
SetScrollBarWidth sets the width of the scroll bar.
func (*TextField) SetScrollBorderColors ¶
func (f *TextField) SetScrollBorderColors(top color.RGBA, right color.RGBA, bottom color.RGBA, left color.RGBA)
SetScrollBorderColor sets the color of the top, right, bottom and left border of the scroll bar handle.
func (*TextField) SetScrollBorderSize ¶
SetScrollBorderSize sets the size of the border around the scroll bar handle.
func (*TextField) SetSingleLine ¶
SetSingleLine sets whether the field displays all text on a single line. When enabled, the field scrolls horizontally. Otherwise, it scrolls vertically.
func (*TextField) SetVertical ¶
SetVertical sets the veritcal alignment of the text within the field.
func (*TextField) SetVisible ¶
SetVisible sets whether the field is visible on the screen.
func (*TextField) SetWordWrap ¶
SetWordWrap sets a flag which, when enabled, causes text to wrap without breaking words.
func (*TextField) Update ¶
Update updates the field. This function should be called when Game.Update is called.