digraph relation {
	newrank = true;
	splines = "ortho";
	overlap = "vpsc";
	graph [
		rankdir = "LR",
		label = "GoldFish Engine Relation",
		nodesep = 0.75,
		ranksep = 1,
//		nodesep = 1.1,
//		ranksep = 1.05,
		bgcolor = "#343434",
		fontcolor = "white",
		style = "solid",
		color = "white"
	];
	node [
		shape = "box",
		style = "solid,filled",
		fixedsize = true,
		width = "2",
		height = "0.5",
		colorscheme = "rdylgn11",
		color = 7,
		fillcolor = 11,
		fontcolor = 6
	];
	edge [
		colorscheme = "rdylgn11",
		style = "solid",
		fontcolor = "white",
		color = 3
	];

	opengl [
		label = "OpenGL"
	];
	glu [
		label = "GLU"
	];
	glfw [
		label = "GLFW"
	];
	glx [
		label = "GLX/X11"
	];
	pthread [
		label = "POSIX Thread"
	];
	win32thread [
		label = "Win32 Thread"
	];
	wgl [
		label = "WGL/GDI"
	];

	subgraph cluster_user {
		label = "Game";
		rank = "same";
		up [
			label = "Program"
		];
		uf [
			label = "Frame callback"
		];
	};

	subgraph cluster_engine {
		label = "GoldFish Engine";
		gf [
			label = "gf_engine_t"
		];
		log [
			label = "Logger"
		];

		subgraph cluster_client {
			label = "Client Interface";
			ct [
				label = "gf_client_t"
			];
			gui [
				label = "GUI"
			];
			dt [
				label = "gf_draw_t"
			];
			ii [
				label = "Input Interface"
			];

			subgraph cluster_cplatform {
				label = "Platform-dependent";
				ii [
					label = "Input Interface"
				];

				subgraph cluster_drawing {
					label = "Drawing Interface";
					rank = "same";
					dd [
						label = "gf_draw_driver_t"
					];
					dp [
						label = "gf_draw_platform_t"
					];
					gi [
						label = "Graphic Inteface"
					];
				};
			};
		};

		subgraph cluster_server {
			label = "Server Interface";
			st [
				label = "gf_server_t"
			];

			subgraph cluster_physics {
				label = "Physics Interface";
				pt [
					label = "gf_physics_t"
				];
			};
		};

		subgraph cluster_thread {
			label = "Thread Interface";
			tt [
				label = "gf_thread_t";
			];
			tct [
				label = "gf_thread_context_t";
			];
		};

		subgraph cluster_integrated {
			label = "Integrated";
			rank = "same";
			ode [
				label = "ODE"
			];
			miniaudio [
				label = "miniaudio"
			];

			subgraph cluster_stb {
				label = "stb";
				stb_image [
					label = "stb_image"
				];
			};
		};
	};

	// Game
	up -> gf;

	up -> uf [
		dir = "none"
	];

	uf -> gf;

	// Engine
	gf -> ct;
	
	gf -> st;

	gf -> log;

	// Client
	ct -> dt;

	// Server
	st -> pt;

	// Log
	log -> dt;

	// Drawing
	dt -> {dd dp};

	dt -> gi;

	dt -> uf [
		dir = "both"
	];

	dd -> {opengl glu};

	dp -> glx;

	dp -> {wgl glfw} [ // These APIs are callback-based
		dir = "both"
	];

	dt -> gui;

	dt -> ii;

	// Input
	ii -> dp [
		dir = "both"
	];

	// Graphic
	gui -> gi;
	gui -> ii;

	gi -> dd;

	// Server
	pt -> ode [
		dir = "both"
	];

	// Thread
	tt -> {pthread win32thread};
	{pthread win32thread} -> tct;

	tct -> tt [
		dir = "none"
	];

	// External
	glu -> opengl;

	// Rank
	{
		rank = "same";
		glx; wgl; glfw;
	};

	{
		rank = "same";
		pthread; win32thread;
	};

	{
		rank = "same";
		tt; tct;
	};

	{
		rank = "same";
		opengl; glu;
	};
}
