The CGUI::GenerateText function:
- consists of 300 lines of code, so it's quite long. It has deep and intransparent nesting. So it would be better split into helpers.
- Does nothing other than creating a SGUIText struct, so it is a non-default constructor. Moving it over also means the code is better sorted, and CGUI becomes more agnostic of how text is handled by the GUI.
- Making this a constructor also means the IGUITextOwner may construct the texts in place instead of having to copy or move assign them over to its map / vector.
- Being able to construct the elements in place also means the IGUITextOwner can work with references instead of pointers without adding a performance regression, allowing us to remove delete calls without remorse.
- Rename SGUIText to CGUIText and GUItext.h to CGUIText.h, making this filename more consistent with the rest of the folder.
- Uses two std::array instead of [2], and CSize line_size instead of line_width and line_height
The purpose of the diff is to address these two things without introducing any behavior changes.
Revision history:
rP290 introduced GenerateText to CGUI.
rP22637 introduced more move semantics for the GUI.
rP22643 moved CGUIText to a custom header, allowing this code to be introduced in a single cpp file.