Example #1
0
int OSScreenManager::writeString(int surfaceNum, const Rect &destRect, 
		int yOffset, const CString &str, CTextCursor *textCursor) {
	CVideoSurface *surface;
	Rect bounds;

	if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) {
		surface = _backSurfaces[surfaceNum]._surface;
		bounds = _backSurfaces[surfaceNum]._bounds;
	} else if (surfaceNum == -1) {
		surface = _frontRenderSurface;
		bounds = Rect(0, 0, surface->getWidth(), surface->getHeight());
	} else {
		return -1;
	}

	return _fonts[_fontNumber].writeString(surface, destRect, bounds,
		yOffset, str, textCursor);
}
Example #2
0
void OSScreenManager::writeString(int surfaceNum, const Point &destPos,
		const Rect &clipRect, const CString &str, int lineWidth) {
	CVideoSurface *surface;
	Rect bounds;

	if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) {
		surface = _backSurfaces[surfaceNum]._surface;
		bounds = _backSurfaces[surfaceNum]._bounds;
	} else if (surfaceNum == -1) {
		surface = _frontRenderSurface;
		bounds = Rect(0, 0, surface->getWidth(), surface->getHeight());
	} else {
		return;
	}

	Rect destRect = clipRect;
	destRect.constrain(bounds);

	_fonts[_fontNumber].writeString(surface, destPos, destRect, str, lineWidth);
}