From f45f4362d5b652090700eae8a414e19a75ccdbb3 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Wed, 24 Apr 2024 23:07:33 +0100 Subject: [PATCH] Add generated font to sandbox scene --- indigo/build.sbt | 20 +++++++++- indigo/sandbox/assets/generated/TestFont.png | Bin 0 -> 1262 bytes .../com/example/sandbox/SandboxAssets.scala | 4 ++ .../com/example/sandbox/SandboxGame.scala | 37 +++++++++--------- .../example/sandbox/scenes/TextScene.scala | 5 ++- 5 files changed, 46 insertions(+), 20 deletions(-) create mode 100644 indigo/sandbox/assets/generated/TestFont.png diff --git a/indigo/build.sbt b/indigo/build.sbt index a0b72a565..a39b649ed 100644 --- a/indigo/build.sbt +++ b/indigo/build.sbt @@ -125,7 +125,25 @@ lazy val sandbox = IndigoOptions.defaults .withTitle("Sandbox") .withBackgroundColor("black") - .withAssetDirectory("sandbox/assets/") + .withAssetDirectory("sandbox/assets/"), + Compile / sourceGenerators += Def.task { + IndigoGenerators("example") + .embedFont( + "TestFont", + os.pwd / "sandbox" / "assets" / "fonts" / "pixelated.ttf", + indigoplugin.generators + .FontOptions( + "test font", + 32, + indigoplugin.generators.CharSet.fromUniqueString("The quick brown fox\njumps over the\nlazy dog.") + ) + .withColor(indigoplugin.generators.RGB.White) + .withMaxCharactersPerLine(16) + .noAntiAliasing, + os.pwd / "sandbox" / "assets" / "generated" + ) + .toSourceFiles((Compile / sourceManaged).value) + } ) lazy val perf = diff --git a/indigo/sandbox/assets/generated/TestFont.png b/indigo/sandbox/assets/generated/TestFont.png new file mode 100644 index 0000000000000000000000000000000000000000..4ba2c0acd6364af661bc82a178e3a762adce00e2 GIT binary patch literal 1262 zcmb`HQEb~p7{{X(DB3ioZ%9a8_JGJk#3B$A2uQu60BwP0N;erONsDNNLM1w(bjji+ zDey4H146B;qD{;Kk(n;gFe@FbuHyni5M|SVEQ^vXaV1zMyRkjWY^%Q7<{X~(vl*ucL<(ZxB&9OYE=VpA z%J1%1#l;G*2I=gjtvorhwqyD>DeODik72x(Y#xZ4{2nZwR8JiR$(pM{c+P7*0`rpn zbbT*^b;*LbwnMf**@_63&2r{AFjaedK-OrL1kHS-78}|y6a-ue? zm7$EV8H#_R<)EzND%9_nEC!Qv^l2LQi1IT_POeSCj~}iUd;W%6QN9t%!rPLST&1jr zQ67al2z`$0)tNO_pD?+#Mfre!GTBrM$wD6a`t)P?~5Oxte=kiW$f z+8lx_|7UYZkV1l*?f;fGIr||^m#Z9piBnk^MeZ#6*x_xn(F*vnR`j0)nd(M9Y-JC_ z>KVjdmDa$R`Bbv24QAb$+C{P#)q*j(wVPyWoLcc2&x|oAr5U}x)p>Sm