Correct display of initial grid

This commit is contained in:
Starbeamrainbowlabs 2017-12-02 16:44:12 +00:00
parent ff1fb90351
commit b80c5bba6c
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
3 changed files with 15 additions and 9 deletions

View File

@ -19,7 +19,7 @@ namespace MusicBoxConverter
private int trackLength;
public int TrackLength {
get {
if(trackLength == null)
if(trackLength == 0)
trackLength = (int)AllNotes().Max((Note arg) => arg.Time);
return trackLength;
}
@ -34,13 +34,17 @@ namespace MusicBoxConverter
public void Output(string destinationFilename)
{
SvgWriter svg = new SvgWriter(destinationFilename);
svg.WriteRectangle(offset, new Vector2(TrackLength, 128).Multiply(scaleFactor));
for(int i = 0; i < 255; i += 5)
Vector2 area = new Vector2(TrackLength, 128).Multiply(scaleFactor);
Vector2 size = area.Add(offset.Multiply(2));
SvgWriter svg = new SvgWriter(destinationFilename, size.X.ToString(), size.Y.ToString());
Console.WriteLine(0b1111111);
for(int i = 0; i < 127; i += 5)
{
Vector2 start = offset.Add(new Vector2(0, i));
svg.WriteLine(start, start.Add(new Vector2(TrackLength, 0)));
Vector2 start = offset.Add(new Vector2(0, i * scaleFactor.Y));
svg.WriteLine(start, start.Add(new Vector2(TrackLength * scaleFactor.X, 0)));
}
svg.WriteRectangle(offset, area);
foreach(Note note in AllNotes())
{

View File

@ -17,6 +17,7 @@ namespace MusicBoxConverter
);
xml.WriteStartDocument();
xml.WriteDocType("svg", "-//W3C//DTD SVG 1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd", null);
xml.WriteStartElement("svg", "http://www.w3.org/2000/svg");
xml.WriteAttributeString("version", "1.1");
xml.WriteAttributeString("width", widthspec);
@ -41,6 +42,7 @@ namespace MusicBoxConverter
xml.WriteAttributeString("d", pathData);
xml.WriteAttributeString("stroke", strokeStyle);
xml.WriteAttributeString("stroke-width", strokeWidth.ToString());
xml.WriteAttributeString("fill", "transparent");
xml.WriteEndElement();
}

View File

@ -39,14 +39,14 @@ namespace SBRL.Utilities
{
return new Vector2(
X + b.X,
Y + b.X
Y + b.Y
);
}
public Vector2 Subtract(Vector2 b)
{
return new Vector2(
X - b.X,
Y - b.X
Y - b.Y
);
}
public Vector2 Divide(int b)