Example #1
0
static int renderName(const char* name, int x, int y, int minSize, bool folded, bool active)
{
    int size = min_track_size;
    int text_size_full;
    int text_size;
    int x_adjust = 0;
    int spacing = 30;
    const uint32_t color = active ? active_text_color : inactive_text_color;

    text_size_full = Emgui_getTextSize(name);
    text_size = (text_size_full & 0xffff) + spacing;

    if (text_size < minSize)
        x_adjust = (minSize - text_size) / 2;
    else
        size = text_size + 1;

    if (folded)
    {
        Emgui_drawTextFlipped(name, x + 4, y + text_size - 10, color);
        size = text_size - spacing;
    }
    else
    {
        Emgui_drawText(name, x + x_adjust + 16, y, color);
    }

    return size;
}
Example #2
0
static int drawNameValue(char* name, int posX, int sizeY, int* value, int low, int high, char* buffer)
{
	int current_value;
	int text_size = Emgui_getTextSize(name) & 0xffff;

	Emgui_drawText(name, posX + 4, sizeY - 15, Emgui_color32(160, 160, 160, 255));

	current_value = atoi(buffer);

	if (current_value != *value)
	{
		if (buffer[0] != 0)
			snprintf(buffer, 64, "%d", *value);
	}

	Emgui_editBoxXY(posX + text_size + 6, sizeY - 15, 50, 13, 64, buffer); 

	current_value = atoi(buffer);

	if (current_value != *value)
	{
		current_value = eclampi(current_value, low, high); 
		if (buffer[0] != 0)
			snprintf(buffer, 64, "%d", current_value);
		*value = current_value;
	}

	return text_size + 56;
}
Example #3
0
static int getTrackSize(TrackViewInfo* viewInfo, Track* track)
{
    if (track->folded)
        return track_size_folded;

    if (track->width == 0)
    {
        Emgui_setFont(viewInfo->smallFontId);
        track->width = (Emgui_getTextSize(track->displayName) & 0xffff) + 31;
        track->width = emaxi(track->width, min_track_size);
    }

    return track->width;
}
Example #4
0
int getGroupSize(TrackViewInfo* viewInfo, Group* group, int startTrack)
{
    int i, size = 0, count = group->trackCount;

    if (group->width == 0)
        group->width = (Emgui_getTextSize(group->name) & 0xffff) + 40;

    if (group->folded)
        return track_size_folded;

    for (i = startTrack; i < count; ++i)
        size += getTrackSize(viewInfo, group->t.tracks[i]);

    size = emaxi(size, group->width);

    return size;
}