Move wordwrapping functions and len to Font.cpp/font:: namespace

The following functions were moved directly:
- next_wrap
- next_wrap_s
- string_wordwrap
- string_wordwrap_balanced
- string_unwordwrap

These ones will probably still need get a flags argument, except for
string_unwordwrap (since they need to know what font we're talking
about.

The implementation of graphics.len has also been moved to Font.cpp,
but graphics.len still exists for now and is deprecated.
This commit is contained in:
Dav999-v
2023-01-06 19:17:50 +01:00
committed by Misa Elizabeth Kai
parent 1d8494db8d
commit 159c70dade
9 changed files with 262 additions and 251 deletions

View File

@@ -11,6 +11,7 @@
#include "DeferCallbacks.h"
#include "Entity.h"
#include "Enums.h"
#include "Font.h"
#include "Game.h"
#include "Graphics.h"
#include "GraphicsUtil.h"
@@ -1154,7 +1155,7 @@ void editorrender(void)
}
short lines;
message = graphics.string_wordwrap(message, 312, &lines);
message = font::string_wordwrap(message, 312, &lines);
short textheight = 8*lines;
graphics.fill_rect(0,238-textheight,320,240, graphics.getRGB(32,32,32));
@@ -1256,7 +1257,7 @@ void editorrender(void)
else if (ed.textmod)
{
short lines;
std::string wrapped = graphics.string_wordwrap(ed.textdesc, 312, &lines);
std::string wrapped = font::string_wordwrap(ed.textdesc, 312, &lines);
short textheight = 8*lines+8;
graphics.fill_rect(0, 238-textheight, 320, 240, graphics.getRGB(32, 32, 32));
@@ -1590,7 +1591,7 @@ void editorrender(void)
if(ed.notedelay>0 || ed.oldnotedelay>0)
{
short lines;
std::string wrapped = graphics.string_wordwrap(ed.note, 304, &lines);
std::string wrapped = font::string_wordwrap(ed.note, 304, &lines);
short textheight = 8+(lines-1)*10;
short banner_y = 120 - textheight/2 - 5;