diff options
| -rw-r--r-- | engines/hdb/gfx.cpp | 14 | ||||
| -rw-r--r-- | engines/hdb/gfx.h | 1 | 
2 files changed, 15 insertions, 0 deletions
| diff --git a/engines/hdb/gfx.cpp b/engines/hdb/gfx.cpp index ddee59fcb9..57a3d28f94 100644 --- a/engines/hdb/gfx.cpp +++ b/engines/hdb/gfx.cpp @@ -732,6 +732,20 @@ int Gfx::stringLength(const char *string) {  	return w;  } +void Gfx::centerPrint(const char *string) { +	int totalWidth = 0, i; + +	for (i = 0; i < (int)strlen(string); i++) { +		if (string[i] == ' ') +			totalWidth += kFontSpace; +		else if (string[i] != '\n') +			totalWidth += _charInfoBlocks[string[i]]->width; +	} + +	setCursor(kScreenWidth / 2 - totalWidth / 2, _cursorX); +	drawText(string); +} +  void Gfx::setTextEdges(int left, int right, int top, int bottom) {  	_eLeft = left;  	_eRight = right; diff --git a/engines/hdb/gfx.h b/engines/hdb/gfx.h index d057caeca7..d113df4a58 100644 --- a/engines/hdb/gfx.h +++ b/engines/hdb/gfx.h @@ -144,6 +144,7 @@ public:  	void drawText(const char *string);  	void getDimensions(const char *string, int *pixelsWide, int *lines);  	int stringLength(const char *string); +	void centerPrint(const char *string);  	void setTextEdges(int left, int right, int top, int bottom);  	void getTextEdges(int *left, int *right, int *top, int *bottom);  	void setKernLead(int kern, int lead); | 
