Correct display of initial grid
This commit is contained in:
parent
ff1fb90351
commit
b80c5bba6c
3 changed files with 15 additions and 9 deletions
|
@ -19,7 +19,7 @@ namespace MusicBoxConverter
|
||||||
private int trackLength;
|
private int trackLength;
|
||||||
public int TrackLength {
|
public int TrackLength {
|
||||||
get {
|
get {
|
||||||
if(trackLength == null)
|
if(trackLength == 0)
|
||||||
trackLength = (int)AllNotes().Max((Note arg) => arg.Time);
|
trackLength = (int)AllNotes().Max((Note arg) => arg.Time);
|
||||||
return trackLength;
|
return trackLength;
|
||||||
}
|
}
|
||||||
|
@ -34,13 +34,17 @@ namespace MusicBoxConverter
|
||||||
|
|
||||||
public void Output(string destinationFilename)
|
public void Output(string destinationFilename)
|
||||||
{
|
{
|
||||||
SvgWriter svg = new SvgWriter(destinationFilename);
|
Vector2 area = new Vector2(TrackLength, 128).Multiply(scaleFactor);
|
||||||
svg.WriteRectangle(offset, new Vector2(TrackLength, 128).Multiply(scaleFactor));
|
Vector2 size = area.Add(offset.Multiply(2));
|
||||||
for(int i = 0; i < 255; i += 5)
|
|
||||||
|
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));
|
Vector2 start = offset.Add(new Vector2(0, i * scaleFactor.Y));
|
||||||
svg.WriteLine(start, start.Add(new Vector2(TrackLength, 0)));
|
svg.WriteLine(start, start.Add(new Vector2(TrackLength * scaleFactor.X, 0)));
|
||||||
}
|
}
|
||||||
|
svg.WriteRectangle(offset, area);
|
||||||
|
|
||||||
foreach(Note note in AllNotes())
|
foreach(Note note in AllNotes())
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace MusicBoxConverter
|
||||||
);
|
);
|
||||||
|
|
||||||
xml.WriteStartDocument();
|
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.WriteStartElement("svg", "http://www.w3.org/2000/svg");
|
||||||
xml.WriteAttributeString("version", "1.1");
|
xml.WriteAttributeString("version", "1.1");
|
||||||
xml.WriteAttributeString("width", widthspec);
|
xml.WriteAttributeString("width", widthspec);
|
||||||
|
@ -41,6 +42,7 @@ namespace MusicBoxConverter
|
||||||
xml.WriteAttributeString("d", pathData);
|
xml.WriteAttributeString("d", pathData);
|
||||||
xml.WriteAttributeString("stroke", strokeStyle);
|
xml.WriteAttributeString("stroke", strokeStyle);
|
||||||
xml.WriteAttributeString("stroke-width", strokeWidth.ToString());
|
xml.WriteAttributeString("stroke-width", strokeWidth.ToString());
|
||||||
|
xml.WriteAttributeString("fill", "transparent");
|
||||||
xml.WriteEndElement();
|
xml.WriteEndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,14 +39,14 @@ namespace SBRL.Utilities
|
||||||
{
|
{
|
||||||
return new Vector2(
|
return new Vector2(
|
||||||
X + b.X,
|
X + b.X,
|
||||||
Y + b.X
|
Y + b.Y
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
public Vector2 Subtract(Vector2 b)
|
public Vector2 Subtract(Vector2 b)
|
||||||
{
|
{
|
||||||
return new Vector2(
|
return new Vector2(
|
||||||
X - b.X,
|
X - b.X,
|
||||||
Y - b.X
|
Y - b.Y
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
public Vector2 Divide(int b)
|
public Vector2 Divide(int b)
|
||||||
|
|
Loading…
Reference in a new issue