WIP: fonts.
This commit is contained in:
@@ -32,12 +32,18 @@ public class TestGame : Game
|
||||
{
|
||||
_resourceManager.TryGetResource<Sound>("my_sound", out _testSound);
|
||||
}
|
||||
|
||||
if (_resourceManager.TryLoad<Font>("inter_regular", "fonts/Inter-Regular.ttf"))
|
||||
{
|
||||
_resourceManager.TryGetResource<Font>("inter_regular", out _font);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Ready()
|
||||
{
|
||||
_audioBackend.AddBusEffect<AudioEffectReverb>(new AudioEffectReverb());
|
||||
_inputHandler.AddInputMapping("play", new InputAction[] { new KeyInputAction(KeyboardKey.Spacebar) });
|
||||
_fontHandle = _renderer.LoadFont(_font);
|
||||
}
|
||||
|
||||
protected override void Run()
|
||||
@@ -59,6 +65,9 @@ public class TestGame : Game
|
||||
|
||||
_renderer.SetTransform(new Vector2(640, 480));
|
||||
_renderer.DrawCircle(16f, Color.Chocolate);
|
||||
|
||||
_renderer.DrawText(_fontHandle, "Hello World!", 24, Color.White);
|
||||
|
||||
_renderer.EndFrame();
|
||||
}
|
||||
}
|
||||
@@ -72,6 +81,8 @@ public class TestGame : Game
|
||||
private Renderer _renderer;
|
||||
private ResourceManager _resourceManager = new();
|
||||
private Sound? _testSound;
|
||||
private Font? _font;
|
||||
private int _fontHandle;
|
||||
private FmodAudioBackend _audioBackend;
|
||||
private InputHandler _inputHandler;
|
||||
}
|
||||
Reference in New Issue
Block a user