Skip to content

Latest commit

 

History

History
31 lines (24 loc) · 596 Bytes

DotPaint.md

File metadata and controls

31 lines (24 loc) · 596 Bytes

ドットお絵かき

ドットお絵かき

# include <Siv3D.hpp>

void Main()
{
	Graphics::SetBackground(Palette::White);

	const int32 dotSize = 40;

	Grid<int32> dots(Window::Width() / dotSize, Window::Height() / dotSize);

	while (System::Update())
	{
		for (auto p : step({ dots.width, dots.height }))
		{
			const Rect rect(p * dotSize, dotSize, dotSize);

			if (rect.leftClicked)
			{
				++dots[p.y][p.x] %= 4;
			}

			const Color color(240 - dots[p.y][p.x] * 70);

			rect.stretched(-1).draw(color);
		}
	}
}