Beispiel #1
0
QIcon IconUtils::tintedIcon(const char *name, const QColor &color, const QVector<QSize> &sizes) {
    QIcon i = IconUtils::icon(name);
    QIcon t;
    // if (sizes.isEmpty()) sizes = i.availableSizes();
    for (const QSize &size : sizes) {
        QPixmap pixmap = i.pixmap(size);
        tint(pixmap, color);
        t.addPixmap(pixmap);
    }
    return t;
}
Beispiel #2
0
Tuner::Tuner(std::vector<int> tuning, bool returnToMenu):
	notes(tuning),
	currentNote(-1),
	text("../resources/textures/text_Inconsolata29.dds"),
	hit(false),
	returnToMenu(returnToMenu)
{
	float x = 700;
	float y = 540 + 0.5f * neckHeight;
	float w = 1000;
	float h = 2;
	size_t stringCount = tuning.size();
	float stringSpacing = neckHeight / (stringCount - 1);

	stringSprites.first = sprites.getCount();

	for (size_t id = 0; id < stringCount; id++)
	{
		gaugePositions.push_back(y);
		glm::vec3 tint(o.stringColors[3 * id],
				o.stringColors[3 * id + 1],
				o.stringColors[3 * id + 2]);
		sprites.add(
			x - h / 2,
			y,
			w,
			h,
			tint
		);
		y -= stringSpacing;
	}

	stringSprites.second = sprites.getCount();

	glGenVertexArrays(1, &vertexArrayId);
	glBindVertexArray(vertexArrayId);
	glGenBuffers(1, &vertexBufferId);
	glBindBuffer(GL_ARRAY_BUFFER, vertexBufferId);
	gaugeVertices.push_back(960);
	gaugeVertices.push_back(540);
	gaugeVertices.push_back(960 + needleLength);
	gaugeVertices.push_back(540);
	glBufferData(GL_ARRAY_BUFFER, sizeof(float) * gaugeVertices.size(), gaugeVertices.data(), GL_STATIC_DRAW);
	programId = loadShaders("../resources/shaders/gauge.vs",
		"../resources/shaders/gauge.fs");
	uniformTintId = glGetUniformLocation(programId, "tint");

	nextNote();
	o.load();
	a = new Audio(io, SAMPLE_RATE);
	a->start();
}
/* PaletteEntryPanel::handleAction
 * Handles the action [id]. Returns true if the action was handled,
 * false otherwise
 *******************************************************************/
bool PaletteEntryPanel::handleAction(string id)
{
	// Ignore if hidden
	if (!isActivePanel())
		return false;

	// Only interested in "ppal_" events
	if (!id.StartsWith("ppal_"))
		return false;

	// Add to custom palettes
	if (id == "ppal_addcustom")
	{
		addCustomPalette();
		return true;
	}

	// Test palette
	else if (id == "ppal_test")
	{
		testPalette();
		return true;
	}

	// Export As
	else if (id == "ppal_exportas")
	{
		exportAs();
		return true;
	}

	// Import From
	else if (id == "ppal_importfrom")
	{
		importFrom();
		return true;
	}

	// Generate Palettes
	if (id == "ppal_generate")
	{
		generatePalettes();
		return true;
	}

	// Generate Colormaps
	if (id == "ppal_colormap")
	{
		generateColormaps();
		return true;
	}

	// Colourise
	else if (id == "ppal_colourise")
	{
		colourise();
		return true;
	}

	// Tint
	else if (id == "ppal_tint")
	{
		tint();
		return true;
	}

	// Tweak
	else if (id == "ppal_tweak")
	{
		tweak();
		return true;
	}

	// Invert
	else if (id == "ppal_invert")
	{
		invert();
		return true;
	}

	// Move Up
	else if (id == "ppal_moveup")
	{
		move(true);
		return true;
	}

	// Move Down
	else if (id == "ppal_movedown")
	{
		move(false);
		return true;
	}

	// Duplicate
	else if (id == "ppal_duplicate")
	{
		duplicate();
		return true;
	}

	// Remove
	else if (id == "ppal_remove")
	{
		clearOne();
		return true;
	}

	// Remove Others
	else if (id == "ppal_removeothers")
	{
		clearOthers();
		return true;
	}

	// Some debug/reverse engineering stuff
	else if (id == "ppal_report")
	{
		analysePalettes();
		return true;
	}

	return false;
}