Skip to content

Commit

Permalink
Added dotsize parameter to DmdDevice.ini (#68).
Browse files Browse the repository at this point in the history
  • Loading branch information
freezy committed Sep 29, 2017
1 parent 320deeb commit 13ee654
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
19 changes: 14 additions & 5 deletions LibDmd/Output/Virtual/VirtualDmdControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ public partial class VirtualDmdControl : IRgb24Destination, IBitmapDestination,

public bool IsAvailable { get; } = true;

public double DotSize { get; set; } = 1;
public double DotSize {
get { return _dotSize; }
set { _dotSize = value; UpdateEffectParams(); }
}

public IDmdWindow Host { set; get; }
public bool IgnoreAspectRatio {
Expand All @@ -35,6 +38,7 @@ public bool IgnoreAspectRatio {
private double _sat;
private double _lum;

private double _dotSize = 1.0;
private Color[] _gray2Palette;
private Color[] _gray4Palette;

Expand Down Expand Up @@ -99,12 +103,17 @@ public void SetDimensions(int width, int height)
Logger.Info("Resizing virtual DMD to {0}x{1}", width, height);
DmdWidth = width;
DmdHeight = height;
UpdateEffectParams();
Host.SetDimensions(width, height);
}

private void UpdateEffectParams()
{
Dispatcher.Invoke(() => {
Effect.AspectRatio = (double)width / height;
Effect.BlockCount = Math.Max(width, height);
Effect.Max = Effect.AspectRatio * 0.47 * DotSize;
Effect.AspectRatio = (double)DmdWidth / DmdHeight;
Effect.BlockCount = Math.Max(DmdWidth, DmdHeight);
Effect.Max = Effect.AspectRatio * 0.47 * _dotSize;
});
Host.SetDimensions(width, height);
}

public void SetColor(Color color)
Expand Down
1 change: 1 addition & 0 deletions PinMameDevice/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public class VirtualDmdConfig : AbstractConfiguration
public double Top => GetDouble("top", 0);
public double Width => GetDouble("width", 1024);
public double Height => GetDouble("height", 256);
public double DotSize => GetDouble("dotsize", 1.0);

public VirtualDmdConfig(IniData data, Configuration parent) : base(data, parent)
{
Expand Down
2 changes: 2 additions & 0 deletions PinMameDevice/DmdDevice.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ top = 0
width = 1024
; height of the dmd in monitor pixels
height = 256
; scale the dot size (set to 0.8 for same size as pre-1.6.0)
dotsize = 1.0

[pindmd1]
; if false, doesn't bother looking for a pinDMD1
Expand Down
1 change: 1 addition & 0 deletions PinMameDevice/DmdExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ private void SetupVirtualDmd()
_dmd.IgnoreAspectRatio = _config.VirtualDmd.IgnoreAr;
_dmd.AlwaysOnTop = _config.VirtualDmd.StayOnTop;
_dmd.GripColor = _config.VirtualDmd.HideGrip ? Brushes.Transparent : Brushes.White;
_dmd.DotSize = _config.VirtualDmd.DotSize;

// find the game's dmd position in VPM's registry
if (_config.VirtualDmd.UseRegistryPosition) {
Expand Down

0 comments on commit 13ee654

Please sign in to comment.