Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

data.gno

5.30 Kb · 169 lines
  1package nft
  2
  3// Parts. Every row is the left half of the sprite, left-padded with '.' (transparent) to 12
  4// columns, and parts are the rows one after the other. Row i starts at i*12.
  5
  6const hatTall = "" +
  7	"...........o" + // y=0
  8	"..........oh" + // y=1
  9	"..........oH" + // y=2
 10	".........ohH" + // y=3
 11	".........oHH" + // y=4
 12	"........ohHH" + // y=5
 13	"........oHHH" + // y=6
 14	".......ohHHH" + // y=7
 15	".......oHHHH" + // y=8
 16	"......ohHHHH" + // y=9
 17	"......oHHHHH" // y=10
 18
 19const brim = "" +
 20	"....ohHHHHHH" + // y=11
 21	"....ojjjjjjj" // y=12
 22
 23const head = "" +
 24	"......ouuuuu" + // y=13
 25	"......osWWWs" + // y=14
 26	".....ossesss" + // y=15
 27	"....oussessn" + // y=16
 28	"......osssmn" // y=17
 29
 30const headBeard = "" +
 31	".....owWWWvv" // y=18
 32
 33const headNoBeard = "" +
 34	"......osssvv" + // y=18
 35	"......osssuu" + // y=19
 36	".......ossss" + // y=20
 37	"........oooo" // y=21
 38
 39const beardLong = "" +
 40	".....owWWWWW" + // y=19
 41	".....owWWWxW" + // y=20
 42	"......owWWxW" + // y=21
 43	"......owWxWW" + // y=22
 44	".......owWxW" + // y=23
 45	".......owWWW" + // y=24
 46	"........owWx" + // y=25
 47	".........owW" + // y=26
 48	"..........ow" // y=27
 49
 50const beardPointy = "" +
 51	".....owWWWWW" + // y=19
 52	"......owWWWW" + // y=20
 53	"......owWWxW" + // y=21
 54	".......owWWW" + // y=22
 55	".......owWxW" + // y=23
 56	"........owWW" + // y=24
 57	"........owWx" + // y=25
 58	".........owW" + // y=26
 59	".........owx" + // y=27
 60	"..........ow" // y=28
 61
 62const beardRound = "" +
 63	".....owWWWWW" + // y=19
 64	".....owWWWWW" + // y=20
 65	"......owWWWW" + // y=21
 66	".......owWWx" + // y=22
 67	"........owWW" + // y=23
 68	".........owW" + // y=24
 69	"..........ow" // y=25
 70
 71const body = "" +
 72	"....ocCCCCCC" + // y=19
 73	"...ocCCCCCCC" + // y=20
 74	"...ocCCCCCCC" + // y=21
 75	"...ocCCCCCCC" + // y=22
 76	"..oscCCCCCCC" + // y=23
 77	"..oucCCCCCCC" + // y=24
 78	"...okkkkkkky" + // y=25
 79	"...ocCCCCCCC" + // y=26
 80	"...odddddddd" // y=27
 81
 82const boots = "" +
 83	".....opppppo" + // y=28
 84	".....opppppo" + // y=29
 85	".....oqqqqqo" + // y=30
 86	".....ooooooo" // y=31
 87
 88// Bent-tip hat, see the spec section 6.1.
 89const coneY0 = 2
 90
 91var coneK = [...]int{1, 1, 2, 2, 3, 3, 4, 4, 5}
 92
 93// tailSpans are the pixels of the tip, when it falls to the right: row y, from x0 to x1 (inclusive).
 94var tailSpans = [...]span{{1, 11, 14}, {2, 14, 15}, {3, 15, 15}}
 95
 96// Glasses, see the spec section 6.2. Pairs are x, y.
 97var (
 98	glassesFrame = [...][2]int{{7, 15}, {8, 15}, {9, 15}, {14, 15}, {15, 15}, {16, 15}, {7, 16}, {9, 16}, {10, 16}, {13, 16}, {14, 16}, {16, 16}, {7, 17}, {8, 17}, {9, 17}, {14, 17}, {15, 17}, {16, 17}}
 99	glassesEyes  = [...][2]int{{8, 16}, {15, 16}}
100)
101
102// Palettes, as hex digits without '#'. Every entry has 3 tones: skin t s u, hat h H j,
103// beard w W x, tunic c C d. Entry i starts at i*3.
104var (
105	skinColors    = [...]string{"ffd2b0", "f2b58c", "d18f68", "f0bd94", "d99a6c", "b57650", "c98f66", "a86f48", "83502f"}
106	hatColors     = [...]string{"f06a5a", "d1413a", "9c2a33", "6aa0f0", "3f6fd1", "2b4a99", "7ed36a", "4aa84a", "2e7a3a", "b58cf0", "8a5cd1", "5e3c9a", "ffb45a", "f08a2a", "b5601c"}
107	beardColors   = [...]string{"ffffff", "e9ecf2", "b9c0d0", "d5d9e0", "aab1bd", "7b8494", "ffb05a", "e07a2a", "a4501c", "a8744e", "7f5234", "573622"}
108	tunicColors   = [...]string{"5fb0e8", "3f8fd1", "2b649a", "8fd06a", "5fa83f", "3d7a2a", "c98a5a", "a4673a", "75452a", "e9868f", "cc5a68", "994050", "f0d36a", "d1a83a", "a07a25"}
109	glassesColors = [...]string{"2a1a2e", "e8b422", "d1413a", "2aa198"}
110	bgColors      = [...]string{"cfe8f3", "f3e3c9", "dbeed2", "eadcf3", "f6d9d5"}
111)
112
113// fixedColor returns the color of the keys that do not depend on a trait, or "".
114func fixedColor(key byte) string {
115	switch key {
116	case 'o':
117		return "2a1a2e"
118	case 'e':
119		return "1b1626"
120	case 'k':
121		return "6b3f22"
122	case 'y':
123		return "f5c542"
124	case 'p':
125		return "6a4126"
126	case 'q':
127		return "46271a"
128	case 'n':
129		return "f08c7c"
130	case 'm':
131		return "ffb0a0"
132	case 'v':
133		return "c8645a"
134	}
135	return ""
136}
137
138// swapTable has the key used on the right half for each key of the left half.
139var swapTable = [128]byte{
140	'C': 'C',
141	'H': 'H',
142	'W': 'W',
143	'c': 'd',
144	'd': 'd',
145	'e': 'e',
146	'h': 'j',
147	'j': 'j',
148	'k': 'k',
149	'm': 'v',
150	'n': 'n',
151	'o': 'o',
152	'p': 'p',
153	'q': 'q',
154	's': 's',
155	'u': 'u',
156	'v': 'v',
157	'w': 'x',
158	'x': 'x',
159	'y': 'y',
160}
161
162// Path segments are "M{x} {y}h{n}v1h-{n}z", written as mHead[x] + nums[y] + runTail[n].
163// The percent-encoded variant only differs in the space, that is written as %20.
164var (
165	rawMHead = [...]string{"M0 ", "M1 ", "M2 ", "M3 ", "M4 ", "M5 ", "M6 ", "M7 ", "M8 ", "M9 ", "M10 ", "M11 ", "M12 ", "M13 ", "M14 ", "M15 ", "M16 ", "M17 ", "M18 ", "M19 ", "M20 ", "M21 ", "M22 ", "M23 "}
166	uriMHead = [...]string{"M0%20", "M1%20", "M2%20", "M3%20", "M4%20", "M5%20", "M6%20", "M7%20", "M8%20", "M9%20", "M10%20", "M11%20", "M12%20", "M13%20", "M14%20", "M15%20", "M16%20", "M17%20", "M18%20", "M19%20", "M20%20", "M21%20", "M22%20", "M23%20"}
167	nums     = [...]string{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"}
168	runTail  = [...]string{"", "h1v1h-1z", "h2v1h-2z", "h3v1h-3z", "h4v1h-4z", "h5v1h-5z", "h6v1h-6z", "h7v1h-7z", "h8v1h-8z", "h9v1h-9z", "h10v1h-10z", "h11v1h-11z", "h12v1h-12z", "h13v1h-13z", "h14v1h-14z", "h15v1h-15z", "h16v1h-16z", "h17v1h-17z", "h18v1h-18z", "h19v1h-19z", "h20v1h-20z", "h21v1h-21z", "h22v1h-22z", "h23v1h-23z", "h24v1h-24z"}
169)