SoundInstance changes, small updates in Sound and Texture2d loaders.

This commit is contained in:
2024-08-22 22:07:27 +02:00
parent 912de8a5ef
commit 06814a678e
8 changed files with 39 additions and 17 deletions

View File

@@ -47,6 +47,8 @@ public class TestGame : Game
_uiLayer = new UiLayer();
_worldLayer = new EntityLayer();
_testSoundInstance = _audioBackend!.CreateInstance(_testSound!);
Input.AddInputMapping("play", new InputAction[] { new KeyInputAction(KeyboardKey.Spacebar) });
Input.AddInputMapping("sprint", new InputAction[] { new KeyInputAction(KeyboardKey.LeftShift) });
Input.AddInputMapping("toggle_fullscreen", new InputAction[] { new KeyInputAction(KeyboardKey.F11) });
@@ -64,6 +66,13 @@ public class TestGame : Game
{
while (_scene!.ShouldRun)
{
if (Input.IsActionPressed("play"))
{
_testSoundInstance!.PitchVariation(0.9f, 1.1f)
.VolumeVariation(0.98f, 1.02f);
_testSoundInstance!.Play();
}
_scene.Update();
_scene.BeginDraw();
_scene.EndDraw();
@@ -77,6 +86,7 @@ public class TestGame : Game
}
private Sound? _testSound;
private SoundInstance? _testSoundInstance;
private Font? _font;
private FmodAudioBackend? _audioBackend;
private Scene? _scene;