https://github.com/lpghatguy/textbox
Logic-only library to manage text box state in Lua UI libraries
https://github.com/lpghatguy/textbox
love2d lua
Last synced: about 1 month ago
JSON representation
Logic-only library to manage text box state in Lua UI libraries
- Host: GitHub
- URL: https://github.com/lpghatguy/textbox
- Owner: LPGhatguy
- License: mit
- Created: 2017-02-05T12:37:03.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-12T00:21:06.000Z (over 7 years ago)
- Last Synced: 2025-03-11T11:51:25.616Z (about 2 months ago)
- Topics: love2d, lua
- Language: Lua
- Size: 13.7 KB
- Stars: 8
- Watchers: 2
- Forks: 18
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Textbox
[](https://travis-ci.org/LPGhatguy/textbox)Textbox is a library used to manage text box state. It is meant to be used as the input manager for any LÖVE UI widget or toolkit.
Textbox is based around the lifecycle of `InputContext` objects. One `InputContext` object is intended to map to one text input field. While the input has focus, you should call the `textinput` and `keypressed` methods on the `InputContext` object when appropriate. These correspond to the arguments and semantics of the LÖVE API.
## Installation
Textbox requires **LÖVE 0.10.0** or newer.Put the `textbox` folder into your project and require it.
## Features
Textbox provides these features:- Text entry
- Selection
- Cursor movement
- Backspace and forward-delete
- Home/End keys
- Select all
- Copy/Cut/Paste## Sample Usage
See the `demo` folder for more detailed examples.```lua
local textbox = require("textbox")local context = textbox.InputContext()
function love.draw()
love.graphics.print(context.value, 0, 0)
endfunction love.keypressed(key)
context:keypressed(key)
endfunction love.textinput(text)
context:textinput(text)
end
```## TODO
- Explicit UTF-8 support
- IME support
- Multiline editing