I have a string that stores all kind of logged data. This data should be accessible via a console. The console has of course only a limited height. Therefore, I do not need to render the entire text, but only, what is visible. For this I have a variable that stores how many pixels from the bottom (most recent) end of the text the user has scrolled up. Now I guess what I need is a way to find out which part of my text fits into my console, and how to tell DirectWrite to only render this.
What I have done so far:
Right now I am using CreateTextLayout(...)
and DrawTextLayout(...)
to draw the complete text (right now just a small test text) without the scrolling ability.
CreateTextLayout(...)
already takes arguments maxWidth
and maxHeight
. So maybe this takes care of the problem of rendering only what fits into the console.
I have also used DWRITE_PARAGRAPH_ALIGNMENT_FAR
to have the newest text-lines visible. But how do I add the additional scrolling (best in form of additional pixels and not lines so that I can implement smooth scrolling via some time controlled incrementation)?
In short
- Does
CreateTextLayout(...)
handle the "render-only-what-is-visible part" for me? - How do I include the scrolling part?
Edit: Changed the title, as it was not really summing up the question very well.