Bitmap font system works.

This commit is contained in:
2020-07-03 18:07:55 -05:00
parent 378712283a
commit ad77fec3a2
8 changed files with 268 additions and 222 deletions

View File

@@ -24,6 +24,7 @@ namespace SlatedGameToolkit.Tools.Utilities.Playground
private BitmapFont font;
private Texture logoTexture, fillerTexture;
private RectangleMesh logo, textureTester, untextured;
private string lastPressed;
public WindowContext CurrentWindow { get { return window;}}
@@ -78,6 +79,7 @@ namespace SlatedGameToolkit.Tools.Utilities.Playground
untextured.Y = - 0.15f;
font = new BitmapFont("Resources/Playground/earwig_factory_rg.ttf");
font.PixelHeight = 128;
}
public void Render(double delta)
@@ -86,8 +88,8 @@ namespace SlatedGameToolkit.Tools.Utilities.Playground
renderer.Draw(logo);
renderer.Draw(textureTester);
renderer.Draw(untextured);
font.Draw(renderer, delta, 0.25f, -0.25f, "1234", Color.White);
font.Draw(renderer, delta, 0.25f, -0.35f, "abcd", Color.White);
font.Draw(renderer, 0.25f, -0.35f, "ABCDEFHIJKLMNOPQRSTUVWXYZ1234567890", Color.White);
renderer.Draw(new RectangleMesh(new RectangleF(-1, -1, 0.5f, 0.5f), new RectangleF(0, 1, 1, -1), font.GetTextureBacking(0), Color.White));
renderer.End();
}
@@ -106,5 +108,9 @@ namespace SlatedGameToolkit.Tools.Utilities.Playground
camera.MoveTo += new Vector2((0.25f) * (float) timeStep, 0);
}
}
public void KeyPressed(SDL.SDL_Keycode keycode, bool pressed) {
if (pressed) lastPressed = SDL.SDL_GetKeyName(keycode);
}
}
}