예제 #1
0
void data_converter::convertData()
{
	if(FileIsOpen)
	{
		while(!data_file.eof())
		{
		GetSingleLine();
		LookForSymbol();
		Convert();
		CreateNewDate();
		}

		data_file.close();

	}

	// Get old date from file and convert it to new date
	
}
예제 #2
0
/**
 * Get the size of a text when printed in multi-line format.
 * @param strid Text to 'print'.
 * @param max_width Longest allowed length of a line.
 * @param width [out]  Actual width of the text.
 * @param height [out] Actual height of the text.
 * @note After the call, NL characters have been inserted at line break points.
 * @note Actual width (returned in \c *width) may be larger than \a max_width in case of long words.
 */
void GetMultilineTextSize(StringID strid, int max_width, int *width, int *height)
{
	uint8 buffer[1024]; // Arbitrary max size.
	DrawText(strid, buffer, lengthof(buffer));

	*width = 0;
	*height = 0;

	uint8 *text = buffer;
	for (;;) {
		int line_width;
		text = GetSingleLine(text, max_width, &line_width);
		*width = std::max(*width, line_width);
		*height += _video.GetTextHeight();

		if (*text == '\0') break;
		assert(*text == '\n');
		text++;
	}
}
예제 #3
0
/**
 * Draw a string to the screen using several lines.
 * @param strid String to draw.
 * @param x X position at the screen.
 * @param y Y position at the screen.
 * @param max_width Available width of the text.
 * @param max_height Available height of the text.
 * @param colour Colour of the text.
 * @return The height was sufficient to output all lines.
 */
bool DrawMultilineString(StringID strid, int x, int y, int max_width, int max_height, uint8 colour)
{
	uint8 buffer[1024]; // Arbitrary max size.
	DrawText(strid, buffer, lengthof(buffer));

	uint8 *text = buffer;
	while (*text != '\0') {
		if (max_height < _video.GetTextHeight()) return false;
		max_height -= _video.GetTextHeight();

		int line_width;
		uint8 *end = GetSingleLine(text, max_width, &line_width);
		if (*end == '\0') {
			_video.BlitText(text, _palette[colour], x, y, max_width);
			break;
		}
		*end = '\0';
		_video.BlitText(text, _palette[colour], x, y, max_width);
		y += _video.GetTextHeight();
		text = end + 1;
	}
	return true;
}