-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathInputExample.cs
More file actions
30 lines (26 loc) · 883 Bytes
/
InputExample.cs
File metadata and controls
30 lines (26 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
namespace Pollus.Examples;
using Pollus.Debugging;
using Pollus.ECS;
using Pollus.Engine;
using Pollus.Input;
public class InputExample : IExample
{
public string Name => "input";
IApplication? application;
public void Stop() => application?.Shutdown();
public void Run()
{
application = Application.Builder
.AddPlugin<InputPlugin>()
.AddSystems(CoreStage.Update, FnSystem.Create("Update",
static (EventReader<ButtonEvent<Key>> eKeys, ButtonInput<Key> directInput) =>
{
foreach (var key in eKeys.Read())
{
Log.Info($"Key {key.Button} {(key.State == ButtonState.JustReleased ? "released" : "pressed")}");
}
}))
.Build();
application.Run();
}
}