Skip to content

Logic-only library to manage text box state in Lua UI libraries

License

Notifications You must be signed in to change notification settings

LPGhatguy/textbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Textbox

Travis CI Build Status

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.

local textbox = require("textbox")

local context = textbox.InputContext()

function love.draw()
	love.graphics.print(context.value, 0, 0)
end

function love.keypressed(key)
	context:keypressed(key)
end

function love.textinput(text)
	context:textinput(text)
end

TODO

  • Explicit UTF-8 support
  • IME support
  • Multiline editing

About

Logic-only library to manage text box state in Lua UI libraries

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published