Compare commits

..

2 Commits

10 changed files with 312 additions and 294 deletions

1
assets/data/atlas.json Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@ -99,8 +99,6 @@ if ! [ -f build/atlas.png ]; then
msdf-atlas-gen -font assets/fonts/NuberNextCondensed-DemiBold.otf -dimensions 256 256 -type softmask -imageout build/atlas.png -json build/atlas.json
fi
if ! [ -f assets/textures/atlas.png ]; then
cp build/atlas.png assets/textures/atlas.png
mkdir -p assets/data
cp build/atlas.json assets/data/atlas.json
fi

View File

@ -24,10 +24,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.179391,
plane_right: 0.169840,
plane_top: 0.145222,
atlas_left: 0.033160,
atlas_bottom: -0.179391,
atlas_right: 0.169840,
atlas_top: 0.145222,
atlas_left: 247.500000,
atlas_bottom: 19.500000,
atlas_right: 255.500000,
atlas_top: 0.500000,
},
{
ch: '-',
@ -36,10 +36,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: 0.230646,
plane_right: 0.323179,
plane_top: 0.350240,
atlas_left: 0.049821,
atlas_bottom: 0.230646,
atlas_right: 0.323179,
atlas_top: 0.350240,
atlas_left: 40.500000,
atlas_bottom: 51.500000,
atlas_right: 56.500000,
atlas_top: 44.500000,
},
{
ch: '.',
@ -48,10 +48,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.167797,
plane_top: 0.145222,
atlas_left: 0.048203,
atlas_bottom: -0.008542,
atlas_right: 0.167797,
atlas_top: 0.145222,
atlas_left: 247.500000,
atlas_bottom: 28.500000,
atlas_right: 254.500000,
atlas_top: 19.500000,
},
{
ch: '0',
@ -60,10 +60,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.447061,
plane_top: 0.709023,
atlas_left: 0.019939,
atlas_bottom: -0.025627,
atlas_right: 0.447061,
atlas_top: 0.709023,
atlas_left: 149.500000,
atlas_bottom: 43.500000,
atlas_right: 174.500000,
atlas_top: 0.500000,
},
{
ch: '1',
@ -72,10 +72,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.242594,
plane_top: 0.691938,
atlas_left: 0.003406,
atlas_bottom: -0.008542,
atlas_right: 0.242594,
atlas_top: 0.691938,
atlas_left: 98.500000,
atlas_bottom: 220.500000,
atlas_right: 112.500000,
atlas_top: 179.500000,
},
{
ch: '2',
@ -84,10 +84,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.424519,
plane_top: 0.709023,
atlas_left: 0.014481,
atlas_bottom: -0.008542,
atlas_right: 0.424519,
atlas_top: 0.709023,
atlas_left: 0.500000,
atlas_bottom: 137.500000,
atlas_right: 24.500000,
atlas_top: 95.500000,
},
{
ch: '3',
@ -96,10 +96,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.437061,
plane_top: 0.709023,
atlas_left: 0.009939,
atlas_bottom: -0.025627,
atlas_right: 0.437061,
atlas_top: 0.709023,
atlas_left: 174.500000,
atlas_bottom: 43.500000,
atlas_right: 199.500000,
atlas_top: 0.500000,
},
{
ch: '4',
@ -108,10 +108,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.455604,
plane_top: 0.691938,
atlas_left: 0.011396,
atlas_bottom: -0.008542,
atlas_right: 0.455604,
atlas_top: 0.691938,
atlas_left: 112.500000,
atlas_bottom: 220.500000,
atlas_right: 138.500000,
atlas_top: 179.500000,
},
{
ch: '5',
@ -120,10 +120,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.442561,
plane_top: 0.691938,
atlas_left: 0.015439,
atlas_bottom: -0.025627,
atlas_right: 0.442561,
atlas_top: 0.691938,
atlas_left: 24.500000,
atlas_bottom: 137.500000,
atlas_right: 49.500000,
atlas_top: 95.500000,
},
{
ch: '6',
@ -132,10 +132,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.445061,
plane_top: 0.709023,
atlas_left: 0.017939,
atlas_bottom: -0.025627,
atlas_right: 0.445061,
atlas_top: 0.709023,
atlas_left: 199.500000,
atlas_bottom: 43.500000,
atlas_right: 224.500000,
atlas_top: 0.500000,
},
{
ch: '7',
@ -144,10 +144,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.379934,
plane_top: 0.691938,
atlas_left: 0.004066,
atlas_bottom: -0.008542,
atlas_right: 0.379934,
atlas_top: 0.691938,
atlas_left: 138.500000,
atlas_bottom: 220.500000,
atlas_right: 160.500000,
atlas_top: 179.500000,
},
{
ch: '8',
@ -156,10 +156,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.445561,
plane_top: 0.709023,
atlas_left: 0.018439,
atlas_bottom: -0.025627,
atlas_right: 0.445561,
atlas_top: 0.709023,
atlas_left: 23.500000,
atlas_bottom: 95.500000,
atlas_right: 48.500000,
atlas_top: 52.500000,
},
{
ch: '9',
@ -168,10 +168,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.438061,
plane_top: 0.709023,
atlas_left: 0.010939,
atlas_bottom: -0.025627,
atlas_right: 0.438061,
atlas_top: 0.709023,
atlas_left: 48.500000,
atlas_bottom: 95.500000,
atlas_right: 73.500000,
atlas_top: 52.500000,
},
{
ch: ':',
@ -180,10 +180,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.167797,
plane_top: 0.521089,
atlas_left: 0.048203,
atlas_bottom: -0.008542,
atlas_right: 0.167797,
atlas_top: 0.521089,
atlas_left: 137.500000,
atlas_bottom: 252.500000,
atlas_right: 144.500000,
atlas_top: 221.500000,
},
{
ch: ';',
@ -192,10 +192,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.179391,
plane_right: 0.169840,
plane_top: 0.521089,
atlas_left: 0.033160,
atlas_bottom: -0.179391,
atlas_right: 0.169840,
atlas_top: 0.521089,
atlas_left: 243.500000,
atlas_bottom: 136.500000,
atlas_right: 251.500000,
atlas_top: 95.500000,
},
{
ch: 'A',
@ -204,10 +204,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.523773,
plane_top: 0.709023,
atlas_left: 0.011227,
atlas_bottom: -0.008542,
atlas_right: 0.523773,
atlas_top: 0.709023,
atlas_left: 76.500000,
atlas_bottom: 179.500000,
atlas_right: 106.500000,
atlas_top: 137.500000,
},
{
ch: 'B',
@ -216,10 +216,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.474561,
plane_top: 0.709023,
atlas_left: 0.047439,
atlas_bottom: -0.008542,
atlas_right: 0.474561,
atlas_top: 0.709023,
atlas_left: 215.500000,
atlas_bottom: 179.500000,
atlas_right: 240.500000,
atlas_top: 137.500000,
},
{
ch: 'C',
@ -228,10 +228,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.491646,
plane_top: 0.726108,
atlas_left: 0.030354,
atlas_bottom: -0.025627,
atlas_right: 0.491646,
atlas_top: 0.726108,
atlas_left: 40.500000,
atlas_bottom: 44.500000,
atlas_right: 67.500000,
atlas_top: 0.500000,
},
{
ch: 'D',
@ -240,10 +240,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.508146,
plane_top: 0.709023,
atlas_left: 0.046854,
atlas_bottom: -0.008542,
atlas_right: 0.508146,
atlas_top: 0.709023,
atlas_left: 26.500000,
atlas_bottom: 221.500000,
atlas_right: 53.500000,
atlas_top: 179.500000,
},
{
ch: 'E',
@ -252,10 +252,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.439976,
plane_top: 0.709023,
atlas_left: 0.047024,
atlas_bottom: -0.008542,
atlas_right: 0.439976,
atlas_top: 0.709023,
atlas_left: 75.500000,
atlas_bottom: 221.500000,
atlas_right: 98.500000,
atlas_top: 179.500000,
},
{
ch: 'F',
@ -264,10 +264,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.419934,
plane_top: 0.709023,
atlas_left: 0.044066,
atlas_bottom: -0.008542,
atlas_right: 0.419934,
atlas_top: 0.709023,
atlas_left: 53.500000,
atlas_bottom: 221.500000,
atlas_right: 75.500000,
atlas_top: 179.500000,
},
{
ch: 'G',
@ -276,10 +276,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.503688,
plane_top: 0.726108,
atlas_left: 0.025312,
atlas_bottom: -0.025627,
atlas_right: 0.503688,
atlas_top: 0.726108,
atlas_left: 67.500000,
atlas_bottom: 44.500000,
atlas_right: 95.500000,
atlas_top: 0.500000,
},
{
ch: 'H',
@ -288,10 +288,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.493104,
plane_top: 0.709023,
atlas_left: 0.048896,
atlas_bottom: -0.008542,
atlas_right: 0.493104,
atlas_top: 0.709023,
atlas_left: 0.500000,
atlas_bottom: 221.500000,
atlas_right: 26.500000,
atlas_top: 179.500000,
},
{
ch: 'I',
@ -300,10 +300,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.165297,
plane_top: 0.709023,
atlas_left: 0.045703,
atlas_bottom: -0.008542,
atlas_right: 0.165297,
atlas_top: 0.709023,
atlas_left: 236.500000,
atlas_bottom: 137.500000,
atlas_right: 243.500000,
atlas_top: 95.500000,
},
{
ch: 'J',
@ -312,10 +312,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.399976,
plane_top: 0.709023,
atlas_left: 0.007024,
atlas_bottom: -0.025627,
atlas_right: 0.399976,
atlas_top: 0.709023,
atlas_left: 73.500000,
atlas_bottom: 95.500000,
atlas_right: 96.500000,
atlas_top: 52.500000,
},
{
ch: 'K',
@ -324,10 +324,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.495604,
plane_top: 0.709023,
atlas_left: 0.051396,
atlas_bottom: -0.008542,
atlas_right: 0.495604,
atlas_top: 0.709023,
atlas_left: 189.500000,
atlas_bottom: 179.500000,
atlas_right: 215.500000,
atlas_top: 137.500000,
},
{
ch: 'L',
@ -336,10 +336,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.423434,
plane_top: 0.709023,
atlas_left: 0.047566,
atlas_bottom: -0.008542,
atlas_right: 0.423434,
atlas_top: 0.709023,
atlas_left: 167.500000,
atlas_bottom: 179.500000,
atlas_right: 189.500000,
atlas_top: 137.500000,
},
{
ch: 'M',
@ -348,10 +348,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.631443,
plane_top: 0.709023,
atlas_left: 0.050557,
atlas_bottom: -0.008542,
atlas_right: 0.631443,
atlas_top: 0.709023,
atlas_left: 133.500000,
atlas_bottom: 179.500000,
atlas_right: 167.500000,
atlas_top: 137.500000,
},
{
ch: 'N',
@ -360,10 +360,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.510146,
plane_top: 0.709023,
atlas_left: 0.048854,
atlas_bottom: -0.008542,
atlas_right: 0.510146,
atlas_top: 0.709023,
atlas_left: 106.500000,
atlas_bottom: 179.500000,
atlas_right: 133.500000,
atlas_top: 137.500000,
},
{
ch: 'O',
@ -372,10 +372,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.506688,
plane_top: 0.726108,
atlas_left: 0.028312,
atlas_bottom: -0.025627,
atlas_right: 0.506688,
atlas_top: 0.726108,
atlas_left: 95.500000,
atlas_bottom: 44.500000,
atlas_right: 123.500000,
atlas_top: 0.500000,
},
{
ch: 'P',
@ -384,10 +384,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.457519,
plane_top: 0.709023,
atlas_left: 0.047481,
atlas_bottom: -0.008542,
atlas_right: 0.457519,
atlas_top: 0.709023,
atlas_left: 52.500000,
atlas_bottom: 179.500000,
atlas_right: 76.500000,
atlas_top: 137.500000,
},
{
ch: 'Q',
@ -396,10 +396,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.145222,
plane_right: 0.506688,
plane_top: 0.726108,
atlas_left: 0.028312,
atlas_bottom: -0.145222,
atlas_right: 0.506688,
atlas_top: 0.726108,
atlas_left: 12.500000,
atlas_bottom: 51.500000,
atlas_right: 40.500000,
atlas_top: 0.500000,
},
{
ch: 'R',
@ -408,10 +408,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.490604,
plane_top: 0.709023,
atlas_left: 0.046396,
atlas_bottom: -0.008542,
atlas_right: 0.490604,
atlas_top: 0.709023,
atlas_left: 26.500000,
atlas_bottom: 179.500000,
atlas_right: 52.500000,
atlas_top: 137.500000,
},
{
ch: 'S',
@ -420,10 +420,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.456604,
plane_top: 0.726108,
atlas_left: 0.012396,
atlas_bottom: -0.025627,
atlas_right: 0.456604,
atlas_top: 0.726108,
atlas_left: 123.500000,
atlas_bottom: 44.500000,
atlas_right: 149.500000,
atlas_top: 0.500000,
},
{
ch: 'T',
@ -432,10 +432,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.455104,
plane_top: 0.709023,
atlas_left: 0.010896,
atlas_bottom: -0.008542,
atlas_right: 0.455104,
atlas_top: 0.709023,
atlas_left: 0.500000,
atlas_bottom: 179.500000,
atlas_right: 26.500000,
atlas_top: 137.500000,
},
{
ch: 'U',
@ -444,10 +444,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.487604,
plane_top: 0.709023,
atlas_left: 0.043396,
atlas_bottom: -0.025627,
atlas_right: 0.487604,
atlas_top: 0.709023,
atlas_left: 121.500000,
atlas_bottom: 95.500000,
atlas_right: 147.500000,
atlas_top: 52.500000,
},
{
ch: 'V',
@ -456,10 +456,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.517273,
plane_top: 0.709023,
atlas_left: 0.004727,
atlas_bottom: -0.008542,
atlas_right: 0.517273,
atlas_top: 0.709023,
atlas_left: 184.500000,
atlas_bottom: 137.500000,
atlas_right: 214.500000,
atlas_top: 95.500000,
},
{
ch: 'W',
@ -468,10 +468,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.759868,
plane_top: 0.709023,
atlas_left: 0.008132,
atlas_bottom: -0.008542,
atlas_right: 0.759868,
atlas_top: 0.709023,
atlas_left: 140.500000,
atlas_bottom: 137.500000,
atlas_right: 184.500000,
atlas_top: 95.500000,
},
{
ch: 'X',
@ -480,10 +480,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.504231,
plane_top: 0.709023,
atlas_left: 0.008769,
atlas_bottom: -0.008542,
atlas_right: 0.504231,
atlas_top: 0.709023,
atlas_left: 111.500000,
atlas_bottom: 137.500000,
atlas_right: 140.500000,
atlas_top: 95.500000,
},
{
ch: 'Y',
@ -492,10 +492,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.518273,
plane_top: 0.709023,
atlas_left: 0.005727,
atlas_bottom: -0.008542,
atlas_right: 0.518273,
atlas_top: 0.709023,
atlas_left: 81.500000,
atlas_bottom: 137.500000,
atlas_right: 111.500000,
atlas_top: 95.500000,
},
{
ch: 'Z',
@ -504,10 +504,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.438561,
plane_top: 0.709023,
atlas_left: 0.011439,
atlas_bottom: -0.008542,
atlas_right: 0.438561,
atlas_top: 0.709023,
atlas_left: 56.500000,
atlas_bottom: 137.500000,
atlas_right: 81.500000,
atlas_top: 95.500000,
},
{
ch: 'a',
@ -516,10 +516,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.401976,
plane_top: 0.521089,
atlas_left: 0.009024,
atlas_bottom: -0.025627,
atlas_right: 0.401976,
atlas_top: 0.521089,
atlas_left: 114.500000,
atlas_bottom: 253.500000,
atlas_right: 137.500000,
atlas_top: 221.500000,
},
{
ch: 'b',
@ -528,10 +528,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.435976,
plane_top: 0.709023,
atlas_left: 0.043024,
atlas_bottom: -0.025627,
atlas_right: 0.435976,
atlas_top: 0.709023,
atlas_left: 147.500000,
atlas_bottom: 95.500000,
atlas_right: 170.500000,
atlas_top: 52.500000,
},
{
ch: 'c',
@ -540,10 +540,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.410976,
plane_top: 0.521089,
atlas_left: 0.018024,
atlas_bottom: -0.025627,
atlas_right: 0.410976,
atlas_top: 0.521089,
atlas_left: 24.500000,
atlas_bottom: 253.500000,
atlas_right: 47.500000,
atlas_top: 221.500000,
},
{
ch: 'd',
@ -552,10 +552,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.413976,
plane_top: 0.709023,
atlas_left: 0.021024,
atlas_bottom: -0.025627,
atlas_right: 0.413976,
atlas_top: 0.709023,
atlas_left: 209.500000,
atlas_bottom: 95.500000,
atlas_right: 232.500000,
atlas_top: 52.500000,
},
{
ch: 'e',
@ -564,10 +564,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.413976,
plane_top: 0.521089,
atlas_left: 0.021024,
atlas_bottom: -0.025627,
atlas_right: 0.413976,
atlas_top: 0.521089,
atlas_left: 69.500000,
atlas_bottom: 253.500000,
atlas_right: 92.500000,
atlas_top: 221.500000,
},
{
ch: 'f',
@ -576,10 +576,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.282679,
plane_top: 0.726108,
atlas_left: 0.009321,
atlas_bottom: -0.008542,
atlas_right: 0.282679,
atlas_top: 0.726108,
atlas_left: 193.500000,
atlas_bottom: 95.500000,
atlas_right: 209.500000,
atlas_top: 52.500000,
},
{
ch: 'g',
@ -588,10 +588,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.213561,
plane_right: 0.413476,
plane_top: 0.521089,
atlas_left: 0.020524,
atlas_bottom: -0.213561,
atlas_right: 0.413476,
atlas_top: 0.521089,
atlas_left: 170.500000,
atlas_bottom: 95.500000,
atlas_right: 193.500000,
atlas_top: 52.500000,
},
{
ch: 'h',
@ -600,10 +600,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.415434,
plane_top: 0.709023,
atlas_left: 0.039566,
atlas_bottom: -0.008542,
atlas_right: 0.415434,
atlas_top: 0.709023,
atlas_left: 214.500000,
atlas_bottom: 137.500000,
atlas_right: 236.500000,
atlas_top: 95.500000,
},
{
ch: 'i',
@ -612,10 +612,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.151797,
plane_top: 0.674853,
atlas_left: 0.032203,
atlas_bottom: -0.008542,
atlas_right: 0.151797,
atlas_top: 0.674853,
atlas_left: 176.500000,
atlas_bottom: 219.500000,
atlas_right: 183.500000,
atlas_top: 179.500000,
},
{
ch: 'j',
@ -624,10 +624,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.213561,
plane_right: 0.154009,
plane_top: 0.674853,
atlas_left: -0.051009,
atlas_bottom: -0.213561,
atlas_right: 0.154009,
atlas_top: 0.674853,
atlas_left: 0.500000,
atlas_bottom: 52.500000,
atlas_right: 12.500000,
atlas_top: 0.500000,
},
{
ch: 'k',
@ -636,10 +636,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.434976,
plane_top: 0.709023,
atlas_left: 0.042024,
atlas_bottom: -0.008542,
atlas_right: 0.434976,
atlas_top: 0.709023,
atlas_left: 232.500000,
atlas_bottom: 94.500000,
atlas_right: 255.500000,
atlas_top: 52.500000,
},
{
ch: 'l',
@ -648,10 +648,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.155297,
plane_top: 0.709023,
atlas_left: 0.035703,
atlas_bottom: -0.008542,
atlas_right: 0.155297,
atlas_top: 0.709023,
atlas_left: 49.500000,
atlas_bottom: 137.500000,
atlas_right: 56.500000,
atlas_top: 95.500000,
},
{
ch: 'm',
@ -660,10 +660,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.654528,
plane_top: 0.521089,
atlas_left: 0.039472,
atlas_bottom: -0.008542,
atlas_right: 0.654528,
atlas_top: 0.521089,
atlas_left: 169.500000,
atlas_bottom: 252.500000,
atlas_right: 205.500000,
atlas_top: 221.500000,
},
{
ch: 'n',
@ -672,10 +672,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.412434,
plane_top: 0.521089,
atlas_left: 0.036566,
atlas_bottom: -0.008542,
atlas_right: 0.412434,
atlas_top: 0.521089,
atlas_left: 183.500000,
atlas_bottom: 210.500000,
atlas_right: 205.500000,
atlas_top: 179.500000,
},
{
ch: 'o',
@ -684,10 +684,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.426019,
plane_top: 0.521089,
atlas_left: 0.015981,
atlas_bottom: -0.025627,
atlas_right: 0.426019,
atlas_top: 0.521089,
atlas_left: 0.500000,
atlas_bottom: 253.500000,
atlas_right: 24.500000,
atlas_top: 221.500000,
},
{
ch: 'p',
@ -696,10 +696,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.213561,
plane_right: 0.435976,
plane_top: 0.521089,
atlas_left: 0.043024,
atlas_bottom: -0.213561,
atlas_right: 0.435976,
atlas_top: 0.521089,
atlas_left: 0.500000,
atlas_bottom: 95.500000,
atlas_right: 23.500000,
atlas_top: 52.500000,
},
{
ch: 'q',
@ -708,10 +708,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.213561,
plane_right: 0.413976,
plane_top: 0.521089,
atlas_left: 0.021024,
atlas_bottom: -0.213561,
atlas_right: 0.413976,
atlas_top: 0.521089,
atlas_left: 224.500000,
atlas_bottom: 43.500000,
atlas_right: 247.500000,
atlas_top: 0.500000,
},
{
ch: 'r',
@ -720,10 +720,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.294637,
plane_top: 0.521089,
atlas_left: 0.038363,
atlas_bottom: -0.008542,
atlas_right: 0.294637,
atlas_top: 0.521089,
atlas_left: 240.500000,
atlas_bottom: 168.500000,
atlas_right: 255.500000,
atlas_top: 137.500000,
},
{
ch: 's',
@ -732,10 +732,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.386934,
plane_top: 0.521089,
atlas_left: 0.011066,
atlas_bottom: -0.025627,
atlas_right: 0.386934,
atlas_top: 0.521089,
atlas_left: 47.500000,
atlas_bottom: 253.500000,
atlas_right: 69.500000,
atlas_top: 221.500000,
},
{
ch: 't',
@ -744,10 +744,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.277679,
plane_top: 0.657768,
atlas_left: 0.004321,
atlas_bottom: -0.025627,
atlas_right: 0.277679,
atlas_top: 0.657768,
atlas_left: 160.500000,
atlas_bottom: 219.500000,
atlas_right: 176.500000,
atlas_top: 179.500000,
},
{
ch: 'u',
@ -756,10 +756,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.025627,
plane_right: 0.405434,
plane_top: 0.521089,
atlas_left: 0.029566,
atlas_bottom: -0.025627,
atlas_right: 0.405434,
atlas_top: 0.521089,
atlas_left: 92.500000,
atlas_bottom: 253.500000,
atlas_right: 114.500000,
atlas_top: 221.500000,
},
{
ch: 'v',
@ -768,10 +768,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.423061,
plane_top: 0.521089,
atlas_left: -0.004061,
atlas_bottom: -0.008542,
atlas_right: 0.423061,
atlas_top: 0.521089,
atlas_left: 144.500000,
atlas_bottom: 252.500000,
atlas_right: 169.500000,
atlas_top: 221.500000,
},
{
ch: 'w',
@ -780,10 +780,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.653613,
plane_top: 0.521089,
atlas_left: 0.004387,
atlas_bottom: -0.008542,
atlas_right: 0.653613,
atlas_top: 0.521089,
atlas_left: 205.500000,
atlas_bottom: 210.500000,
atlas_right: 243.500000,
atlas_top: 179.500000,
},
{
ch: 'x',
@ -792,10 +792,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.411019,
plane_top: 0.521089,
atlas_left: 0.000981,
atlas_bottom: -0.008542,
atlas_right: 0.411019,
atlas_top: 0.521089,
atlas_left: 205.500000,
atlas_bottom: 252.500000,
atlas_right: 229.500000,
atlas_top: 221.500000,
},
{
ch: 'y',
@ -804,10 +804,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.213561,
plane_right: 0.424561,
plane_top: 0.521089,
atlas_left: -0.002561,
atlas_bottom: -0.213561,
atlas_right: 0.424561,
atlas_top: 0.521089,
atlas_left: 96.500000,
atlas_bottom: 95.500000,
atlas_right: 121.500000,
atlas_top: 52.500000,
},
{
ch: 'z',
@ -816,10 +816,10 @@ static immutable FontAtlas FONT_ATLAS = {
plane_bottom: -0.008542,
plane_right: 0.377934,
plane_top: 0.521089,
atlas_left: 0.002066,
atlas_bottom: -0.008542,
atlas_right: 0.377934,
atlas_top: 0.521089,
atlas_left: 229.500000,
atlas_bottom: 252.500000,
atlas_right: 251.500000,
atlas_top: 221.500000,
},
],
};

View File

@ -113,9 +113,9 @@ InitGame(PlatformWindow* window)
int width, height, has_ch;
auto img = stbi_load_from_memory(atlas.ptr, cast(int)atlas.length, &width, &height, &has_ch, 4);
assert(width == FONT_ATLAS.width && height == FONT_ATLAS.height && has_ch == 1, "atlas height and width do not match");
u8[] img_slice = img[0 .. width * height];
u8[] img_slice = img[0 .. width * height * 4];
CreateImageView(&g.rd, &g.font_tex, FONT_ATLAS.width, FONT_ATLAS.height, 1, img_slice);
CreateImageView(&g.rd, &g.font_tex, FONT_ATLAS.width, FONT_ATLAS.height, 4, img_slice);
CreateImageView(&g.rd, &g.default_tex, 16, 16, 4, white_tex);
WriteGUI(&g.rd, g.ui_desc_set, &g.font_tex);
@ -176,7 +176,7 @@ Cycle(Game* g)
Reset(&g.frame_arena);
DrawRect(g, 500.0, 500.0, 800.0, 800.0, Vec4(0.2, 0.3, 0.7, 1.0));
DrawText(g, 200.0, 200.0, 32.0, "Test");
DrawText(g, 200.0, 200.0, 32.0, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
BeginFrame(&g.rd);
@ -332,12 +332,18 @@ DrawText(Game* g, f32 x, f32 y, f32 px, string str)
f32 w = px * (glyph.plane_right - glyph.plane_left);
f32 h = px * (glyph.plane_bottom - glyph.plane_top);
f32 y_pos = px * glyph.plane_top;
f32 y_pos = px * glyph.plane_bottom;
v.dst_start.x = x_pos;
v.dst_start.y = y + y_pos;
v.dst_start.y = y + h - y_pos;
v.dst_end.x = x_pos + w;
v.dst_end.y = y + h;
v.dst_end.y = y - y_pos;
v.src_start.x = glyph.atlas_left;
v.src_start.y = glyph.atlas_top;
v.src_end.x = glyph.atlas_right;
v.src_end.y = glyph.atlas_bottom;
v.col = Vec4(1.0, 1.0, 1.0, 1.0);
x_pos += px * glyph.advance;
@ -366,9 +372,9 @@ DrawRect(Game* g, f32 p0_x, f32 p0_y, f32 p1_x, f32 p1_y, Vec4 col)
{
// Y reversed
g.ui_vertex_buf[g.ui_count].dst_start.x = p0_x;
g.ui_vertex_buf[g.ui_count].dst_start.y = p1_y;
g.ui_vertex_buf[g.ui_count].dst_start.y = p0_y;
g.ui_vertex_buf[g.ui_count].dst_end.x = p1_x;
g.ui_vertex_buf[g.ui_count].dst_end.y = p0_y;
g.ui_vertex_buf[g.ui_count].dst_end.y = p1_y;
g.ui_vertex_buf[g.ui_count].col = col;
AddUIIndices(g);

View File

@ -1638,6 +1638,13 @@ InitFramebufferAndRenderPass(Vulkan* vk)
VkResult result = vkCreateRenderPass(vk.device, &pass_info, null, &vk.render_pass);
VkCheckA("vkCreateRenderPass failure", result);
CreateFramebuffer(vk);
}
void
CreateFramebuffer(Vulkan* vk)
{
VkFramebufferCreateInfo framebuffer_info = {
sType: VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,
renderPass: vk.render_pass,
@ -1648,7 +1655,7 @@ InitFramebufferAndRenderPass(Vulkan* vk)
layers: 1,
};
result = vkCreateFramebuffer(vk.device, &framebuffer_info, null, &vk.framebuffer);
VkResult result = vkCreateFramebuffer(vk.device, &framebuffer_info, null, &vk.framebuffer);
VkCheckA("vkCreateFramebuffer failure", result);
}
@ -1678,7 +1685,7 @@ CreateGraphicsPipeline(Vulkan* vk, GfxPipelineInfo* build_info)
cullMode: VK_CULL_MODE_BACK_BIT,
polygonMode: VK_POLYGON_MODE_FILL,
lineWidth: 1.0,
frontFace: VK_FRONT_FACE_COUNTER_CLOCKWISE,
frontFace: VK_FRONT_FACE_CLOCKWISE,
};
VkPipelineMultisampleStateCreateInfo multisample_info = {
@ -2547,10 +2554,12 @@ RecreateSwapchain(Vulkan* vk)
Destroy(vk.swapchain, vk.present_images, vk.device);
Destroy(vk, &vk.draw_image);
Destroy(vk, &vk.depth_image);
vkDestroyFramebuffer(vk.device, vk.framebuffer, null);
CreateSwapchain(vk);
CreateDrawImages(vk);
WriteDrawImageDesc(vk);
CreateFramebuffer(vk);
}
bool

View File

@ -91,10 +91,10 @@ CodegenFontLookup()
glyph.plane_right = val["planeBounds"]["right"].floating;
glyph.plane_top = val["planeBounds"]["top"].floating;
glyph.atlas_left = val["planeBounds"]["left"].floating;
glyph.atlas_bottom = val["planeBounds"]["bottom"].floating;
glyph.atlas_right = val["planeBounds"]["right"].floating;
glyph.atlas_top = val["planeBounds"]["top"].floating;
glyph.atlas_left = val["atlasBounds"]["left"].floating;
glyph.atlas_bottom = val["atlasBounds"]["bottom"].floating;
glyph.atlas_right = val["atlasBounds"]["right"].floating;
glyph.atlas_top = val["atlasBounds"]["top"].floating;
}
atlas.glyphs ~= glyph;
@ -133,9 +133,9 @@ CodegenFontLookup()
f.writefln("\t\t\tplane_top: %f,", g.plane_top);
f.writefln("\t\t\tatlas_left: %f,", g.atlas_left);
f.writefln("\t\t\tatlas_bottom: %f,", g.atlas_bottom);
f.writefln("\t\t\tatlas_bottom: %f,", atlas.height - g.atlas_bottom);
f.writefln("\t\t\tatlas_right: %f,", g.atlas_right);
f.writefln("\t\t\tatlas_top: %f,", g.atlas_top);
f.writefln("\t\t\tatlas_top: %f,", atlas.height - g.atlas_top);
}
f.writeln("\t\t},");

View File

@ -15,5 +15,5 @@ layout (location = 0) out vec4 FragColor;
void main()
{
vec4 tex_color = texture(sampler2D(SpriteAtlas, SamplerNearest), FragData.uv);
FragColor = FragData.color;// * tex_color;
FragColor = FragData.color * tex_color;
}

View File

@ -40,12 +40,16 @@ void main()
vec2 src_center = (in_src_end + in_src_start) / 2;
vec2 src_pos = (Vertices[gl_VertexIndex] * src_half_size + src_center);
FragData.color = in_col;
FragData.uv = vec2(
in_src_start.x / tex_size.x,
in_src_start.y / tex_size.y
vec2 uvs[4] = vec2[4](
vec2(in_src_start.x, in_src_end.y),
vec2(in_src_start.x, in_src_start.y),
vec2(in_src_end.x, in_src_end.y),
vec2(in_src_end.x, in_src_start.y)
);
FragData.color = in_col;
FragData.uv = uvs[gl_VertexIndex] / tex_size;
gl_Position = vec4(2 * dst_pos.x / PC.res.x - 1,
2 * dst_pos.y / PC.res.y - 1,
0,