Giter Site home page Giter Site logo

Word-wrapping in ImGui::Text about imgui HOT 5 CLOSED

ocornut avatar ocornut commented on May 6, 2024
Word-wrapping in ImGui::Text

from imgui.

Comments (5)

ocornut avatar ocornut commented on May 6, 2024 10

Added in trunk.

  • simple api TextWrapped()
  • extended api PushTextWrapPos() / PushTextWrapPos()

imgui_word_wrapping

Let me know if that works for you.

from imgui.

ocornut avatar ocornut commented on May 6, 2024

Will do that. It is useful if you want to display blurbs of text in a gui.

from imgui.

UUSim avatar UUSim commented on May 6, 2024

Nice! Any way I could help?
Idea's for extra flags:

  • Wrap only words (no words cut in half, except for words larger than the window)
  • Wrap sentences (prefer wrapping after dot(.) or comma(,))

from imgui.

ocornut avatar ocornut commented on May 6, 2024

I am still unsure how to expose the feature. I don't think it should be in by default on ImGui::Text() because that can be used for so many reason (detailed/intricate layouts). I am also hesitant to introduce new API because there's already variants (TextV, TextColored, etc.) and adding a new one would lead to combinatory.explosion.

a. Add a Push/Pop style setting
b. Add in-string tagging (convenient but rather weird)
c. Additionally I could still one function variant e.g TextWrapped() for common use, leaving the Push/Pop accessible for other cases. So there won't be a TextWrappedColored function, etc.

I think I'll do a+c

from imgui.

UUSim avatar UUSim commented on May 6, 2024

That's marvellous, thanks a lot!

from imgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.