Exemplo n.º 1
0
void ButtonWidget::Render()
{
	Color BackgroundColor(0.99, 0.99, 0.99);
	Color BorderColor(0.5, 0.5, 0.5);

	if (CheckHover() && CheckActive())
	{
		BackgroundColor[0] = 0.5;
		BackgroundColor[1] = 0.5;
		BackgroundColor[2] = 0.5;
		BorderColor[0] = 0.0;
		BorderColor[1] = 0.0;
		BorderColor[2] = 0.0;
	}
	//else if ((CheckHover() && !CheckAnyActive()) || (!CheckHover() && CheckActive()))
	else if (CheckHover() && !CheckActive())
	{
		BackgroundColor[0] = 1.0;
		BackgroundColor[1] = 1.0;
		BackgroundColor[2] = 1.0;
		BorderColor[0] = 0.898;
		BorderColor[1] = 0.765;
		BorderColor[2] = 0.396;
	}
	else
	{
	}

	DrawBox(GetPosition(), GetDimensions(), BackgroundColor, BorderColor);
}
void MultitouchTestBoxWidget::Render()
{
	const Color Colors[] =
	{
		Color(static_cast<uint8>(0), 140, 0),
		Color(static_cast<uint8>(0), 98, 140),
		Color(static_cast<uint8>(194), 74, 0),
		Color(static_cast<uint8>(89), 0, 140),
		Color(static_cast<uint8>(191), 150, 0),
		Color(static_cast<uint8>(140), 0, 0)
	};

	Color BackgroundColor(Colors[m_Color]);
	//Color BorderColor(0.0, 0.0, 0.0);
	Color BorderColor(BackgroundColor);

	if (CheckHover())
	{
		BorderColor[0] = 0.898;
		BorderColor[1] = 0.765;
		BorderColor[2] = 0.396;
	}

	DrawBox(GetPosition(), GetDimensions(), BackgroundColor, BorderColor);
}
Exemplo n.º 3
0
void GamePanel::OnHover(sf::Vector2i point){
    	std::vector<Drawn*> remaining;
	std::vector<Drawn*> remaining2;
	int current = 4;
	bool stop = false;
	for(MyPair x: dynamicElements){
		    if(x.second->z == 5)
				    stop = CheckHover(x.second,point);
		    else
				    remaining.push_back(x.second);
		    if(stop)
			break;
	}
	while(current > -1 && (!stop) && remaining.size() > 0){
		    for(int x = 0; x < remaining.size(); x++){
			if(remaining[x]->z == (current))
				    stop = CheckHover(remaining[x],point);
			else
				    remaining2.push_back(remaining[x]);
			if(stop)
			    break;
		    }
		    current--;
		    remaining.clear();
		    if(stop)
			remaining2.clear();
		    for(int x = 0; x < remaining2.size(); x++){
			if(remaining2[x]->z == (current))
				    stop = CheckHover(remaining2[x],point);
			else
				    remaining.push_back(remaining2[x]);
			if(stop)
			    break;
		    };
			remaining2.clear();
		current--;
	}
};