psiberx / cp2077-codeware

Cyberpunk 2077 library and framework for creating script mods.
MIT License
74 stars 11 forks source link

Added a simple word wrapping feature #3

Closed neostalgic closed 1 year ago

neostalgic commented 2 years ago
neostalgic commented 2 years ago

@psiberx I'll make any changes you request here, just let me know if you'd prefer I structure things a certain way or move something around.

Example Usage:

let significantEvents: ref<inkText> = new inkText();
        significantEvents.SetName(n"significant_events");
        significantEvents.SetFontFamily("base\\gameplay\\gui\\fonts\\raj\\raj.inkfontfamily");
        significantEvents.SetFontStyle(n"Medium");
        significantEvents.SetFontSize(25);
        significantEvents.SetTracking(1);
        significantEvents.SetMargin(new inkMargin(0.0, 5.0, 0.0, 0.0));
        significantEvents.SetTintColor(new HDRColor(0.1137255, 0.9294118, 0.5137255, 1.0));
        significantEvents.SetSimpleWrapPosition(740.0);
        significantEvents.SetFitToContent(true);
        significantEvents.SetTextAndWrap("Started robbing apartments for cash. Joined a new band. Bought a firearm. Here is a really long backstory so I can see how badly this pushes the UI down. This is a really long piece of text that will allow me to testing the wrapping. Wow, it keeps going. This is nuts.");
        significantEvents.Reparent(netWatchDbReport);

Result: 20220223112526_1