示例#1
0
static void window_multiplayer_information_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
	window_draw_widgets(w, dpi);
	window_multiplayer_draw_tab_images(w, dpi);

	rct_drawpixelinfo clippedDPI;
	if (clip_drawpixelinfo(&clippedDPI, dpi, w->x, w->y, w->width, w->height)) {
		dpi = &clippedDPI;

		sint32 x = 3;
		sint32 y = 50;
		sint32 width = w->width - 6;

		const utf8 * name = network_get_server_name();
		{
			gfx_draw_string_left_wrapped(dpi, (void*)&name, x, y, width, STR_STRING, w->colours[1]);
			y += 11;
		}
		y += 3;

		const utf8 * description = network_get_server_description();
		if (!str_is_null_or_empty(description)) {
			gfx_draw_string_left_wrapped(dpi, (void*)&description, x, y, width, STR_STRING, w->colours[1]);
			y += 11;
		}
		y += 8;

		const utf8 * providerName = network_get_server_provider_name();
		if (!str_is_null_or_empty(providerName)) {
			gfx_draw_string_left(dpi, STR_PROVIDER_NAME, (void*)&providerName, COLOUR_BLACK, x, y);
			y += 11;
		}

		const utf8 * providerEmail = network_get_server_provider_email();
		if (!str_is_null_or_empty(providerEmail)) {
			gfx_draw_string_left(dpi, STR_PROVIDER_EMAIL, (void*)&providerEmail, COLOUR_BLACK, x, y);
			y += 11;
		}

		const utf8 * providerWebsite = network_get_server_provider_website();
		if (!str_is_null_or_empty(providerWebsite)) {
			gfx_draw_string_left(dpi, STR_PROVIDER_WEBSITE, (void*)&providerWebsite, COLOUR_BLACK, x, y);
		}
	}
}
示例#2
0
static rct_xy16 window_multiplayer_information_get_size()
{
	if (!_windowInformationSizeDirty) {
		return _windowInformationSize;
	}

	sint32 width = 450;
	sint32 height = 110;
	sint32 numLines, fontSpriteBase;

	gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
	utf8 * buffer = _strdup(network_get_server_description());
	gfx_wrap_string(buffer, width, &numLines, &fontSpriteBase);
	free(buffer);

	sint32 lineHeight = font_get_line_height(fontSpriteBase);
	height += (numLines + 1) * lineHeight;

	_windowInformationSizeDirty = false;
	_windowInformationSize = (rct_xy16){ width, height };
	return _windowInformationSize;
}
示例#3
0
static LocationXY16 window_multiplayer_information_get_size()
{
    if (!_windowInformationSizeDirty) {
        return _windowInformationSize;
    }

    sint32 width = 450;
    sint32 height = 60;
    sint32 minNumLines = 5;
    sint32 descNumLines, fontSpriteBase;

    gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
    utf8 * buffer = _strdup(network_get_server_description());
    gfx_wrap_string(buffer, width, &descNumLines, &fontSpriteBase);
    free(buffer);

    sint32 lineHeight = font_get_line_height(fontSpriteBase);
    height += (minNumLines + descNumLines) * lineHeight;

    _windowInformationSizeDirty = false;
    _windowInformationSize = { (sint16)width, (sint16)height };
    return _windowInformationSize;
}