#include "..\CookHeader.h"
#include <Windows.h>
#include <conio.h>

HWND hwnd;
HDC hdc;
HPEN pen; // 색상 펜
int wSize = 1000;
int radius = 400;

void setRandomColor() {
	randomInit(0, 255); // 0~255 사이의 초기화
	int r = cookRandom(gen);
	int g = cookRandom(gen);
	int b = cookRandom(gen);
	pen = CreatePen(PS_SOLID, 1, RGB(r, g, b));
	SelectObject(hdc, pen);
}

void drawCircle(int x, int y, int r) {
	setRandomColor();
	Ellipse(hdc, x - r, y - r, x + r, y + r);
	if (r >= 5) {
		drawCircle(x - r / 2, y, r / 2);
		drawCircle(x + r / 2, y, r / 2);
	}
}

int main() {
	_getch();
	hwnd = GetForegroundWindow();
	hdc = GetDC(hwnd);	// hdc = GetDC(NULL);	

	drawCircle(wSize / 2, wSize / 2, radius);

	ReleaseDC(hwnd, hdc);
}