예제 #1
0
void ChipSelecter::Draw()
{
	Render::device.SetTexturing(false);
	Render::BeginColor(Color(100, 100, 100, 180));
	Render::DrawRect(IRect(200, 150, 400, 300));
	Render::EndColor();
	
	Render::device.SetTexturing(true);
	
	//IRect rect = Game::ChipColor::DRAW_RECT;
	//Тут должно быть 44х44!
	IRect rect = IRect(0,0,44,44);

	for (int i = 0; i <= 6; i++)
	{
		int x = _chipXLeft + 50*(i%7);
		int y = _chipYDown + 50*(3 - i/7);
		FRect uv = Game::GetChipRect(i, false, false, false);
		_chipsTex->Draw(rect.MovedBy(IPoint(x - rect.width/2, y - rect.height/2)), uv);
	}

	for (size_t i = 0; i < _chipColors.size(); i++)
	{
		int color = _chipColors[i];
		int x = _chipXLeft + 50*(color%7);
		int y = _chipYDown + 50*(3 - color/7);

		Render::BeginColor(Color(100, 255, 255, 255));
		for (int q = -1; q<=1; q++)
		{
			for (int w = -1; w<=1; w++)
			{
				DrawRamka(x+q, y+w);
			}
		}
		Render::EndColor();

		FRect uv = Game::GetChipRect(color, false, false, false);	

		Render::device.SetAlpha(static_cast<int>(150+80*sinf(_timer*6 + x - y/3)));
		Render::device.SetBlendMode(Render::ADD);
		_chipsTex->Draw(rect.MovedBy(IPoint(x - rect.width/2, y - rect.height/2)), uv);
		Render::device.SetBlendMode(Render::ALPHA);
	}

	if (_underMouseChip >= 0)
	{
		int color = _underMouseChip;
		int x = _chipXLeft + 50*(color%7);
		int y = _chipYDown + 50*(3 - color/7);
		Render::BeginColor(Color(0, 255, 0, 255));
		DrawRamka(x, y);
		Render::EndColor();
	}

	Render::BindFont("debug");
	Render::PrintString(IPoint(370, 170), utils::lexical_cast(static_cast<int>(_chipColors.size())) + " colors", 1.f, CenterAlign);
}
예제 #2
0
void ChipSelecter::DrawRamka(int x, int y)
{
	//Тут должно быть 44х44!
	IRect rect = IRect(0,0,44,44);

	Render::device.SetTexturing(false);
	Render::DrawFrame(rect.MovedBy(IPoint(x - rect.width/2, y - rect.height/2)));
	Render::device.SetTexturing(true);
}