
#include "spec.h"

//only way to plot a single char like '@' and _char[12] is to copy it inside a zero terminated little string
//so you initialise it like this Chr chr = {0};
//or this Chr chr = {'@', 0};
//set the character like this chr.Chr = '@';
//print it like this Prnt(chr.Str,...))
//or like this Prnt( ((chr){'@',0}).Str ,...
//later simplied with Prnt( CHR('@').Str ,...
typedef union Chr
{
	char Str[2];
	char Chr;
	struct Tuple {
		char Chr;
		char Zero;
	} Tuple;
} Chr;
#define CHR(c) ((Chr){c,0})


/*
union magic with string
*/
union Singleton {
	struct {
		char First;
		char Second;
		char Third;
		char Fourth;
		char Fifth;
		char ZeroTH;
	} Chr;
	char Str[6];

}Singleton = {'C','h','e','e','s','y'};

//singleton concept
//always a string in the end, so serialisable
//just make sure to add '0' to all digit you may insert
#define ASNUM(num) ('0'+num)
//or use that macro obj.strct.digit = ASNUM(5)

union Cheese 
{
	char Filament[100];
	struct Grated
	{
		char UpLeftCorner[2];
		char UpLineW;
		char UpLineC;
		char UpRightCorner[3];
		char GoDown;
		char RightLineH;
		char RightLineC;
		char DownRightCorner[3];
		char GoLeft;
		char DownLineW;
		char DownLineC;
		char DownLeftCorner;
		char GoUp;
		char LeftLineH;
		char LeftLineC;
	} Grated;
} cheese = {"@L0-2@Lv0|3@L<0-L^0|"};

Let Grow = 0;
void SailingWithCheese(Co c){
	Sqr(0,0,40,25,Black);

	cheese.Grated.UpLineW = '0' + Grow;
	cheese.Grated.DownLineW = '0' + Grow;
	cheese.Grated.RightLineH = '0' + (Grow/2);
	cheese.Grated.LeftLineH = '0' + (Grow/2);
	Pth(cheese.Filament,19-(Grow/2),11-(Grow/4),Blue);
	Grow = (Grow+1)%9;
	
	Prnt(CHR('@').Str,20,13,Green);

	Prnt(Singleton.Str,17,4,Yellow);

	AnyKey(c,0);
}

