Hello,
I want to do a hobby project and may develope a 3D game during the next years. I have started some years ago and work when I find time and mute. I have no IT background but did some reading in the forum here. I have tried nifty a while ago and recently tested and tried lemur.
For what I have in mind I need a textfield, that allows selecting text, copy and paste etc., like a chat window in games, where you can copy and paste text with outside game world.
While studying lemur I could not find that functionality and I believe it is hard to add it from outside the library/jar.
As I am not experienced but lazy enough to start from scretch and I think lemur is quiete mature I just tried my luck, made an github account, downloaded the lemur library and enhanced it.
I added /changed the following (hope I wont forget anything):
-
added “textblockers” to the standard scrollmode:
→ its not possible anymore to have visible text outside a textbox
→ added a maxlinecount, that can differ from setPreferredLineCount -
made textfields static
→ in the standard example the password field grew once there was an offset and you return the cursor to the left -
added an optional scrollmode “full”
→ offset in X and Y direction is possible. No scrollbars, but you have a getOffset_Y() and getOffset_X() function, in case you want to add them by yourself
→ rewrote the current offset x method, it caused an recursive call/stack overflow in the function resetCursorPosition() once you add to many words at once -
added an optional scrollmode “autoadjust”
→ offset in Y direction, autoadjust in x direction
→ separat usable autoadjust function, that wrap lines once a word or a character would be out of the textbox, the scrollmode comes with autoadjust for words -
added two optional textselect modes (unstatic and static)
→ replacing the current anchor system with an field of anchors
→ you can have as many selected areas in text as you want
→ add, delete and reverse textselect areas (in any position of the text) is possible
→ get the currently selected text is possible
→ the standard textselect mode, onces activated, comes with the functionality of STR+A; STR+C;STR+V; STR+X + selecting and deselecting with shift + lemur standard cursor movements (e.g. up, down, home)
→ standard selectmode is unstatic: selected areas are removed once cursor is moved without shift key -
changed the lemur demos to add and show the new functionallity
In total I have changed the following files:
Lemur\src\main\java\com\simsilica\lemur\component\TextEntryComponent.Java
Lemur\src\main\java\com\simsilica\lemur\text\DefaultDocumentModel.java
Lemur\src\main\java\com\simsilica\lemur\text\DocumentModel.java
Lemur\examples\demos\src\main\java\demo\TextEntryDemoState.java
Lemur\src\main\java\com\simsilica\lemur\text\DocumentModelFilter.java
As pictures and movies say more then 1.000 words, I made an account on vimeo and uploaded something for you.
Why do I write all this? Even if I myself wont need all the changes I made?
After I started adding the functionality I said to myself:
Even if you just need one area in a text to be selected it would be nice to have the ability to add many. And I wanted to make it fully functional. I also thought, that I will take everything I need from the community, so I would like to offer to give something back.
I hope that the changes I made are worth to be considered to be taken into the Lemur library (so I myself can just use the ready jar). For sure it will need some code revision as i am not fit in e.g. naming conventions and I am not completely sure if the changes are interfering somewhere they should not.
If you are interessted I would clean and sort the code, as it currently still contain personal notices and reminders and share it with you.
Just let me know and please also tell me how to share or commit – not in detail, but I had a lot of first times recently: first time github, take code from there, first time making a video, first time uploading a video somewhere. And sharing the code will be another first time.
Cheers from Tunisia