tanks can spawn and get rendered
This commit is contained in:
parent
151cad4cee
commit
a3bd582b2e
1 changed files with 283 additions and 105 deletions
|
|
@ -3,13 +3,21 @@ using Microsoft.Extensions.Options;
|
|||
|
||||
namespace TanksServer.Services;
|
||||
|
||||
internal sealed class ServicePointDisplay(IOptions<ServicePointDisplayConfiguration> options)
|
||||
internal sealed class ServicePointDisplay(
|
||||
IOptions<ServicePointDisplayConfiguration> options,
|
||||
PixelDrawer drawer
|
||||
) : ITickStep, IDisposable
|
||||
{
|
||||
private readonly UdpClient _udpClient = new(options.Value.Hostname, options.Value.Port);
|
||||
|
||||
public ValueTask<int> Send(DisplayPixelBuffer buffer)
|
||||
public Task TickAsync()
|
||||
{
|
||||
return _udpClient.SendAsync(buffer.Data);
|
||||
return _udpClient.SendAsync(drawer.LastFrame.Data).AsTask();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_udpClient.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue