Remove DrawLines (was not working in D3D and can actually be replaced by narrow DrawRects)
This commit is contained in:
1 parent
538eab9516
commit
926dda7350
8 files changed
+6
-88
No files matched your search
@@ -279,40 +279,6 @@ namespace Vocaluxe.Base
|
||||
return _Draw.GetTextureCount();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws a simple line
|
||||
/// </summary>
|
||||
/// <param name="color"></param>
|
||||
/// <param name="w">Width of the line</param>
|
||||
/// <param name="x1"></param>
|
||||
/// <param name="y1"></param>
|
||||
/// <param name="x2"></param>
|
||||
/// <param name="y2"></param>
|
||||
public static void DrawLine(SColorF color, float w, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
_Draw.DrawLine(color, w, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the outline of a rectangle
|
||||
/// </summary>
|
||||
/// <param name="color"></param>
|
||||
/// <param name="rect"></param>
|
||||
/// <param name="thickness">Width of the lines</param>
|
||||
public static void DrawRectOutline(SColorF color, SRectF rect, float thickness)
|
||||
{
|
||||
if (thickness <= 0f)
|
||||
return;
|
||||
int x1 = (int)rect.X;
|
||||
int x2 = (int)(rect.X + rect.W);
|
||||
int y1 = (int)rect.Y;
|
||||
int y2 = (int)(rect.Y + rect.H);
|
||||
_Draw.DrawLine(color, thickness, x1, y1, x2, y1);
|
||||
_Draw.DrawLine(color, thickness, x2, y1, x2, y2);
|
||||
_Draw.DrawLine(color, thickness, x2, y2, x1, y2);
|
||||
_Draw.DrawLine(color, thickness, x1, y2, x1, y1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws a simple (filled) rectangle with the given color
|
||||
/// </summary>
|
||||
|
||||
@@ -448,11 +448,6 @@ namespace Vocaluxe.Base
|
||||
CDraw.RemoveTexture(ref texture);
|
||||
}
|
||||
|
||||
public void DrawLine(SColorF color, float w, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
CDraw.DrawLine(color, w, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
public void DrawRect(SColorF color, SRectF rect)
|
||||
{
|
||||
CDraw.DrawRect(color, rect);
|
||||
|
||||
@@ -533,28 +533,6 @@ namespace Vocaluxe.Lib.Draw
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws a line
|
||||
/// </summary>
|
||||
/// <param name="color"></param>
|
||||
/// <param name="w">The width of the line</param>
|
||||
/// <param name="x1">The start x-value</param>
|
||||
/// <param name="y1">The start y-value</param>
|
||||
/// <param name="x2">The end x-value</param>
|
||||
/// <param name="y2">The end y-value</param>
|
||||
public void DrawLine(SColorF color, float w, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
var lineVector = new Vector2[] {new Vector2(x1, y1), new Vector2(x2, y2)};
|
||||
using (var line = new Line(_Device))
|
||||
{
|
||||
line.Antialias = true;
|
||||
line.Width = w;
|
||||
line.Begin();
|
||||
line.Draw(lineVector, new Color4(color.AsColor()));
|
||||
line.End();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws a colored rectangle
|
||||
/// </summary>
|
||||
|
||||
@@ -308,11 +308,6 @@ namespace Vocaluxe.Lib.Draw
|
||||
_Backbuffer.Save(file, ImageFormat.Png);
|
||||
}
|
||||
|
||||
public void DrawLine(SColorF color, float w, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
_G.DrawLine(new Pen(color.AsColor(), w), new Point(x1, y1), new Point(x2, y2));
|
||||
}
|
||||
|
||||
public void DrawRect(SColorF color, SRectF rect) {}
|
||||
|
||||
public void DrawRectReflection(SColorF color, SRectF rect, float space, float height) {}
|
||||
|
||||
@@ -330,26 +330,13 @@ namespace Vocaluxe.Lib.Draw
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawLine(SColorF color, float w, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
GL.Enable(EnableCap.Blend);
|
||||
GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||
GL.LineWidth(w);
|
||||
GL.Begin(BeginMode.Lines);
|
||||
GL.Vertex3(x1, y1, CGraphics.ZOffset);
|
||||
GL.Vertex3(x2, y2, CGraphics.ZOffset);
|
||||
GL.End();
|
||||
|
||||
GL.Disable(EnableCap.Blend);
|
||||
}
|
||||
|
||||
public void DrawRect(SColorF color, SRectF rect)
|
||||
{
|
||||
GL.Enable(EnableCap.Blend);
|
||||
GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
|
||||
|
||||
GL.Begin(BeginMode.Quads);
|
||||
GL.MatrixMode(MatrixMode.Texture);
|
||||
GL.MatrixMode(MatrixMode.Color);
|
||||
GL.PushMatrix();
|
||||
if (Math.Abs(rect.Rotation) > 0.001)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,6 @@ namespace Vocaluxe.Lib.Draw
|
||||
void RemoveTexture(ref CTextureRef texture);
|
||||
|
||||
// Basic Draw Methods
|
||||
void DrawLine(SColorF color, float w, int x1, int y1, int x2, int y2);
|
||||
void DrawRect(SColorF color, SRectF rect);
|
||||
void DrawRectReflection(SColorF color, SRectF rect, float space, float height);
|
||||
|
||||
|
||||
@@ -152,7 +152,6 @@ namespace VocaluxeLib
|
||||
|
||||
void DrawRect(SColorF color, SRectF rect);
|
||||
void DrawRectReflection(SColorF color, SRectF rect, float space, float height);
|
||||
void DrawLine(SColorF color, float w, int x1, int y1, int x2, int y2);
|
||||
}
|
||||
|
||||
public interface IGraphics
|
||||
|
||||
@@ -539,14 +539,13 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
CBase.Drawing.DrawTexture(noteBackgroundEnd, new SRectF(r.X + r.W - dx, r.Y, dx, r.H, r.Z), col);
|
||||
}
|
||||
|
||||
protected void _DrawNoteLines(SRectF rect, SColorF color)
|
||||
private static void _DrawNoteLines(SRectF rect, SColorF color)
|
||||
{
|
||||
int x1 = (int)rect.X;
|
||||
int x2 = (int)(rect.X + rect.W);
|
||||
for (int i = 0; i < CBase.Settings.GetNumNoteLines() - 1; i++)
|
||||
SRectF lineRect = new SRectF(rect) {H = 1.5f};
|
||||
for (int i = 0; i < CBase.Settings.GetNumNoteLines(); i++)
|
||||
{
|
||||
int y = (int)(rect.Y + rect.H / CBase.Settings.GetNumNoteLines() * (i + 1));
|
||||
CBase.Drawing.DrawLine(color, 1, x1, y, x2, y);
|
||||
lineRect.Y = rect.Y + rect.H / CBase.Settings.GetNumNoteLines() * (i + 1);
|
||||
CBase.Drawing.DrawRect(color, lineRect);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user