Esempio n. 1
0
static void window_loadsave_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
	window_draw_widgets(w, dpi);

	if (_shortenedDirectory[0] == '\0') {
		shorten_path(_shortenedDirectory, sizeof(_shortenedDirectory), _directory, w->width - 8);
	}

	utf8 buffer[256];

	// Format text
	utf8 *ch = buffer;
	ch = utf8_write_codepoint(ch, FORMAT_MEDIUMFONT);
	ch = utf8_write_codepoint(ch, FORMAT_BLACK);
	safe_strcpy(ch, _shortenedDirectory, sizeof(buffer) - (ch - buffer));

	// Draw shadow
	gfx_draw_string(dpi, buffer, 0, w->x + 4, w->y + 20);
	rct_string_id id = STR_NONE;
	// Name button text
	if (gConfigGeneral.load_save_sort == SORT_NAME_ASCENDING)
		id = STR_UP;
	else if (gConfigGeneral.load_save_sort == SORT_NAME_DESCENDING)
		id = STR_DOWN;
	gfx_draw_string_centred_clipped(dpi, STR_NAME, &id, 1, w->x + 4 + (w->width - 8) / 4, w->y + 50, (w->width - 8) / 2);
	// Date button text
	if (gConfigGeneral.load_save_sort == SORT_DATE_ASCENDING)
		id = STR_UP;
	else if (gConfigGeneral.load_save_sort == SORT_DATE_DESCENDING)
		id = STR_DOWN;
	else
		id = STR_NONE;
	gfx_draw_string_centred_clipped(dpi, STR_DATE, &id, 1, w->x + 4 + (w->width - 8) * 3 / 4, w->y + 50, (w->width - 8) / 2);
}
Esempio n. 2
0
void vcgen_dash::rewind(unsigned)
{
    if(m_status == initial) {
        m_src_vertices.close(m_closed != 0);
        shorten_path(m_src_vertices, m_shorten, m_closed);
    }
    m_status = ready;
    m_src_vertex = 0;
}
Esempio n. 3
0
 //------------------------------------------------------------------------
 void vcgen_stroke::rewind(unsigned)
 {
     if(m_status == initial)
     {
         m_src_vertices.close(m_closed != 0);
         shorten_path(m_src_vertices, m_shorten, m_closed);
         if(m_src_vertices.size() < 3) m_closed = 0;
     }
     m_status = ready;
     m_src_vertex = 0;
     m_out_vertex = 0;
 }
std::string filename_map::convert(std::string input) const {
	
	// Convert paths to lower-case if requested
	if(lowercase) {
		std::transform(input.begin(), input.end(), input.begin(), ::tolower);
	}
	
	// Don't expand variables if requested
	if(!expand) {
		return input;
	}
	
	it begin = input.begin();
	std::string expanded = expand_variables(begin, input.end());
	
	return shorten_path(expanded);
}
Esempio n. 5
0
static void window_scenarioselect_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
	int i, x, y, format;
	rct_widget *widget;
	const scenario_index_entry *scenario;

	window_draw_widgets(w, dpi);

	format = (theme_get_flags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT) ? STR_SMALL_WINDOW_COLOUR_2_STRINGID : STR_WINDOW_COLOUR_2_STRINGID;

	// Text for each tab
	for (i = 0; i < 8; i++) {
		widget = &window_scenarioselect_widgets[WIDX_TAB1 + i];
		if (widget->type == WWT_EMPTY)
			continue;

		x = (widget->left + widget->right) / 2 + w->x;
		y = (widget->top + widget->bottom) / 2 + w->y - 3;

		if (gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN) {
			set_format_arg(0, rct_string_id, ScenarioOriginStringIds[i]);
		} else { // old-style
			set_format_arg(0, rct_string_id, ScenarioCategoryStringIds[i]);
		}
		gfx_draw_string_centred_wrapped(dpi, gCommonFormatArgs, x, y, 87, format, COLOUR_AQUAMARINE);
	}

	// Return if no scenario highlighted
	scenario = w->highlighted_scenario;
	if (scenario == NULL) {
		if (_showLockedInformation) {
			// Show locked information
			x = w->x + window_scenarioselect_widgets[WIDX_SCENARIOLIST].right + 4;
			y = w->y + window_scenarioselect_widgets[WIDX_TABCONTENT].top + 5;
			gfx_draw_string_centred_clipped(dpi, STR_SCENARIO_LOCKED, NULL, COLOUR_BLACK, x + 85, y, 170);
			y += 15;
			y += gfx_draw_string_left_wrapped(dpi, NULL, x, y, 170, STR_SCENARIO_LOCKED_DESC, COLOUR_BLACK) + 5;
		}
		return;
	}

	// Scenario path
	if (gConfigGeneral.debugging_tools) {
		utf8 path[MAX_PATH];

		gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
		shorten_path(path, sizeof(path), scenario->path, w->width - 6);

		const utf8 *pathPtr = path;
		gfx_draw_string_left(dpi, STR_STRING, (void*)&pathPtr, w->colours[1], w->x + 3, w->y + w->height - 3 - 11);
	}

	// Scenario name
	x = w->x + window_scenarioselect_widgets[WIDX_SCENARIOLIST].right + 4;
	y = w->y + window_scenarioselect_widgets[WIDX_TABCONTENT].top + 5;
	set_format_arg(0, rct_string_id, STR_STRING);
	set_format_arg(2, const char *, scenario->name);
	gfx_draw_string_centred_clipped(dpi, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, x + 85, y, 170);
	y += 15;

	// Scenario details
	set_format_arg(0, rct_string_id, STR_STRING);
	set_format_arg(2, const char *, scenario->details);
	y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, 170, STR_BLACK_STRING, COLOUR_BLACK) + 5;

	// Scenario objective
	set_format_arg(0, rct_string_id, ObjectiveNames[scenario->objective_type]);
	set_format_arg(2, short, scenario->objective_arg_3);
	set_format_arg(4, short, date_get_total_months(MONTH_OCTOBER, scenario->objective_arg_1));
	set_format_arg(6, int, scenario->objective_arg_2);
	y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, 170, STR_OBJECTIVE, COLOUR_BLACK) + 5;

	// Scenario score
	if (scenario->highscore != NULL) {
		// TODO: Should probably be translateable
		const utf8 *completedByName = "???";
		if (!str_is_null_or_empty(scenario->highscore->name)) {
			completedByName = scenario->highscore->name;
		}
		set_format_arg(0, rct_string_id, STR_STRING);
		set_format_arg(2, const char *, completedByName);
		set_format_arg(2 + sizeof(const char *), money32, scenario->highscore->company_value);
		y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, 170, STR_COMPLETED_BY_WITH_COMPANY_VALUE, COLOUR_BLACK);
	}
}