{"id":20533082,"url":"https://github.com/refreezed/inputfield","last_synced_at":"2025-04-14T06:32:40.553Z","repository":{"id":56825174,"uuid":"447364017","full_name":"ReFreezed/InputField","owner":"ReFreezed","description":"Text input handling library for LÖVE.","archived":false,"fork":false,"pushed_at":"2022-08-18T13:57:29.000Z","size":3228,"stargazers_count":23,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-27T20:14:13.409Z","etag":null,"topics":["library","love2d","lua","single-file-library","text-input","user-input"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ReFreezed.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.txt","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-12T20:38:46.000Z","updated_at":"2025-03-22T11:06:29.000Z","dependencies_parsed_at":"2022-08-26T20:10:39.767Z","dependency_job_id":null,"html_url":"https://github.com/ReFreezed/InputField","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReFreezed%2FInputField","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReFreezed%2FInputField/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReFreezed%2FInputField/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReFreezed%2FInputField/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ReFreezed","download_url":"https://codeload.github.com/ReFreezed/InputField/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248834190,"owners_count":21168983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","love2d","lua","single-file-library","text-input","user-input"],"created_at":"2024-11-16T00:18:36.424Z","updated_at":"2025-04-14T06:32:40.461Z","avatar_url":"https://github.com/ReFreezed.png","language":"Lua","readme":"# InputField\n\n[![](https://img.shields.io/github/release/ReFreezed/InputField.svg)](https://github.com/ReFreezed/InputField/releases/latest)\n[![](https://img.shields.io/github/license/ReFreezed/InputField.svg)](https://github.com/ReFreezed/InputField/blob/master/LICENSE.txt)\n\n**InputField** for [LÖVE](https://love2d.org/) enables simple handling of user text input into your program.\nThe library is a [single file](https://raw.githubusercontent.com/ReFreezed/InputField/master/InputField.lua) with no external dependencies.\n[MIT license](LICENSE.txt).\n\nYou can download the [latest release](https://github.com/ReFreezed/InputField/releases/latest) or clone the repository.\n\n- [Features](#features)\n- [Basic Usage](#basic-usage)\n\n\n\n## Features\n\n- Different field types: *Single-line*, *multi-line* (with or without wrapping), *password* (obscured characters).\n- Text cursor and navigation (by keyboard and mouse).\n- Text selection.\n- Scrolling, both vertical and horizontal.\n- Text alignment.\n- Shortcuts for common operations, like copying selected text or deleting the next word.\n- Undo and redo (history).\n- Helper functions for rendering.\n\nThe library does not do any rendering itself, but provides helper functions for rendering text, cursors and selections.\n\n\n\n## Basic Usage\n\n```lua\nlocal InputField = require(\"InputField\")\nlocal field      = InputField(\"Initial text.\")\n\nlocal fieldX = 80\nlocal fieldY = 50\n\nlove.keyboard.setKeyRepeat(true)\n\nfunction love.keypressed(key, scancode, isRepeat)\n\tfield:keypressed(key, isRepeat)\nend\nfunction love.textinput(text)\n\tfield:textinput(text)\nend\n\nfunction love.mousepressed(mx, my, mbutton, pressCount)\n\tfield:mousepressed(mx-fieldX, my-fieldY, mbutton, pressCount)\nend\nfunction love.mousemoved(mx, my)\n\tfield:mousemoved(mx-fieldX, my-fieldY)\nend\nfunction love.mousereleased(mx, my, mbutton)\n\tfield:mousereleased(mx-fieldX, my-fieldY, mbutton)\nend\nfunction love.wheelmoved(dx, dy)\n\tfield:wheelmoved(dx, dy)\nend\n\nfunction love.draw()\n\tlove.graphics.setColor(0, 0, 1)\n\tfor _, x, y, w, h in field:eachSelection() do\n\t\tlove.graphics.rectangle(\"fill\", fieldX+x, fieldY+y, w, h)\n\tend\n\n\tlove.graphics.setColor(1, 1, 1)\n\tfor _, text, x, y in field:eachVisibleLine() do\n\t\tlove.graphics.print(text, fieldX+x, fieldY+y)\n\tend\n\n\tlocal x, y, h = field:getCursorLayout()\n\tlove.graphics.rectangle(\"fill\", fieldX+x, fieldY+y, 1, h)\nend\n```\n\nSee the [library file](https://raw.githubusercontent.com/ReFreezed/InputField/master/InputField.lua) for documentation,\nor the [examples folder](https://github.com/ReFreezed/InputField/tree/master/examples) for more elaborate example programs.\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frefreezed%2Finputfield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frefreezed%2Finputfield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frefreezed%2Finputfield/lists"}