do not send frames when nothing changes
This commit is contained in:
parent
89494ef495
commit
de3d298475
5 changed files with 54 additions and 13 deletions
|
@ -13,6 +13,7 @@ internal sealed class SendToServicePointDisplay : ITickStep
|
|||
private readonly PlayerServer _players;
|
||||
private readonly ILogger<SendToServicePointDisplay> _logger;
|
||||
private readonly IDisplayConnection _displayConnection;
|
||||
private PixelGrid? _lastSentFrame;
|
||||
|
||||
private DateTime _nextFailLog = DateTime.Now;
|
||||
|
||||
|
@ -50,7 +51,12 @@ internal sealed class SendToServicePointDisplay : ITickStep
|
|||
try
|
||||
{
|
||||
await _displayConnection.SendCp437DataAsync(MapService.TilesPerRow, 0, _scoresBuffer);
|
||||
await _displayConnection.SendBitmapLinearWindowAsync(0, 0, _lastFinishedFrameProvider.LastFrame);
|
||||
|
||||
var currentFrame = _lastFinishedFrameProvider.LastFrame;
|
||||
if (_lastSentFrame == currentFrame)
|
||||
return;
|
||||
_lastSentFrame = currentFrame;
|
||||
await _displayConnection.SendBitmapLinearWindowAsync(0, 0, _lastSentFrame);
|
||||
}
|
||||
catch (SocketException ex)
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
"MoveSpeed": 1.4,
|
||||
"TurnSpeed": 0.4,
|
||||
"ShootDelayMs": 400,
|
||||
"BulletSpeed": 8
|
||||
"BulletSpeed": 3
|
||||
},
|
||||
"Players": {
|
||||
"SpawnDelayMs": 3000,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue