Start of font preparation

This commit is contained in:
Simon Lübeß
2022-01-07 18:42:43 +01:00
parent 5373d92297
commit e292029015
6 changed files with 381 additions and 4 deletions
+28 -1
View File
@@ -34,6 +34,8 @@ namespace Sandbox
ColorRGBA _squareColor0 = ColorRGBA.CornflowerBlue;
ColorRGBA _squareColor1;
DepthStencilState _depthStencilState ~ _.ReleaseRef();
[AllowAppend]
public this() : base("Example")
{
@@ -78,8 +80,20 @@ namespace Sandbox
_textureViewer = new TextureViewer();
cameraController = new OrthographicCameraController(16 / 9f);
DepthStencilStateDescription dssDesc = .()
{
DepthEnabled = false
};
_depthStencilState = new DepthStencilState(dssDesc);
File.ReadAllText("lorem.txt", text);
prepText = FontRenderer.PrepareText(fonty, text, 64, .White, .White);
}
String text = new .() ~ delete _;
public override void Update(GameTime gameTime)
{
cameraController.Update(gameTime);
@@ -99,6 +113,7 @@ namespace Sandbox
Renderer2D.BeginScene(cameraController.Camera, .BackToFront);
RenderCommand.SetBlendState(_alphaBlendState);
RenderCommand.SetDepthStencilState(_depthStencilState);
for(int x < 10)
for(int y < 10)
@@ -115,11 +130,23 @@ namespace Sandbox
Renderer2D.DrawCircle(Vector3(-2, -2, -2f), Vector2(1), .GreenYellow);
//FontRenderer.DrawText(fonty.Fallback.Fallback.Fallback.Fallback, "Hallö! gjy ÄAwww www <--||-->", 0, 0, 64, .White, .White); // Hallo! gjy
FontRenderer.DrawText(fonty, "Hallö!\n gjy ÄAwww www <--||-->", 0, 0, 128, .White, .White);
//FontRenderer.DrawText(fonty, "Hallö!\n gjy ÄAwww www <--||-->", 0, 0, 128, .White, .White);
//FontRenderer.DrawText(fonty, text, 0, 0, 64, .White, .White);
//var prepared = FontRenderer.PrepareText(fonty,"Hallö!\n gjy ÄA\n\nwww www <--||-->", 64, .White, .White);
//var prepared = FontRenderer.PrepareText(fonty, text, 64, .White, .White);
//var prepared = FontRenderer.PrepareText(fonty,"A\nB", 64, .White, .White);
//FontRenderer.DrawText(prepared, 0, 0);
FontRenderer.DrawText(prepText, 0, 0);
//prepared.ReleaseRef();
Renderer2D.EndScene();
}
FontRenderer.PreparedText prepText ~ _.ReleaseRef();
float innerRadius = 0.5f;
public override void OnEvent(Event event)