diff --git a/Vocaluxe/Base/CDraw.cs b/Vocaluxe/Base/CDraw.cs
index fa4683cf..ffc01f0d 100644
--- a/Vocaluxe/Base/CDraw.cs
+++ b/Vocaluxe/Base/CDraw.cs
@@ -19,7 +19,6 @@
using System;
using System.Drawing;
-using System.IO;
using System.Windows.Forms;
using Vocaluxe.Lib.Draw;
using VocaluxeLib.Menu;
@@ -45,11 +44,8 @@ namespace Vocaluxe.Base
}
catch (Exception e)
{
- MessageBox.Show(e.Message + " - Error in initializing of OpenGL. Please check whether" +
- " your graphic card drivers are up to date.");
CLog.LogError(e.Message + " - Error in initializing of OpenGL. Please check whether" +
- " your graphic card drivers are up to date.");
- Environment.Exit(Environment.ExitCode);
+ " your graphic card drivers are up to date.", true, true);
}
break;
@@ -61,14 +57,9 @@ namespace Vocaluxe.Base
}
catch (Exception e)
{
- MessageBox.Show(e.Message + " - Error in initializing of Direct3D. Please check if " +
- "your DirectX redistributables and graphic card drivers are up to date. You can " +
- "download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109",
- CSettings.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
CLog.LogError(e.Message + " - Error in initializing of Direct3D. Please check if " +
"your DirectX redistributables and graphic card drivers are up to date. You can " +
- "download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109");
- Environment.Exit(Environment.ExitCode);
+ "download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109", true, true);
}
break;
#endif
@@ -77,7 +68,8 @@ namespace Vocaluxe.Base
_Draw = new CDrawWinForm();
break;
}
- _Draw.Init();
+ if (!_Draw.Init())
+ CLog.LogError("Could not init drawing interface!", true, true);
}
public static void MainLoop()
@@ -86,11 +78,10 @@ namespace Vocaluxe.Base
_Draw.MainLoop();
}
- public static bool Unload()
+ public static void Unload()
{
- bool result = _Draw.Unload();
+ _Draw.Unload();
_Draw = null;
- return result;
}
public static int GetScreenWidth()
@@ -159,37 +150,6 @@ namespace Vocaluxe.Base
return _Draw.AddTexture(texturePath);
}
- public static STexture AddTexture(string texturePath, int maxSize)
- {
- if (maxSize == 0)
- return _Draw.AddTexture(texturePath);
-
- if (!File.Exists(texturePath))
- return new STexture(-1);
-
- using (Bitmap origin = new Bitmap(texturePath))
- {
- int w = maxSize;
- int h = maxSize;
-
- if (origin.Width >= origin.Height && origin.Width > w)
- h = (int)Math.Round((float)w / origin.Width * origin.Height);
- else if (origin.Height > origin.Width && origin.Height > h)
- w = (int)Math.Round((float)h / origin.Height * origin.Width);
-
- using (Bitmap bmp = new Bitmap(origin, w, h))
- {
- STexture tex = _Draw.AddTexture(bmp);
- return tex;
- }
- }
- }
-
- public static STexture AddTexture(int w, int h, IntPtr data)
- {
- return _Draw.AddTexture(w, h, data);
- }
-
public static STexture AddTexture(int w, int h, ref byte[] data)
{
return _Draw.AddTexture(w, h, ref data);
@@ -205,11 +165,6 @@ namespace Vocaluxe.Base
return _Draw.UpdateTexture(ref texture, ref data);
}
- public static bool UpdateTexture(ref STexture texture, IntPtr data)
- {
- return _Draw.UpdateTexture(ref texture, data);
- }
-
public static void RemoveTexture(ref STexture texture)
{
_Draw.RemoveTexture(ref texture);
@@ -225,22 +180,12 @@ namespace Vocaluxe.Base
_Draw.DrawTexture(texture, rect);
}
- public static void DrawTexture(STexture texture, SRectF rect, SColorF color)
- {
- _Draw.DrawTexture(texture, rect, color);
- }
-
- public static void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds)
- {
- _Draw.DrawTexture(texture, rect, color, bounds);
- }
-
- public static void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored)
+ public static void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored = false)
{
_Draw.DrawTexture(texture, rect, color, mirrored);
}
- public static void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored)
+ public static void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false)
{
_Draw.DrawTexture(texture, rect, color, bounds, mirrored);
}
@@ -252,12 +197,12 @@ namespace Vocaluxe.Base
public static void DrawTexture(CStatic staticBounds, STexture texture, EAspect aspect)
{
+ if (texture.Height <= 0f)
+ return;
+
RectangleF bounds = new RectangleF(staticBounds.Rect.X, staticBounds.Rect.Y, staticBounds.Rect.W, staticBounds.Rect.H);
RectangleF rect = new RectangleF(0f, 0f, texture.Width, texture.Height);
- if (rect.Height <= 0f)
- return;
-
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, aspect);
DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, staticBounds.Rect.Z),
texture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
@@ -270,7 +215,7 @@ namespace Vocaluxe.Base
public static int TextureCount()
{
- return _Draw.TextureCount();
+ return _Draw.GetTextureCount();
}
}
}
\ No newline at end of file
diff --git a/Vocaluxe/Base/CLog.cs b/Vocaluxe/Base/CLog.cs
index 7e9bc0c8..df186697 100644
--- a/Vocaluxe/Base/CLog.cs
+++ b/Vocaluxe/Base/CLog.cs
@@ -21,6 +21,7 @@ using System;
using System.Diagnostics;
using System.IO;
using System.Text;
+using System.Windows.Forms;
namespace Vocaluxe.Base
{
@@ -111,12 +112,17 @@ namespace Vocaluxe.Base
}
#region LogError
- public static void LogError(string errorText)
+ public static void LogError(string errorText, bool show = false, bool exit = false, Exception e = null)
{
_NumErrors++;
-
- _ErrorLog.Add(_NumErrors + ") " + errorText);
+ if (show)
+ MessageBox.Show(errorText, CSettings.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
+ if (e != null)
+ errorText += ": " + e;
+ _ErrorLog.Add(_NumErrors + ") " + errorText + "\r\n");
_ErrorLog.Add(String.Empty);
+ if (exit)
+ Environment.Exit(Environment.ExitCode);
}
#endregion LogError
diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs
index b6b6ce48..aaaf62dc 100644
--- a/Vocaluxe/Base/CMain.cs
+++ b/Vocaluxe/Base/CMain.cs
@@ -350,12 +350,7 @@ namespace Vocaluxe.Base
CDraw.DrawTexture(texture, rect, color);
}
- public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds)
- {
- CDraw.DrawTexture(texture, rect, color, bounds);
- }
-
- public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored)
+ public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false)
{
CDraw.DrawTexture(texture, rect, color, bounds, mirrored);
}
diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs
index 81010284..106fe191 100644
--- a/Vocaluxe/Lib/Draw/CDirect3D.cs
+++ b/Vocaluxe/Lib/Draw/CDirect3D.cs
@@ -100,11 +100,7 @@ namespace Vocaluxe.Lib.Draw
}
catch (Direct3DX9NotFoundException e)
{
- MessageBox.Show("No DirectX runtimes were found, please download and install them " +
- "from http://www.microsoft.com/download/en/details.aspx?id=8109",
- CSettings.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
- CLog.LogError(e.Message + " - No DirectX runtimes were found, please download and install them from http://www.microsoft.com/download/en/details.aspx?id=8109");
- Environment.Exit(Environment.ExitCode);
+ CLog.LogError("No DirectX runtimes were found, please download and install them from http://www.microsoft.com/download/en/details.aspx?id=8109", true, true, e);
}
Paint += _OnPaintEvent;
@@ -197,12 +193,9 @@ namespace Vocaluxe.Lib.Draw
{
if (_Device == null || _Device.Disposed)
{
- MessageBox.Show("Something went wrong during device creating, please check if your DirectX redistributables " +
- "and graphic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109",
- CSettings.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
CLog.LogError(
- "Something went wrong during device creating, please check if your DirectX redistributables and grafic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109");
- Environment.Exit(Environment.ExitCode);
+ "Something went wrong during device creating, please check if your DirectX redistributables and grafic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109",
+ true, true);
}
}
@@ -579,7 +572,7 @@ namespace Vocaluxe.Lib.Draw
/// Unloads all Textures and other objects used by Direct3D for rendering
///
///
- public bool Unload()
+ public void Unload()
{
try
{
@@ -587,10 +580,10 @@ namespace Vocaluxe.Lib.Draw
}
catch {}
//Dispose all textures
- foreach (KeyValuePair p in _D3DTextures)
+ foreach (Texture texture in _D3DTextures.Values)
{
- if (p.Value != null)
- p.Value.Dispose();
+ if (texture != null)
+ texture.Dispose();
}
STexturedColoredVertex.GetDeclaration(_Device).Dispose();
@@ -598,7 +591,6 @@ namespace Vocaluxe.Lib.Draw
_IndexBuffer.Dispose();
_Device.Dispose();
_D3D.Dispose();
- return true;
}
///
@@ -920,13 +912,6 @@ namespace Vocaluxe.Lib.Draw
return AddTexture(w, h, ref data);
}
- public STexture AddTexture(int w, int h, IntPtr data)
- {
- byte[] pointerData = new Byte[4 * w * h];
- Marshal.Copy(data, pointerData, 0, pointerData.Length);
- return AddTexture(w, h, ref pointerData);
- }
-
public STexture AddTexture(int w, int h, ref byte[] data)
{
STexture texture = new STexture(-1);
@@ -1002,20 +987,6 @@ namespace Vocaluxe.Lib.Draw
#endregion adding
#region updating
- ///
- /// Updates the data of a texture
- ///
- /// The texture to update
- /// A Pointer containing the data of which the texture should be updated
- /// True if succeeded
- public bool UpdateTexture(ref STexture texture, IntPtr data)
- {
- byte[] pointerData = new Byte[4 * (int)texture.Width * (int)texture.Height];
- Marshal.Copy(data, pointerData, 0, pointerData.Length);
-
- return UpdateTexture(ref texture, ref pointerData);
- }
-
///
/// Updates the data of a texture
///
@@ -1123,30 +1094,7 @@ namespace Vocaluxe.Lib.Draw
/// A SRectF struct containing the destination coordinates
public void DrawTexture(STexture texture, SRectF rect)
{
- DrawTexture(texture, rect, texture.Color, false);
- }
-
- ///
- /// Draws a texture
- ///
- /// The texture to be drawn
- /// A SRectF struct containing the destination coordinates
- /// A SColorF struct containing a color which the texture will be colored in
- public void DrawTexture(STexture texture, SRectF rect, SColorF color)
- {
- DrawTexture(texture, rect, color, false);
- }
-
- ///
- /// Draws a texture
- ///
- /// The texture to be drawn
- /// A SRectF struct containing the destination coordinates
- /// A SColorF struct containing a color which the texture will be colored in
- /// A SRectF struct containing which part of the texture should be drawn
- public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds)
- {
- DrawTexture(texture, rect, color, bounds, false);
+ DrawTexture(texture, rect, texture.Color);
}
///
@@ -1156,7 +1104,7 @@ namespace Vocaluxe.Lib.Draw
/// A SRectF struct containing the destination coordinates
/// A SColorF struct containing a color which the texture will be colored in
/// True if the texture should be mirrored
- public void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored)
+ public void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored = false)
{
DrawTexture(texture, rect, color, new SRectF(0, 0, CSettings.RenderW, CSettings.RenderH, rect.Z), mirrored);
}
@@ -1169,7 +1117,7 @@ namespace Vocaluxe.Lib.Draw
/// A SColorF struct containing a color which the texture will be colored in
/// A SRectF struct containing which part of the texture should be drawn
/// True if the texture should be mirrored
- public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored)
+ public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false)
{
if (_TextureExists(ref texture))
{
@@ -1408,7 +1356,7 @@ namespace Vocaluxe.Lib.Draw
/// Gets the count of current textures
///
/// The amount of textures
- public int TextureCount()
+ public int GetTextureCount()
{
return _Textures.Count;
}
diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs
index 422da25b..da58a68e 100644
--- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs
+++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs
@@ -264,7 +264,7 @@ namespace Vocaluxe.Lib.Draw
Close();
}
- public bool Unload()
+ public void Unload()
{
try
{
@@ -272,7 +272,6 @@ namespace Vocaluxe.Lib.Draw
}
catch {}
Dispose();
- return true;
}
public int GetScreenWidth()
@@ -399,11 +398,6 @@ namespace Vocaluxe.Lib.Draw
}
}
- public STexture AddTexture(int w, int h, IntPtr data)
- {
- return new STexture(-1);
- }
-
public STexture EnqueueTexture(int w, int h, ref byte[] data)
{
return AddTexture(w, h, ref data);
@@ -420,11 +414,6 @@ namespace Vocaluxe.Lib.Draw
}
}
- public bool UpdateTexture(ref STexture texture, IntPtr data)
- {
- return true;
- }
-
public bool UpdateTexture(ref STexture texture, ref byte[] data)
{
if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index))
@@ -449,25 +438,13 @@ namespace Vocaluxe.Lib.Draw
DrawTexture(texture, rect, texture.Color);
}
- public void DrawTexture(STexture texture, SRectF rect, SColorF color)
- {
- if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index))
- DrawTexture(texture, rect, color, rect, false);
- }
-
- public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds)
- {
- if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index))
- DrawTexture(texture, rect, color, bounds, false);
- }
-
- public void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored)
+ public void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored = false)
{
if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index))
DrawTexture(texture, rect, color, rect, mirrored);
}
- public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored)
+ public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false)
{
if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index))
{
@@ -481,7 +458,7 @@ namespace Vocaluxe.Lib.Draw
public void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) {}
- public int TextureCount()
+ public int GetTextureCount()
{
return _Textures.Count;
}
diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs
index 064e8862..60814872 100644
--- a/Vocaluxe/Lib/Draw/COpenGL.cs
+++ b/Vocaluxe/Lib/Draw/COpenGL.cs
@@ -30,7 +30,6 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Vocaluxe.Base;
-using Vocaluxe.Base.Fonts;
using VocaluxeLib.Menu;
using BeginMode = OpenTK.Graphics.OpenGL.BeginMode;
using BlendingFactorDest = OpenTK.Graphics.OpenGL.BlendingFactorDest;
@@ -459,7 +458,7 @@ namespace Vocaluxe.Lib.Draw
Close();
}
- public bool Unload()
+ public void Unload()
{
try
{
@@ -470,8 +469,6 @@ namespace Vocaluxe.Lib.Draw
_Textures.Values.CopyTo(textures, 0);
for (int i = 0; i < _Textures.Count; i++)
RemoveTexture(ref textures[i]);
-
- return true;
}
public int GetScreenWidth()
@@ -570,7 +567,18 @@ namespace Vocaluxe.Lib.Draw
}
}
- public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) {}
+ public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2)
+ {
+ GL.Enable(EnableCap.Blend);
+ GL.Color4(r, g, b, a * CGraphics.GlobalAlpha);
+
+ GL.Begin(BeginMode.Lines);
+ GL.Vertex3(x1, y1, CGraphics.ZOffset);
+ GL.Vertex3(x2, y2, CGraphics.ZOffset);
+ GL.End();
+
+ GL.Disable(EnableCap.Blend);
+ }
public void DrawColor(SColorF color, SRectF rect)
{
@@ -774,66 +782,6 @@ namespace Vocaluxe.Lib.Draw
return texture;
}
- public STexture AddTexture(int w, int h, IntPtr data)
- {
- STexture texture = new STexture(-1);
-
- if (_UsePBO)
- {
- try
- {
- GL.GenBuffers(1, out texture.PBO);
- GL.BindBuffer(BufferTarget.PixelUnpackBuffer, texture.PBO);
- GL.BufferData(BufferTarget.PixelUnpackBuffer, (IntPtr)(w * h * 4), IntPtr.Zero, BufferUsageHint.StreamDraw);
- GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0);
- }
- catch (Exception)
- {
- _UsePBO = false;
- }
- }
-
- int id = GL.GenTexture();
- GL.BindTexture(TextureTarget.Texture2D, id);
- texture.ID = id;
-
- texture.Width = w;
- texture.Height = h;
- texture.W2 = MathHelper.NextPowerOfTwo(texture.Width);
- texture.H2 = MathHelper.NextPowerOfTwo(texture.Height);
-
- texture.WidthRatio = texture.Width / texture.W2;
- texture.HeightRatio = texture.Height / texture.H2;
-
- GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, (int)texture.W2, (int)texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
-
- GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, w, h, PixelFormat.Bgra, PixelType.UnsignedByte, data);
-
-
- //GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge);
- //GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge);
- GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
- GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
-
- //GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear);
- //GL.GenerateMipmap(GenerateMipmapTarget.Texture2D);
- //GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D);
- GL.BindTexture(TextureTarget.Texture2D, 0);
-
- // Add to Texture List
- texture.Color = new SColorF(1f, 1f, 1f, 1f);
- texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f);
- texture.TexturePath = String.Empty;
-
- lock (_MutexTexture)
- {
- texture.Index = _IDs.Dequeue();
- _Textures[texture.Index] = texture;
- }
-
- return texture;
- }
-
public STexture AddTexture(int w, int h, ref byte[] data)
{
STexture texture = new STexture(-1);
@@ -916,59 +864,6 @@ namespace Vocaluxe.Lib.Draw
#endregion adding
#region updating
- public bool UpdateTexture(ref STexture texture, IntPtr data)
- {
- if (_TextureExists(ref texture))
- {
- if (_UsePBO)
- {
- try
- {
- GL.BindBuffer(BufferTarget.PixelUnpackBuffer, texture.PBO);
-
- IntPtr buffer = GL.MapBuffer(BufferTarget.PixelUnpackBuffer, BufferAccess.WriteOnly);
- byte[] d = new byte[(int)texture.Height * (int)texture.Width * 4];
-
- Marshal.Copy(data, d, 0, (int)texture.Height * (int)texture.Width * 4);
- Marshal.Copy(d, 0, buffer, (int)texture.Height * (int)texture.Width * 4);
-
- GL.UnmapBuffer(BufferTarget.PixelUnpackBuffer);
-
- GL.BindTexture(TextureTarget.Texture2D, texture.ID);
- GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
-
- GL.BindTexture(TextureTarget.Texture2D, 0);
- GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0);
-
- return true;
- }
- catch (Exception)
- {
- _UsePBO = false;
- }
- }
-
- GL.BindTexture(TextureTarget.Texture2D, texture.ID);
-
- GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height, PixelFormat.Bgra, PixelType.UnsignedByte, data);
-
- GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge);
- GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge);
-
- //GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
- GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
-
- GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear);
- //GL.GenerateMipmap(GenerateMipmapTarget.Texture2D);
- GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D);
-
- GL.BindTexture(TextureTarget.Texture2D, 0);
-
- return true;
- }
- return false;
- }
-
public bool UpdateTexture(ref STexture texture, ref byte[] data)
{
if (_TextureExists(ref texture))
@@ -1052,25 +947,15 @@ namespace Vocaluxe.Lib.Draw
public void DrawTexture(STexture texture, SRectF rect)
{
- DrawTexture(texture, rect, texture.Color, false);
+ DrawTexture(texture, rect, texture.Color);
}
- public void DrawTexture(STexture texture, SRectF rect, SColorF color)
- {
- DrawTexture(texture, rect, color, false);
- }
-
- public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds)
- {
- DrawTexture(texture, rect, color, bounds, false);
- }
-
- public void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored)
+ public void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored = false)
{
DrawTexture(texture, rect, color, new SRectF(0, 0, CSettings.RenderW, CSettings.RenderH, rect.Z), mirrored);
}
- public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored)
+ public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false)
{
if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon ||
Math.Abs(color.A) < float.Epsilon)
@@ -1306,7 +1191,7 @@ namespace Vocaluxe.Lib.Draw
}
#endregion drawing
- public int TextureCount()
+ public int GetTextureCount()
{
return _Textures.Count;
}
diff --git a/Vocaluxe/Lib/Draw/IDraw.cs b/Vocaluxe/Lib/Draw/IDraw.cs
index a2b562fe..f4ac27ff 100644
--- a/Vocaluxe/Lib/Draw/IDraw.cs
+++ b/Vocaluxe/Lib/Draw/IDraw.cs
@@ -27,15 +27,12 @@ namespace Vocaluxe.Lib.Draw
{
bool Init();
void MainLoop();
- bool Unload();
+ void Unload();
int GetScreenWidth();
int GetScreenHeight();
- // Basic Draw Methods
- void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2);
- void DrawColor(SColorF color, SRectF rect);
- void DrawColorReflection(SColorF color, SRectF rect, float space, float height);
+ int GetTextureCount();
void ClearScreen();
STexture CopyScreen();
@@ -44,24 +41,22 @@ namespace Vocaluxe.Lib.Draw
STexture AddTexture(string texturePath);
STexture AddTexture(Bitmap bitmap);
- STexture AddTexture(int w, int h, IntPtr data);
STexture AddTexture(int w, int h, ref byte[] data);
STexture EnqueueTexture(int w, int h, ref byte[] data);
bool UpdateTexture(ref STexture texture, ref byte[] data);
- bool UpdateTexture(ref STexture texture, IntPtr data);
-
void RemoveTexture(ref STexture texture);
+
+ // Basic Draw Methods
+ void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2);
+ void DrawColor(SColorF color, SRectF rect);
+ void DrawColorReflection(SColorF color, SRectF rect, float space, float height);
+
void DrawTexture(STexture texture);
void DrawTexture(STexture texture, SRectF rect);
- void DrawTexture(STexture texture, SRectF rect, SColorF color);
- void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds);
-
- void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored);
- void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored);
+ void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored = false);
+ void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false);
void DrawTexture(STexture texture, SRectF rect, SColorF color, float begin, float end);
void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height);
-
- int TextureCount();
}
}
\ No newline at end of file
diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs
index 95100788..b2b91758 100644
--- a/VocaluxeLib/Menu/IMenu.cs
+++ b/VocaluxeLib/Menu/IMenu.cs
@@ -22,7 +22,6 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing;
using VocaluxeLib.Menu.SongMenu;
-using VocaluxeLib.PartyModes;
namespace VocaluxeLib.Menu
{
@@ -60,15 +59,6 @@ namespace VocaluxeLib.Menu
void ProcessMouseMove(int x, int y);
}
- public interface IMenuParty
- {
- void SetPartyModeID(int partyModeID);
- int GetPartyModeID();
-
- void AssingPartyMode(IPartyMode partyMode);
- void DataToScreen(Object data);
- }
-
public interface IConfig
{
void SetBackgroundMusicVolume(int newVolume);
@@ -161,8 +151,7 @@ namespace VocaluxeLib.Menu
{
void DrawTexture(STexture texture, SRectF rect);
void DrawTexture(STexture texture, SRectF rect, SColorF color);
- void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds);
- void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored);
+ void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false);
void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight);
void RemoveTexture(ref STexture texture);