How would you approach creating a library to dynamically resize and position ncurses windows for flexible and relatively complex TUIs?