Make a common base class for CD3D and COpenGL
This commit is contained in:
1 parent
ad18bec52c
commit
46acaf092a
5 files changed
+259
-283
No files matched your search
+72
-121
@@ -34,10 +34,20 @@ using VocaluxeLib.Draw;
|
|||||||
|
|
||||||
namespace Vocaluxe.Lib.Draw
|
namespace Vocaluxe.Lib.Draw
|
||||||
{
|
{
|
||||||
class CDirect3D : RenderForm, IDraw
|
class CRenderFormHook : RenderForm, CDrawBaseWindows.IFormHook
|
||||||
|
{
|
||||||
|
public CDrawBaseWindows.MessageEventHandler OnMessage { private get; set; }
|
||||||
|
|
||||||
|
protected override void WndProc(ref Message m)
|
||||||
|
{
|
||||||
|
if (OnMessage(ref m))
|
||||||
|
base.WndProc(ref m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class CDirect3D : CDrawBaseWindows, IDraw
|
||||||
{
|
{
|
||||||
#region private vars
|
#region private vars
|
||||||
|
|
||||||
private readonly CKeys _Keys;
|
private readonly CKeys _Keys;
|
||||||
private readonly CMouse _Mouse;
|
private readonly CMouse _Mouse;
|
||||||
private bool _Run;
|
private bool _Run;
|
||||||
@@ -46,8 +56,6 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
private readonly Device _Device;
|
private readonly Device _Device;
|
||||||
private readonly PresentParameters _PresentParameters;
|
private readonly PresentParameters _PresentParameters;
|
||||||
|
|
||||||
private bool _Fullscreen;
|
|
||||||
private Size _OldSize;
|
|
||||||
private Size _SizeBeforeMinimize;
|
private Size _SizeBeforeMinimize;
|
||||||
|
|
||||||
private readonly Dictionary<int, Texture> _D3DTextures = new Dictionary<int, Texture>();
|
private readonly Dictionary<int, Texture> _D3DTextures = new Dictionary<int, Texture>();
|
||||||
@@ -71,7 +79,6 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
private readonly Queue<STexturedColoredVertex> _Vertices = new Queue<STexturedColoredVertex>();
|
private readonly Queue<STexturedColoredVertex> _Vertices = new Queue<STexturedColoredVertex>();
|
||||||
private readonly Queue<Texture> _VerticesTextures = new Queue<Texture>();
|
private readonly Queue<Texture> _VerticesTextures = new Queue<Texture>();
|
||||||
private readonly Queue<SlimDX.Matrix> _VerticesRotationMatrices = new Queue<SlimDX.Matrix>();
|
private readonly Queue<SlimDX.Matrix> _VerticesRotationMatrices = new Queue<SlimDX.Matrix>();
|
||||||
|
|
||||||
#endregion private vars
|
#endregion private vars
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -79,8 +86,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public CDirect3D()
|
public CDirect3D()
|
||||||
{
|
{
|
||||||
Icon = new Icon(Path.Combine(CSettings.ProgramFolder, CSettings.FileNameIcon));
|
_Form = new CRenderFormHook();
|
||||||
|
|
||||||
_Keys = new CKeys();
|
_Keys = new CKeys();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -91,25 +97,26 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
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);
|
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;
|
_Form.Closing += _OnClosingEvent;
|
||||||
Closing += _OnClosingEvent;
|
_Form.Resize += _OnResize;
|
||||||
Resize += _OnResizeEvent;
|
_Form.Load += _OnLoad;
|
||||||
|
|
||||||
KeyDown += _OnKeyDown;
|
|
||||||
PreviewKeyDown += _OnPreviewKeyDown;
|
_Form.KeyDown += _OnKeyDown;
|
||||||
KeyPress += _OnKeyPress;
|
_Form.PreviewKeyDown += _OnPreviewKeyDown;
|
||||||
KeyUp += _OnKeyUp;
|
_Form.KeyPress += _OnKeyPress;
|
||||||
|
_Form.KeyUp += _OnKeyUp;
|
||||||
|
|
||||||
_Mouse = new CMouse();
|
_Mouse = new CMouse();
|
||||||
MouseMove += _OnMouseMove;
|
_Form.MouseMove += _OnMouseMove;
|
||||||
MouseWheel += _OnMouseWheel;
|
_Form.MouseWheel += _OnMouseWheel;
|
||||||
MouseDown += _OnMouseDown;
|
_Form.MouseDown += _OnMouseDown;
|
||||||
MouseUp += _OnMouseUp;
|
_Form.MouseUp += _OnMouseUp;
|
||||||
MouseLeave += _OnMouseLeave;
|
_Form.MouseLeave += _OnMouseLeave;
|
||||||
MouseEnter += _OnMouseEnter;
|
_Form.MouseEnter += _OnMouseEnter;
|
||||||
|
|
||||||
ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH);
|
_Form.ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH);
|
||||||
_SizeBeforeMinimize = ClientSize;
|
_SizeBeforeMinimize = _Form.ClientSize;
|
||||||
|
|
||||||
_PresentParameters = new PresentParameters
|
_PresentParameters = new PresentParameters
|
||||||
{
|
{
|
||||||
@@ -168,14 +175,14 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
CreateFlags flags = (caps.DeviceCaps & DeviceCaps.HWTransformAndLight) != 0 ? CreateFlags.HardwareVertexProcessing : CreateFlags.SoftwareVertexProcessing;
|
CreateFlags flags = (caps.DeviceCaps & DeviceCaps.HWTransformAndLight) != 0 ? CreateFlags.HardwareVertexProcessing : CreateFlags.SoftwareVertexProcessing;
|
||||||
|
|
||||||
//Check if Pow2 textures are needed
|
//Check if Pow2 textures are needed
|
||||||
CDrawHelper.NonPowerOf2TextureSupported = true;
|
_NonPowerOf2TextureSupported = true;
|
||||||
CDrawHelper.NonPowerOf2TextureSupported &= (caps.TextureCaps & TextureCaps.Pow2) == 0;
|
_NonPowerOf2TextureSupported &= (caps.TextureCaps & TextureCaps.Pow2) == 0;
|
||||||
CDrawHelper.NonPowerOf2TextureSupported &= (caps.TextureCaps & TextureCaps.NonPow2Conditional) == 0;
|
_NonPowerOf2TextureSupported &= (caps.TextureCaps & TextureCaps.NonPow2Conditional) == 0;
|
||||||
CDrawHelper.NonPowerOf2TextureSupported &= (caps.TextureCaps & TextureCaps.SquareOnly) == 0;
|
_NonPowerOf2TextureSupported &= (caps.TextureCaps & TextureCaps.SquareOnly) == 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_Device = new Device(_D3D, _D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, Handle, flags, _PresentParameters);
|
_Device = new Device(_D3D, _D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, _Form.Handle, flags, _PresentParameters);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -187,68 +194,39 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CenterToScreen();
|
_CenterToScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region form events
|
#region form events
|
||||||
private void _OnPaintEvent(object sender, PaintEventArgs e) {}
|
|
||||||
|
|
||||||
private void _OnResizeEvent(object sender, EventArgs e) {}
|
|
||||||
|
|
||||||
private void _OnClosingEvent(object sender, CancelEventArgs e)
|
private void _OnClosingEvent(object sender, CancelEventArgs e)
|
||||||
{
|
{
|
||||||
_Run = false;
|
_Run = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnLoad(EventArgs e)
|
private void _OnLoad(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0);
|
_Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResize(EventArgs e)
|
private void _OnResize(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnResize(e);
|
|
||||||
_DoResize();
|
_DoResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void WndProc(ref Message m)
|
|
||||||
{
|
|
||||||
switch (m.Msg)
|
|
||||||
{
|
|
||||||
case 0x112: // WM_SYSCOMMAND
|
|
||||||
switch ((int)m.WParam & 0xFFF0)
|
|
||||||
{
|
|
||||||
case 0xF100: // SC_KEYMENU
|
|
||||||
m.Result = IntPtr.Zero;
|
|
||||||
break;
|
|
||||||
case 0xF140: // SC_SCREENSAVER
|
|
||||||
case 0xF170: // SC_MONITORPOWER
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
base.WndProc(ref m);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
base.WndProc(ref m);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion form events
|
#endregion form events
|
||||||
|
|
||||||
#region resize
|
#region resize
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resizes the viewport
|
/// Resizes the viewport
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void _DoResize()
|
protected override void _DoResize()
|
||||||
{
|
{
|
||||||
// The window was minimized, so restore it to the last known size
|
// The window was minimized, so restore it to the last known size
|
||||||
if (ClientSize.Width == 0 || ClientSize.Height == 0)
|
if (_Form.ClientSize.Width == 0 || _Form.ClientSize.Height == 0)
|
||||||
ClientSize = _SizeBeforeMinimize;
|
_Form.ClientSize = _SizeBeforeMinimize;
|
||||||
if (!_Run)
|
if (!_Run)
|
||||||
return;
|
return;
|
||||||
_H = ClientSize.Height;
|
_H = _Form.ClientSize.Height;
|
||||||
_W = ClientSize.Width;
|
_W = _Form.ClientSize.Width;
|
||||||
_Y = 0;
|
_Y = 0;
|
||||||
_X = 0;
|
_X = 0;
|
||||||
|
|
||||||
@@ -256,18 +234,18 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
{
|
{
|
||||||
//The windows's width is too big
|
//The windows's width is too big
|
||||||
_W = (int)Math.Round(_H * CSettings.GetRenderAspect());
|
_W = (int)Math.Round(_H * CSettings.GetRenderAspect());
|
||||||
_X = (ClientSize.Width - _W) / 2;
|
_X = (_Form.ClientSize.Width - _W) / 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//The windows's height is too big
|
//The windows's height is too big
|
||||||
_H = (int)Math.Round(_W / CSettings.GetRenderAspect());
|
_H = (int)Math.Round(_W / CSettings.GetRenderAspect());
|
||||||
_Y = (ClientSize.Height - _H) / 2;
|
_Y = (_Form.ClientSize.Height - _H) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Apply the new sizes to the PresentParameters
|
//Apply the new sizes to the PresentParameters
|
||||||
_PresentParameters.BackBufferWidth = ClientSize.Width;
|
_PresentParameters.BackBufferWidth = _Form.ClientSize.Width;
|
||||||
_PresentParameters.BackBufferHeight = ClientSize.Height;
|
_PresentParameters.BackBufferHeight = _Form.ClientSize.Height;
|
||||||
ClearScreen();
|
ClearScreen();
|
||||||
//To set new PresentParameters the device has to be resetted
|
//To set new PresentParameters the device has to be resetted
|
||||||
_Reset();
|
_Reset();
|
||||||
@@ -277,52 +255,22 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
//Set the new Viewport
|
//Set the new Viewport
|
||||||
_Device.Viewport = new Viewport(_X, _Y, _W, _H);
|
_Device.Viewport = new Viewport(_X, _Y, _W, _H);
|
||||||
//Store size so it can get restored after the window gets minimized
|
//Store size so it can get restored after the window gets minimized
|
||||||
_SizeBeforeMinimize = ClientSize;
|
_SizeBeforeMinimize = _Form.ClientSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReSharper disable RedundantOverridenMember
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Triggers the Fullscreen mode
|
/// Triggers the Fullscreen mode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void _EnterFullScreen()
|
protected override void _EnterFullScreen()
|
||||||
{
|
{
|
||||||
//This currently not using real fullscreen mode but a borderless window
|
//This currently not using real fullscreen mode but a borderless window
|
||||||
//Real fullscreen could be gained setting _PresentParameters.Windowed = true
|
//Real fullscreen could be gained setting _PresentParameters.Windowed = true
|
||||||
//And calling Reset() and Init() after
|
//And calling Reset() and Init() after
|
||||||
_OldSize = ClientSize;
|
base._EnterFullScreen();
|
||||||
|
|
||||||
int screenNr = 0;
|
|
||||||
for (int i = 0; i < Screen.AllScreens.Length; i++)
|
|
||||||
{
|
|
||||||
Screen scr = Screen.AllScreens[i];
|
|
||||||
if (scr.Bounds.Top <= Top && scr.Bounds.Left <= Left)
|
|
||||||
screenNr = i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientSize = new Size(Screen.AllScreens[screenNr].Bounds.Width, Screen.AllScreens[screenNr].Bounds.Height);
|
// ReSharper restore RedundantOverridenMember
|
||||||
FormBorderStyle = FormBorderStyle.None;
|
|
||||||
CenterToScreen();
|
|
||||||
_Fullscreen = true;
|
|
||||||
|
|
||||||
if (WindowState == FormWindowState.Maximized)
|
|
||||||
{
|
|
||||||
WindowState = FormWindowState.Normal;
|
|
||||||
_DoResize();
|
|
||||||
WindowState = FormWindowState.Maximized;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_DoResize();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Triggers the windowed mode
|
|
||||||
/// </summary>
|
|
||||||
private void _LeaveFullScreen()
|
|
||||||
{
|
|
||||||
ClientSize = _OldSize;
|
|
||||||
FormBorderStyle = FormBorderStyle.Sizable;
|
|
||||||
CenterToScreen();
|
|
||||||
_Fullscreen = false;
|
|
||||||
}
|
|
||||||
#endregion resize
|
#endregion resize
|
||||||
|
|
||||||
#region mouse event handlers
|
#region mouse event handlers
|
||||||
@@ -388,11 +336,14 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
/// Inits the Device
|
/// Inits the Device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>True if it succeeded else false</returns>
|
/// <returns>True if it succeeded else false</returns>
|
||||||
public bool Init()
|
public override bool Init()
|
||||||
{
|
{
|
||||||
|
if (!base.Init())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (_Device.Disposed)
|
if (_Device.Disposed)
|
||||||
return false;
|
return false;
|
||||||
Text = CSettings.GetFullVersionText();
|
|
||||||
_AdjustNewBorders();
|
_AdjustNewBorders();
|
||||||
|
|
||||||
_VertexBuffer = new VertexBuffer(_Device, CSettings.VertexBufferElements * (4 * Marshal.SizeOf(typeof(STexturedColoredVertex))), Usage.WriteOnly | Usage.Dynamic,
|
_VertexBuffer = new VertexBuffer(_Device, CSettings.VertexBufferElements * (4 * Marshal.SizeOf(typeof(STexturedColoredVertex))), Usage.WriteOnly | Usage.Dynamic,
|
||||||
@@ -468,7 +419,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
{
|
{
|
||||||
_Run = true;
|
_Run = true;
|
||||||
int delay = 0;
|
int delay = 0;
|
||||||
Show();
|
_Form.Show();
|
||||||
|
|
||||||
if (CConfig.FullScreen == EOffOn.TR_CONFIG_ON)
|
if (CConfig.FullScreen == EOffOn.TR_CONFIG_ON)
|
||||||
_EnterFullScreen();
|
_EnterFullScreen();
|
||||||
@@ -513,12 +464,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
}
|
}
|
||||||
//Apply fullscreen mode
|
//Apply fullscreen mode
|
||||||
if ((CConfig.FullScreen == EOffOn.TR_CONFIG_ON) != _Fullscreen)
|
if ((CConfig.FullScreen == EOffOn.TR_CONFIG_ON) != _Fullscreen)
|
||||||
{
|
_ToggleFullScreen();
|
||||||
if (!_Fullscreen)
|
|
||||||
_EnterFullScreen();
|
|
||||||
else
|
|
||||||
_LeaveFullScreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Apply border changes
|
//Apply border changes
|
||||||
if (_BorderLeft != CConfig.BorderLeft || _BorderRight != CConfig.BorderRight || _BorderTop != CConfig.BorderTop || _BorderBottom != CConfig.BorderBottom)
|
if (_BorderLeft != CConfig.BorderLeft || _BorderRight != CConfig.BorderRight || _BorderTop != CConfig.BorderTop || _BorderBottom != CConfig.BorderBottom)
|
||||||
@@ -531,16 +477,19 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
_AdjustNewBorders();
|
_AdjustNewBorders();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CConfig.VSync == EOffOn.TR_CONFIG_ON)
|
||||||
|
{
|
||||||
if (CTime.IsRunning())
|
if (CTime.IsRunning())
|
||||||
delay = (int)Math.Floor(CConfig.CalcCycleTime() - CTime.GetMilliseconds());
|
delay = (int)Math.Floor(CConfig.CalcCycleTime() - CTime.GetMilliseconds());
|
||||||
|
|
||||||
if (delay >= 1 && CConfig.VSync == EOffOn.TR_CONFIG_OFF)
|
if (delay >= 1 && delay < 500)
|
||||||
Thread.Sleep(delay);
|
Thread.Sleep(delay);
|
||||||
|
}
|
||||||
//Calculate the FPS Rate and restart the timer after a frame
|
//Calculate the FPS Rate and restart the timer after a frame
|
||||||
CTime.CalculateFPS();
|
CTime.CalculateFPS();
|
||||||
CTime.Restart();
|
CTime.Restart();
|
||||||
}
|
}
|
||||||
Close();
|
_Form.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -578,7 +527,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Close();
|
_Form.Close();
|
||||||
}
|
}
|
||||||
catch {}
|
catch {}
|
||||||
//Dispose all textures
|
//Dispose all textures
|
||||||
@@ -680,7 +629,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public CTexture CopyScreen()
|
public CTexture CopyScreen()
|
||||||
{
|
{
|
||||||
CTexture texture = CDrawHelper.GetNewTexture(_W, _H);
|
CTexture texture = GetNewTexture(_W, _H);
|
||||||
|
|
||||||
Surface backbufferSurface = _Device.GetBackBuffer(0, 0);
|
Surface backbufferSurface = _Device.GetBackBuffer(0, 0);
|
||||||
var tex = new Texture(_Device, texture.W2, texture.H2, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed);
|
var tex = new Texture(_Device, texture.W2, texture.H2, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed);
|
||||||
@@ -850,7 +799,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
int w = Math.Min(bmp.Width, maxSize);
|
int w = Math.Min(bmp.Width, maxSize);
|
||||||
int h = Math.Min(bmp.Height, maxSize);
|
int h = Math.Min(bmp.Height, maxSize);
|
||||||
|
|
||||||
CTexture texture = CDrawHelper.GetNewTexture(bmp.Width,bmp.Height,w, h);
|
CTexture texture = GetNewTexture(bmp.Width, bmp.Height, w, h);
|
||||||
|
|
||||||
Bitmap bmp2 = null;
|
Bitmap bmp2 = null;
|
||||||
byte[] data;
|
byte[] data;
|
||||||
@@ -890,7 +839,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public CTexture AddTexture(int w, int h, byte[] data)
|
public CTexture AddTexture(int w, int h, byte[] data)
|
||||||
{
|
{
|
||||||
CTexture texture = CDrawHelper.GetNewTexture(w, h);
|
CTexture texture = GetNewTexture(w, h);
|
||||||
return _AddTexture(texture, data);
|
return _AddTexture(texture, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -935,7 +884,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public CTexture EnqueueTexture(int w, int h, byte[] data)
|
public CTexture EnqueueTexture(int w, int h, byte[] data)
|
||||||
{
|
{
|
||||||
CTexture texture = CDrawHelper.GetNewTexture(w, h);
|
CTexture texture = GetNewTexture(w, h);
|
||||||
|
|
||||||
lock (_D3DTextures)
|
lock (_D3DTextures)
|
||||||
{
|
{
|
||||||
@@ -1004,13 +953,15 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
/// <param name="texture">The texture to be removed</param>
|
/// <param name="texture">The texture to be removed</param>
|
||||||
public void RemoveTexture(ref CTexture texture)
|
public void RemoveTexture(ref CTexture texture)
|
||||||
{
|
{
|
||||||
if(texture==null) return;
|
if (texture == null)
|
||||||
|
return;
|
||||||
lock (_D3DTextures)
|
lock (_D3DTextures)
|
||||||
{
|
{
|
||||||
Texture t;
|
Texture t;
|
||||||
if (_D3DTextures.TryGetValue(texture.ID, out t))
|
if (_D3DTextures.TryGetValue(texture.ID, out t))
|
||||||
{
|
{
|
||||||
if(t!=null) t.Dispose();
|
if (t != null)
|
||||||
|
t.Dispose();
|
||||||
_D3DTextures.Remove(texture.ID);
|
_D3DTextures.Remove(texture.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,156 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Vocaluxe.Base;
|
||||||
|
using VocaluxeLib.Draw;
|
||||||
|
|
||||||
|
namespace Vocaluxe.Lib.Draw
|
||||||
|
{
|
||||||
|
struct SClientRect
|
||||||
|
{
|
||||||
|
public Point Location;
|
||||||
|
public int Width;
|
||||||
|
public int Height;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct STextureQueue
|
||||||
|
{
|
||||||
|
public readonly CTexture Texture;
|
||||||
|
public readonly byte[] Data;
|
||||||
|
|
||||||
|
public STextureQueue(CTexture texture, byte[] data)
|
||||||
|
{
|
||||||
|
Texture = texture;
|
||||||
|
Data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class CDrawBaseWindows : CDrawBase
|
||||||
|
{
|
||||||
|
public delegate bool MessageEventHandler(ref Message m);
|
||||||
|
|
||||||
|
public interface IFormHook
|
||||||
|
{
|
||||||
|
MessageEventHandler OnMessage { set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Form _Form;
|
||||||
|
private SClientRect _Restore;
|
||||||
|
|
||||||
|
protected void _CenterToScreen()
|
||||||
|
{
|
||||||
|
Screen screen = Screen.FromControl(_Form);
|
||||||
|
_Form.Location = new Point((screen.WorkingArea.Width - _Form.Width) / 2,
|
||||||
|
(screen.WorkingArea.Height - _Form.Height) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _OnMessageAvoidScreenOff(ref Message m)
|
||||||
|
{
|
||||||
|
switch (m.Msg)
|
||||||
|
{
|
||||||
|
case 0x112: // WM_SYSCOMMAND
|
||||||
|
switch ((int)m.WParam & 0xFFF0)
|
||||||
|
{
|
||||||
|
case 0xF100: // SC_KEYMENU
|
||||||
|
m.Result = IntPtr.Zero;
|
||||||
|
return false;
|
||||||
|
case 0xF140: // SC_SCREENSAVER
|
||||||
|
case 0xF170: // SC_MONITORPOWER
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void _ToggleFullScreen()
|
||||||
|
{
|
||||||
|
if (!_Fullscreen)
|
||||||
|
_EnterFullScreen();
|
||||||
|
else
|
||||||
|
_LeaveFullScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void _EnterFullScreen()
|
||||||
|
{
|
||||||
|
Debug.Assert(!_Fullscreen);
|
||||||
|
_Fullscreen = true;
|
||||||
|
|
||||||
|
_Restore.Location = _Form.Location;
|
||||||
|
_Restore.Width = _Form.Width;
|
||||||
|
_Restore.Height = _Form.Height;
|
||||||
|
|
||||||
|
_Form.FormBorderStyle = FormBorderStyle.None;
|
||||||
|
|
||||||
|
Screen screen = Screen.FromControl(_Form);
|
||||||
|
_Form.DesktopBounds = new Rectangle(screen.Bounds.Location, new Size(screen.Bounds.Width, screen.Bounds.Height));
|
||||||
|
|
||||||
|
if (_Form.WindowState == FormWindowState.Maximized)
|
||||||
|
{
|
||||||
|
_Form.WindowState = FormWindowState.Normal;
|
||||||
|
_DoResize();
|
||||||
|
_Form.WindowState = FormWindowState.Maximized;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_DoResize();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void _DoResize();
|
||||||
|
|
||||||
|
protected void _LeaveFullScreen()
|
||||||
|
{
|
||||||
|
Debug.Assert(_Fullscreen);
|
||||||
|
_Fullscreen = false;
|
||||||
|
|
||||||
|
_Form.FormBorderStyle = FormBorderStyle.Sizable;
|
||||||
|
_Form.DesktopBounds = new Rectangle(_Restore.Location, new Size(_Restore.Width, _Restore.Height));
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool Init()
|
||||||
|
{
|
||||||
|
_Form.Icon = new Icon(Path.Combine(CSettings.ProgramFolder, CSettings.FileNameIcon));
|
||||||
|
_Form.Text = CSettings.GetFullVersionText();
|
||||||
|
((IFormHook)_Form).OnMessage = _OnMessageAvoidScreenOff;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class CDrawBase
|
||||||
|
{
|
||||||
|
protected bool _NonPowerOf2TextureSupported;
|
||||||
|
protected bool _Fullscreen;
|
||||||
|
|
||||||
|
private readonly Object _MutexID = new object();
|
||||||
|
private int _NextID;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculates the next power of two if the device has the POW2 flag set
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="n">The value of which the next power of two will be calculated</param>
|
||||||
|
/// <returns>The next power of two</returns>
|
||||||
|
private int _CheckForNextPowerOf2(int n)
|
||||||
|
{
|
||||||
|
if (_NonPowerOf2TextureSupported)
|
||||||
|
return n;
|
||||||
|
if (n < 0)
|
||||||
|
throw new ArgumentOutOfRangeException("n", "Must be positive.");
|
||||||
|
return (int)Math.Pow(2, Math.Ceiling(Math.Log(n, 2)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CTexture GetNewTexture(int origWidth, int origHeight, int dataWidth = 0, int dataHeight = 0)
|
||||||
|
{
|
||||||
|
Debug.Assert(origWidth > 0 && origHeight > 0);
|
||||||
|
Debug.Assert(dataWidth > 0 || dataHeight <= 0);
|
||||||
|
int id;
|
||||||
|
lock (_MutexID)
|
||||||
|
{
|
||||||
|
id = _NextID++;
|
||||||
|
}
|
||||||
|
Size origSize = new Size(origWidth, origHeight);
|
||||||
|
Size dataSize = (dataHeight > 0) ? new Size(dataWidth, dataHeight) : origSize;
|
||||||
|
return new CTexture(id, origSize, dataSize, _CheckForNextPowerOf2(dataSize.Width), _CheckForNextPowerOf2(dataSize.Height));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
|
||||||
using VocaluxeLib.Draw;
|
|
||||||
|
|
||||||
namespace Vocaluxe.Lib.Draw
|
|
||||||
{
|
|
||||||
static class CDrawHelper
|
|
||||||
{
|
|
||||||
public static bool NonPowerOf2TextureSupported;
|
|
||||||
|
|
||||||
private static readonly Object _MutexID = new object();
|
|
||||||
private static int _NextID;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Calculates the next power of two if the device has the POW2 flag set
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="n">The value of which the next power of two will be calculated</param>
|
|
||||||
/// <returns>The next power of two</returns>
|
|
||||||
private static int _CheckForNextPowerOf2(int n)
|
|
||||||
{
|
|
||||||
if (NonPowerOf2TextureSupported)
|
|
||||||
return n;
|
|
||||||
if (n < 0)
|
|
||||||
throw new ArgumentOutOfRangeException("n", "Must be positive.");
|
|
||||||
return (int)Math.Pow(2, Math.Ceiling(Math.Log(n, 2)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CTexture GetNewTexture(int origWidth, int origHeight, int dataWidth = 0, int dataHeight = 0)
|
|
||||||
{
|
|
||||||
Debug.Assert(origWidth > 0 && origHeight > 0);
|
|
||||||
Debug.Assert(dataWidth > 0 || dataHeight <= 0);
|
|
||||||
int id;
|
|
||||||
lock (_MutexID)
|
|
||||||
{
|
|
||||||
id = _NextID++;
|
|
||||||
}
|
|
||||||
Size origSize = new Size(origWidth, origHeight);
|
|
||||||
Size dataSize = (dataHeight > 0) ? new Size(dataWidth, dataHeight) : origSize;
|
|
||||||
return new CTexture(id, origSize, dataSize, _CheckForNextPowerOf2(dataSize.Width), _CheckForNextPowerOf2(dataSize.Height));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+30
-118
@@ -54,26 +54,18 @@ using TextureTarget = OpenTK.Graphics.OpenGL.TextureTarget;
|
|||||||
|
|
||||||
namespace Vocaluxe.Lib.Draw
|
namespace Vocaluxe.Lib.Draw
|
||||||
{
|
{
|
||||||
struct SClientRect
|
class CFormHook : Form, CDrawBaseWindows.IFormHook
|
||||||
{
|
{
|
||||||
public Point Location;
|
public CDrawBaseWindows.MessageEventHandler OnMessage { private get; set; }
|
||||||
public int Width;
|
|
||||||
public int Height;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct STextureQueue
|
protected override void WndProc(ref Message m)
|
||||||
{
|
{
|
||||||
public readonly CTexture Texture;
|
if (OnMessage(ref m))
|
||||||
public readonly byte[] Data;
|
base.WndProc(ref m);
|
||||||
|
|
||||||
public STextureQueue(CTexture texture, byte[] data)
|
|
||||||
{
|
|
||||||
Texture = texture;
|
|
||||||
Data = data;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class COpenGL : Form, IDraw
|
class COpenGL : CDrawBaseWindows, IDraw
|
||||||
{
|
{
|
||||||
#region private vars
|
#region private vars
|
||||||
private readonly CKeys _Keys;
|
private readonly CKeys _Keys;
|
||||||
@@ -82,9 +74,6 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
private readonly GLControl _Control;
|
private readonly GLControl _Control;
|
||||||
|
|
||||||
private SClientRect _Restore;
|
|
||||||
private bool _Fullscreen;
|
|
||||||
|
|
||||||
private readonly Dictionary<int, CTexture> _Textures = new Dictionary<int, CTexture>();
|
private readonly Dictionary<int, CTexture> _Textures = new Dictionary<int, CTexture>();
|
||||||
private readonly Queue<STextureQueue> _TexturesToLoad = new Queue<STextureQueue>();
|
private readonly Queue<STextureQueue> _TexturesToLoad = new Queue<STextureQueue>();
|
||||||
|
|
||||||
@@ -98,8 +87,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public COpenGL()
|
public COpenGL()
|
||||||
{
|
{
|
||||||
Icon = new Icon(Path.Combine(CSettings.ProgramFolder, CSettings.FileNameIcon));
|
_Form = new CFormHook();
|
||||||
|
|
||||||
//Check AA Mode
|
//Check AA Mode
|
||||||
CConfig.AAMode = (EAntiAliasingModes)_CheckAntiAliasingMode((int)CConfig.AAMode);
|
CConfig.AAMode = (EAntiAliasingModes)_CheckAntiAliasingMode((int)CConfig.AAMode);
|
||||||
|
|
||||||
@@ -122,13 +110,13 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
_Control.MakeCurrent();
|
_Control.MakeCurrent();
|
||||||
_Control.VSync = CConfig.VSync == EOffOn.TR_CONFIG_ON;
|
_Control.VSync = CConfig.VSync == EOffOn.TR_CONFIG_ON;
|
||||||
|
|
||||||
Controls.Add(_Control);
|
_Form.Controls.Add(_Control);
|
||||||
|
|
||||||
|
|
||||||
_Keys = new CKeys();
|
_Keys = new CKeys();
|
||||||
Paint += _OnPaintEvent;
|
_Form.Closing += _OnClosingEvent;
|
||||||
Closing += _OnClosingEvent;
|
_Form.Load += _OnLoad;
|
||||||
Resize += _OnResizeEvent;
|
_Form.Resize += _OnResize;
|
||||||
|
|
||||||
_Control.KeyDown += _OnKeyDownEvent;
|
_Control.KeyDown += _OnKeyDownEvent;
|
||||||
_Control.PreviewKeyDown += _OnPreviewKeyDownEvent;
|
_Control.PreviewKeyDown += _OnPreviewKeyDownEvent;
|
||||||
@@ -143,10 +131,11 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
_Control.MouseLeave += _OnMouseLeave;
|
_Control.MouseLeave += _OnMouseLeave;
|
||||||
_Control.MouseEnter += _OnMouseEnter;
|
_Control.MouseEnter += _OnMouseEnter;
|
||||||
|
|
||||||
ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH);
|
_Form.ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH);
|
||||||
CenterToScreen();
|
|
||||||
|
|
||||||
CDrawHelper.NonPowerOf2TextureSupported = false;
|
_CenterToScreen();
|
||||||
|
|
||||||
|
_NonPowerOf2TextureSupported = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Helpers
|
#region Helpers
|
||||||
@@ -209,100 +198,24 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
return result - 8;
|
return result - 8;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private void _ToggleFullScreen()
|
|
||||||
{
|
|
||||||
if (!_Fullscreen)
|
|
||||||
_EnterFullScreen();
|
|
||||||
else
|
|
||||||
_LeaveFullScreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _EnterFullScreen()
|
|
||||||
{
|
|
||||||
_Fullscreen = true;
|
|
||||||
|
|
||||||
_Restore.Location = Location;
|
|
||||||
_Restore.Width = Width;
|
|
||||||
_Restore.Height = Height;
|
|
||||||
|
|
||||||
FormBorderStyle = FormBorderStyle.None;
|
|
||||||
|
|
||||||
int screenNr = 0;
|
|
||||||
for (int i = 0; i < Screen.AllScreens.Length; i++)
|
|
||||||
{
|
|
||||||
Screen scr = Screen.AllScreens[i];
|
|
||||||
if (scr.Bounds.Top <= Top && scr.Bounds.Left <= Left)
|
|
||||||
screenNr = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
DesktopBounds = new Rectangle(Screen.AllScreens[screenNr].Bounds.Location, new Size(Screen.AllScreens[screenNr].Bounds.Width, Screen.AllScreens[screenNr].Bounds.Height));
|
|
||||||
|
|
||||||
if (WindowState == FormWindowState.Maximized)
|
|
||||||
{
|
|
||||||
WindowState = FormWindowState.Normal;
|
|
||||||
_DoResize();
|
|
||||||
WindowState = FormWindowState.Maximized;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_DoResize();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _LeaveFullScreen()
|
|
||||||
{
|
|
||||||
_Fullscreen = false;
|
|
||||||
|
|
||||||
FormBorderStyle = FormBorderStyle.Sizable;
|
|
||||||
DesktopBounds = new Rectangle(_Restore.Location, new Size(_Restore.Width, _Restore.Height));
|
|
||||||
}
|
|
||||||
#endregion Helpers
|
#endregion Helpers
|
||||||
|
|
||||||
#region form events
|
#region form events
|
||||||
private void _OnPaintEvent(object sender, PaintEventArgs e) {}
|
|
||||||
|
|
||||||
private void _OnResizeEvent(object sender, EventArgs e) {}
|
|
||||||
|
|
||||||
private void _OnClosingEvent(object sender, CancelEventArgs e)
|
private void _OnClosingEvent(object sender, CancelEventArgs e)
|
||||||
{
|
{
|
||||||
_Run = false;
|
_Run = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnLoad(EventArgs e)
|
private static void _OnLoad(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
GL.ClearColor(Color.Black);
|
GL.ClearColor(Color.Black);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResize(EventArgs e)
|
private void _OnResize(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnResize(e);
|
_Control.ClientSize = _Form.ClientSize;
|
||||||
|
|
||||||
_Control.ClientSize = ClientSize;
|
|
||||||
_DoResize();
|
_DoResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void WndProc(ref Message m)
|
|
||||||
{
|
|
||||||
switch (m.Msg)
|
|
||||||
{
|
|
||||||
case 0x112: // WM_SYSCOMMAND
|
|
||||||
switch ((int)m.WParam & 0xFFF0)
|
|
||||||
{
|
|
||||||
case 0xF100: // SC_KEYMENU
|
|
||||||
m.Result = IntPtr.Zero;
|
|
||||||
break;
|
|
||||||
case 0xF140: // SC_SCREENSAVER
|
|
||||||
case 0xF170: // SC_MONITORPOWER
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
base.WndProc(ref m);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
base.WndProc(ref m);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion form events
|
#endregion form events
|
||||||
|
|
||||||
#region mouse event handlers
|
#region mouse event handlers
|
||||||
@@ -361,7 +274,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
}
|
}
|
||||||
#endregion keyboard event handlers
|
#endregion keyboard event handlers
|
||||||
|
|
||||||
private void _DoResize()
|
protected override void _DoResize()
|
||||||
{
|
{
|
||||||
_H = _Control.Height;
|
_H = _Control.Height;
|
||||||
_W = _Control.Width;
|
_W = _Control.Width;
|
||||||
@@ -389,9 +302,10 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
#region implementation
|
#region implementation
|
||||||
|
|
||||||
#region main stuff
|
#region main stuff
|
||||||
public bool Init()
|
public override bool Init()
|
||||||
{
|
{
|
||||||
Text = CSettings.GetFullVersionText();
|
if (!base.Init())
|
||||||
|
return false;
|
||||||
|
|
||||||
// Init Texturing
|
// Init Texturing
|
||||||
GL.Enable(EnableCap.Texture2D);
|
GL.Enable(EnableCap.Texture2D);
|
||||||
@@ -410,7 +324,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
{
|
{
|
||||||
_Run = true;
|
_Run = true;
|
||||||
int delay = 0;
|
int delay = 0;
|
||||||
Show();
|
_Form.Show();
|
||||||
|
|
||||||
if (CConfig.FullScreen == EOffOn.TR_CONFIG_ON)
|
if (CConfig.FullScreen == EOffOn.TR_CONFIG_ON)
|
||||||
_EnterFullScreen();
|
_EnterFullScreen();
|
||||||
@@ -441,14 +355,14 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
}
|
}
|
||||||
Close();
|
_Form.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Unload()
|
public void Unload()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Close();
|
_Form.Close();
|
||||||
}
|
}
|
||||||
catch {}
|
catch {}
|
||||||
var textures = new CTexture[_Textures.Count];
|
var textures = new CTexture[_Textures.Count];
|
||||||
@@ -476,7 +390,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public CTexture CopyScreen()
|
public CTexture CopyScreen()
|
||||||
{
|
{
|
||||||
CTexture texture = CDrawHelper.GetNewTexture(_W, _H);
|
CTexture texture = GetNewTexture(_W, _H);
|
||||||
|
|
||||||
texture.Name = GL.GenTexture();
|
texture.Name = GL.GenTexture();
|
||||||
GL.BindTexture(TextureTarget.Texture2D, texture.Name);
|
GL.BindTexture(TextureTarget.Texture2D, texture.Name);
|
||||||
@@ -676,7 +590,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
int w = Math.Min(bmp.Width, maxSize);
|
int w = Math.Min(bmp.Width, maxSize);
|
||||||
int h = Math.Min(bmp.Height, maxSize);
|
int h = Math.Min(bmp.Height, maxSize);
|
||||||
|
|
||||||
CTexture texture = CDrawHelper.GetNewTexture(w, h);
|
CTexture texture = GetNewTexture(w, h);
|
||||||
texture.Name = GL.GenTexture();
|
texture.Name = GL.GenTexture();
|
||||||
|
|
||||||
GL.BindTexture(TextureTarget.Texture2D, texture.Name);
|
GL.BindTexture(TextureTarget.Texture2D, texture.Name);
|
||||||
@@ -729,7 +643,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public CTexture AddTexture(int w, int h, byte[] data)
|
public CTexture AddTexture(int w, int h, byte[] data)
|
||||||
{
|
{
|
||||||
CTexture texture = CDrawHelper.GetNewTexture(w, h);
|
CTexture texture = GetNewTexture(w, h);
|
||||||
|
|
||||||
_CreateTexture(texture, data);
|
_CreateTexture(texture, data);
|
||||||
|
|
||||||
@@ -776,7 +690,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
public CTexture EnqueueTexture(int w, int h, byte[] data)
|
public CTexture EnqueueTexture(int w, int h, byte[] data)
|
||||||
{
|
{
|
||||||
CTexture texture = CDrawHelper.GetNewTexture(w, h);
|
CTexture texture = GetNewTexture(w, h);
|
||||||
|
|
||||||
lock (_Textures)
|
lock (_Textures)
|
||||||
{
|
{
|
||||||
@@ -864,11 +778,9 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
{
|
{
|
||||||
lock (_Textures)
|
lock (_Textures)
|
||||||
{
|
{
|
||||||
if (texture != null && _Textures.ContainsKey(texture.ID) && texture.Name>0)
|
if (texture != null && _Textures.ContainsKey(texture.ID) && texture.Name > 0)
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -224,7 +224,7 @@
|
|||||||
<Compile Include="Lib\Database\CDatabaseBase.cs" />
|
<Compile Include="Lib\Database\CDatabaseBase.cs" />
|
||||||
<Compile Include="Lib\Database\CHighscoreDB.cs" />
|
<Compile Include="Lib\Database\CHighscoreDB.cs" />
|
||||||
<Compile Include="Lib\Database\CResourceDB.cs" />
|
<Compile Include="Lib\Database\CResourceDB.cs" />
|
||||||
<Compile Include="Lib\Draw\CDrawHelper.cs" />
|
<Compile Include="Lib\Draw\CDrawBase.cs" />
|
||||||
<Compile Include="Lib\Sound\Playback\CAudioStreamBase.cs" />
|
<Compile Include="Lib\Sound\Playback\CAudioStreamBase.cs" />
|
||||||
<Compile Include="Lib\Sound\Playback\CPlaybackBase.cs" />
|
<Compile Include="Lib\Sound\Playback\CPlaybackBase.cs" />
|
||||||
<Compile Include="Lib\Sound\Playback\CRingBuffer.cs" />
|
<Compile Include="Lib\Sound\Playback\CRingBuffer.cs" />
|
||||||
|
|||||||
Reference in new issue
Block a user