rparrett / bevy_simple_text_input Goto Github PK
View Code? Open in Web Editor NEWBevy plugin for a simple single-line text input widget.
License: Other
Bevy plugin for a simple single-line text input widget.
License: Other
winit
doesn't send ReceivedCharacter
events for these on the web.
So we need to use KeyboardInput
events for these. This is unfortunate because the separate event streams can cause timing issues. In another project, to fix these timing issues, I resorted to using KeyboardInput
for everything, but this came at the expense of easy international keyboard support.
So I think switching backspace and enter to KeyboardInput
is the right call for now, potentially only for wasm if that doesn't complicate things too much.
This is fixed in winit 0.29 (and hopefully bevy 0.12. see bevyengine/bevy#8745) where these two events are unified into KeyEvent
.
I am thinking along the lines of a simple "spinner."
┌───┐ ┌───────────────┐ ┌───┐
│ - │ │ 12| │ │ + │
└───┘ └───────────────┘ └───┘
This doesn't need to be full-featured. Just enough for the plus/minus buttons to retrieve the current value and increment it. It's a bit silly to store the value as a text field on the text input, but I like the simplicity for an example.
I am open to other ideas.
I don't undertsand very well why it is needed to spawn a NodeBundle
together with the TextInput
if all the input system is embedded in a overflow container and is added as a child to the TextInput
entity. The TextInput
solely should render with no problem. However, that panics.
This widget panics if you try to type in any non-ASCII character. For example, if I press option+d on my Mac keyboard it produces "∂" and the app immediately crashes. It seems to be because the library is assuming that all characters are one byte wide.
you should add a system for copying and pasting text into text input
Sometimes it's needed to get current text without pressing enter. It would be convenient to have a component with current text that gets updated.
I know it's possible to get current text from children TextBundle
, but it's not quite convenient.
The basic
and focus
examples should use the same colors as the new value
example after #26 is merged.
It's distracting for the cursor to blink while typing, and confusing for it to blink while the cursor is moving left/right.
This is a "nice to have" feature and its implementation shouldn't conflict with this project's goals:
The code should be simple enough for users to quickly understand and modify for their own purposes.
If this can't be done very cleanly it's okay not to do it.
If TextInput.text_style
is changed, we should update the text sections in Text
. This is slightly annoying for end-users to do, because you have to take care to not overwrite the font of the cursor.
This is a "nice to have" feature and its implementation shouldn't conflict with this project's goals:
The code should be simple enough for users to quickly understand and modify for their own purposes.
If this can't be done very cleanly it's okay not to do it.
And it should be set to hidden immediately upon becoming inactive
This is a "nice to have" feature and its implementation shouldn't conflict with this project's goals:
The code should be simple enough for users to quickly understand and modify for their own purposes.
If this can't be done very cleanly it's okay not to do it.
Let's discuss how this might be done without introducing a huge amount of complexity.
To reproduce:
cargo run --example basic
hello there
This reveals another issue with the janky zero-width cursor setup when left-arrow is pressed for the first time.
Roughly, we need to
TextLayoutInfo
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.