Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

[feature request]Text inline color coding. #575

Open
uq1 opened this issue Dec 11, 2017 · 4 comments
Open

[feature request]Text inline color coding. #575

uq1 opened this issue Dec 11, 2017 · 4 comments

Comments

@uq1
Copy link

uq1 commented Dec 11, 2017

Any chance inline color coding (and maybe bold?) options could be added?

Coule be either like HTML or even something as simple as some basic color options using something like quake 3 color codes "^1" for color 1, etc?

This would be really useful for all text fields, and keep ui code much cleaner.

@dumblob
Copy link
Contributor

dumblob commented Dec 17, 2017

Let me oppose this proposal. I know it's a needed feature, but because of its implementation complexity I wouldn't make it a part of Nuklear, but rather a separate single-header library independent from a font rendering backend (to allow using Freetype as well as stb_truetype.h etc.).

I can imagine this separate single-header library would be a highly configurable (in compile time) text editor supporting at least the following (from the most important to the least):

  • read-only and read-write modes
  • colors (background, foreground)
  • multiple selection of characters (including multiline selection)
  • mixing different font sizes
  • mixing different fonts
  • bold/italic/underscore/strikethrough/...
  • embeddable and "composable" (imagine one wants to build a tiny WYSIWYG word processor and wants to combine this "text widget" with e.g. tables - both having this "text widget" in the table cells as well as having the table somewhere in the "text widget")

@uq1
Copy link
Author

uq1 commented Dec 30, 2017

That is way more then I need, but would be awesome. I guess if it's going to be done, it may as well be done in a complete way 👍

I (rather hackily) changed the code myself to do simple Q3 style color markers, which is enough for me for now.

I also had to create my own tooltip code to give multi-line tooltips for the game i'm working on as you can see in the attached screenshot. I have noticed when i select an inventory item from the inventory window I made, the window background goes clear though. Not sure why.

image2

@dumblob
Copy link
Contributor

dumblob commented Jan 1, 2018

@uq1 looks good. Do you have the source for it somewhere? I could not find in your GitHub repositories. I'd like to see the amount and complexity of those patches just to guess the effort for the "full-featured" text editor generic "widget" I described above.

@uq1
Copy link
Author

uq1 commented Jan 2, 2018

The repo is here: https://github.com/Stoiss/Rend2

My hacky modifications to nuklear.h here: https://github.com/Stoiss/Rend2/blob/rend2/codemp/rd-warzone/nuklear.h

And my GUI code calling it is here: https://github.com/Stoiss/Rend2/blob/rend2/codemp/rd-warzone/warzone_gui.cpp

The assets used (and current test version) are here: https://github.com/Stoiss/WZassets (will require Star Wars: Jedi Academy game assets as well to use it)

The tooltip text in there is static, but I have written game code to use it. Just not linked up yet. This might be useful to you, however, as the warzone-gui.cpp code is based on the demo code, so you should be able to copy/paste back the other way if you want to test or play around.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants