Comments (2)
v2.2 lets you manually focus edit widgets. Unfortunately, I don't know of a way to create a chatbox -- you might want to post an issue to the Nuklear repository. Here is an example where enter focuses the edit box and commits the text if it's already focused:
local nuklear = require 'nuklear'
local ui
function love.load()
ui = nuklear.newUI()
end
local active = false
local focus = false
local edit = {value = ''}
local messages = {}
function love.update(dt)
ui:frameBegin()
if ui:windowBegin('Focus Edit', 100, 100, 200, 100,
'border', 'title', 'movable') then
ui:layoutRow('dynamic', 30, 1)
if focus then
ui:editFocus()
end
local state, changed = ui:edit('field', edit)
active = state == 'active'
end
ui:windowEnd()
ui:frameEnd()
focus = false
end
function love.draw()
ui:draw()
end
function love.keypressed(key, scancode, isrepeat)
if key == 'return' then
if active then
table.insert(messages, edit.value)
edit.value = ''
else
focus = true
end
end
ui:keypressed(key, scancode, isrepeat)
end
function love.keyreleased(key, scancode)
ui:keyreleased(key, scancode)
end
function love.mousepressed(x, y, button, istouch)
ui:mousepressed(x, y, button, istouch)
end
function love.mousereleased(x, y, button, istouch)
ui:mousereleased(x, y, button, istouch)
end
function love.mousemoved(x, y, dx, dy, istouch)
ui:mousemoved(x, y, dx, dy, istouch)
end
function love.textinput(text)
ui:textinput(text)
end
function love.wheelmoved(x, y)
ui:wheelmoved(x, y)
end
from love-nuklear.
I am actually interested in this problem, so I went ahead and made an issue myself: vurtun/nuklear#781
from love-nuklear.
Related Issues (20)
- Updated binaries? HOT 3
- What is the correct way to create a closable window? HOT 4
- tooltip controls HOT 2
- Segfault when calling layoutTemplatePush twice in a row HOT 3
- Error when pushing style: 'attempt to index a nil value' HOT 3
- iOS build instructions HOT 1
- Text Input on Android and iOS
- Specified procedure could not be found. HOT 2
- Clipboard HOT 1
- Direct number passed to property doesn't update HOT 3
- nuklear.h CMake Build Error HOT 2
- Should export then nk_clear HOT 1
- Lost click events at low frame rates HOT 2
- MSVC Support HOT 2
- Error: error loading module 'nuklear-32' from file '.\nuklear-32.dll': %1 is not a valid Win32 application. HOT 2
- Cannot set button text background. HOT 5
- nk_love_draw is quite slow
- Question : install in windows10 mingw64 HOT 1
- Help : draw text HOT 1
- UI functions don't seem to work from a coroutine HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from love-nuklear.