Merge pull request #27 from Vocaluxe/release-0.1
merge Release 0.1 branch changes into develop branch
This commit is contained in:
commit
8a2df18a3c
21 files changed
+309
-188
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -238,13 +238,13 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
_Cover.Clear();
|
_Cover.Clear();
|
||||||
List<string> cover = CHelper.GetValuesFromXML("Cover", navigator);
|
List<string> cover = CHelper.GetValuesFromXML("Cover", navigator);
|
||||||
for (int i = 1; i <= cover.Count; i++)
|
for (int i = 0; i < cover.Count; i++)
|
||||||
{
|
{
|
||||||
SCover sk = new SCover();
|
SCover sk = new SCover();
|
||||||
string name = String.Empty;
|
string name = String.Empty;
|
||||||
string value = String.Empty;
|
string value = String.Empty;
|
||||||
CHelper.GetValueFromXML("//root/Cover/Cover" + i + "/Name", navigator, ref name, String.Empty);
|
CHelper.GetValueFromXML("//root/Cover/" + cover[i] + "/Name", navigator, ref name, String.Empty);
|
||||||
CHelper.GetValueFromXML("//root/Cover/Cover" + i + "/Path", navigator, ref value, String.Empty);
|
CHelper.GetValueFromXML("//root/Cover/" + cover[i] + "/Path", navigator, ref value, String.Empty);
|
||||||
sk.Name = name;
|
sk.Name = name;
|
||||||
sk.Value = Path.Combine(coverTheme.Folder,value);
|
sk.Value = Path.Combine(coverTheme.Folder,value);
|
||||||
if (File.Exists(Path.Combine(CSettings.sFolderCover, Path.Combine(coverTheme.Folder, value))))
|
if (File.Exists(Path.Combine(CSettings.sFolderCover, Path.Combine(coverTheme.Folder, value))))
|
||||||
|
|||||||
+16
-4
@@ -22,8 +22,14 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
if (_LogFile != null)
|
if (_LogFile != null)
|
||||||
{
|
{
|
||||||
_LogFile.Flush();
|
try
|
||||||
_LogFile.Close();
|
{
|
||||||
|
_LogFile.Flush();
|
||||||
|
_LogFile.Close();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,8 +38,14 @@ namespace Vocaluxe.Base
|
|||||||
if (_LogFile == null)
|
if (_LogFile == null)
|
||||||
Open();
|
Open();
|
||||||
|
|
||||||
_LogFile.WriteLine(Text);
|
try
|
||||||
_LogFile.Flush();
|
{
|
||||||
|
_LogFile.WriteLine(Text);
|
||||||
|
_LogFile.Flush();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Open()
|
private void Open()
|
||||||
|
|||||||
+32
-1
@@ -4,6 +4,7 @@ using System.Diagnostics;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
using Vocaluxe.Lib.Draw;
|
using Vocaluxe.Lib.Draw;
|
||||||
using Vocaluxe.Lib.Song;
|
using Vocaluxe.Lib.Song;
|
||||||
@@ -60,6 +61,8 @@ namespace Vocaluxe.Base
|
|||||||
private static string _SearchFilter = String.Empty;
|
private static string _SearchFilter = String.Empty;
|
||||||
private static EOffOn _Tabs = CConfig.Tabs;
|
private static EOffOn _Tabs = CConfig.Tabs;
|
||||||
|
|
||||||
|
private static Thread _CoverLoaderThread = new Thread(new ThreadStart(_LoadCover));
|
||||||
|
|
||||||
public static string SearchFilter
|
public static string SearchFilter
|
||||||
{
|
{
|
||||||
get { return _SearchFilter; }
|
get { return _SearchFilter; }
|
||||||
@@ -849,7 +852,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static void LoadCover(long WaitTime, int NumLoads)
|
public static void LoadCover(long WaitTime, int NumLoads)
|
||||||
{
|
{
|
||||||
if (CConfig.Renderer != ERenderer.TR_CONFIG_SOFTWARE)
|
if (CConfig.Renderer == ERenderer.TR_CONFIG_SOFTWARE)
|
||||||
return; //should be removed as soon as the other renderer are ready for queque
|
return; //should be removed as soon as the other renderer are ready for queque
|
||||||
|
|
||||||
if (!SongsLoaded)
|
if (!SongsLoaded)
|
||||||
@@ -858,6 +861,17 @@ namespace Vocaluxe.Base
|
|||||||
if (CoverLoaded)
|
if (CoverLoaded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (_CoverLoaderThread.ThreadState == System.Threading.ThreadState.Unstarted)
|
||||||
|
{
|
||||||
|
_CoverLoaderThread.Name = "CoverLoader";
|
||||||
|
_CoverLoaderThread.Priority = ThreadPriority.BelowNormal;
|
||||||
|
_CoverLoaderThread.IsBackground = true;
|
||||||
|
_CoverLoaderThread.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
if (!_CoverLoadTimer.IsRunning)
|
if (!_CoverLoadTimer.IsRunning)
|
||||||
{
|
{
|
||||||
_CoverLoadTimer.Reset();
|
_CoverLoadTimer.Reset();
|
||||||
@@ -888,6 +902,23 @@ namespace Vocaluxe.Base
|
|||||||
_CoverLoadTimer.Start();
|
_CoverLoadTimer.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
* */
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void _LoadCover()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _Songs.Count; i++)
|
||||||
|
{
|
||||||
|
CSong song = _Songs[i];
|
||||||
|
|
||||||
|
song.ReadNotes();
|
||||||
|
STexture texture = song.CoverTextureSmall;
|
||||||
|
song.CoverTextureBig = texture;
|
||||||
|
_CoverLoadIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
_CoverLoaded = true;
|
||||||
|
CDataBase.CommitCovers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+46
-33
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Xml.XPath;
|
using System.Xml.XPath;
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ namespace Vocaluxe.Base
|
|||||||
public string Path;
|
public string Path;
|
||||||
public string FileName;
|
public string FileName;
|
||||||
|
|
||||||
public List<SkinElement> SkinList;
|
public Dictionary<string, SkinElement> SkinList;
|
||||||
public List<SkinElement> VideoList;
|
public List<SkinElement> VideoList;
|
||||||
|
|
||||||
public SColors ThemeColors;
|
public SColors ThemeColors;
|
||||||
@@ -163,30 +164,49 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
string value = String.Empty;
|
string value = String.Empty;
|
||||||
|
|
||||||
|
|
||||||
// load skins/textures
|
// load skins/textures
|
||||||
for (int i = 0; i < _Skins[index].SkinList.Count; i++)
|
List<string> keys = new List<string>(_Skins[index].SkinList.Keys);
|
||||||
|
|
||||||
|
foreach (string name in keys)
|
||||||
{
|
{
|
||||||
CHelper.GetValueFromXML("//root/Skins/" + _Skins[index].SkinList[i].Name, navigator, ref value, String.Empty);
|
try
|
||||||
SkinElement sk = new SkinElement();
|
{
|
||||||
sk.Name = _Skins[index].SkinList[i].Name;
|
CHelper.GetValueFromXML("//root/Skins/" + name, navigator, ref value, String.Empty);
|
||||||
sk.Value = value;
|
SkinElement sk = _Skins[index].SkinList[name];
|
||||||
sk.VideoIndex = -1;
|
sk.Value = value;
|
||||||
sk.Texture = CDraw.AddTexture(Path.Combine(_Skins[index].Path, sk.Value));
|
sk.VideoIndex = -1;
|
||||||
_Skins[index].SkinList[i] = sk;
|
sk.Texture = CDraw.AddTexture(Path.Combine(_Skins[index].Path, sk.Value));
|
||||||
|
_Skins[index].SkinList[name] = sk;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Error on loading texture \"" + name + "\": " + e.Message + e.StackTrace);
|
||||||
|
CLog.LogError("Error on loading texture \"" + name + "\": " + e.Message + e.StackTrace);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// load videos
|
// load videos
|
||||||
for (int i = 0; i < _Skins[index].VideoList.Count; i++)
|
for (int i = 0; i < _Skins[index].VideoList.Count; i++)
|
||||||
{
|
{
|
||||||
CHelper.GetValueFromXML("//root/Videos/" + _Skins[index].VideoList[i].Name, navigator, ref value, String.Empty);
|
try
|
||||||
SkinElement sk = new SkinElement();
|
{
|
||||||
sk.Name = _Skins[index].VideoList[i].Name;
|
CHelper.GetValueFromXML("//root/Videos/" + _Skins[index].VideoList[i].Name, navigator, ref value, String.Empty);
|
||||||
sk.Value = value;
|
SkinElement sk = new SkinElement();
|
||||||
sk.VideoIndex = CVideo.VdLoad(Path.Combine(_Skins[index].Path, sk.Value));
|
sk.Name = _Skins[index].VideoList[i].Name;
|
||||||
CVideo.VdSetLoop(sk.VideoIndex, true);
|
sk.Value = value;
|
||||||
CVideo.VdPause(sk.VideoIndex);
|
sk.VideoIndex = CVideo.VdLoad(Path.Combine(_Skins[index].Path, sk.Value));
|
||||||
sk.Texture = new STexture(-1);
|
CVideo.VdSetLoop(sk.VideoIndex, true);
|
||||||
_Skins[index].VideoList[i] = sk;
|
CVideo.VdPause(sk.VideoIndex);
|
||||||
|
sk.Texture = new STexture(-1);
|
||||||
|
_Skins[index].VideoList[i] = sk;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Error on loading video \"" + _Skins[index].VideoList[i].Name + "\": " + e.Message + e.StackTrace);
|
||||||
|
CLog.LogError("Error on loading video \"" + _Skins[index].VideoList[i].Name + "\": " + e.Message + e.StackTrace);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// load colors
|
// load colors
|
||||||
@@ -199,9 +219,9 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < _Skins.Count; i++)
|
for (int i = 0; i < _Skins.Count; i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < _Skins[i].SkinList.Count; j++)
|
foreach (SkinElement sk in _Skins[i].SkinList.Values)
|
||||||
{
|
{
|
||||||
STexture Texture = _Skins[i].SkinList[j].Texture;
|
STexture Texture = sk.Texture;
|
||||||
CDraw.RemoveTexture(ref Texture);
|
CDraw.RemoveTexture(ref Texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,7 +355,7 @@ namespace Vocaluxe.Base
|
|||||||
#region Skins
|
#region Skins
|
||||||
writer.WriteStartElement("Skins");
|
writer.WriteStartElement("Skins");
|
||||||
|
|
||||||
foreach (SkinElement element in _Skins[SkinIndex].SkinList)
|
foreach (SkinElement element in _Skins[SkinIndex].SkinList.Values)
|
||||||
{
|
{
|
||||||
writer.WriteElementString(element.Name, element.Value);
|
writer.WriteElementString(element.Name, element.Value);
|
||||||
}
|
}
|
||||||
@@ -489,14 +509,14 @@ namespace Vocaluxe.Base
|
|||||||
skin.Path = path;
|
skin.Path = path;
|
||||||
skin.FileName = file;
|
skin.FileName = file;
|
||||||
|
|
||||||
skin.SkinList = new List<SkinElement>();
|
skin.SkinList = new Dictionary<string, SkinElement>();
|
||||||
List<string> names = CHelper.GetValuesFromXML("Skins", navigator);
|
List<string> names = CHelper.GetValuesFromXML("Skins", navigator);
|
||||||
foreach (string str in names)
|
foreach (string str in names)
|
||||||
{
|
{
|
||||||
SkinElement sk = new SkinElement();
|
SkinElement sk = new SkinElement();
|
||||||
sk.Name = str;
|
sk.Name = str;
|
||||||
sk.Value = String.Empty;
|
sk.Value = String.Empty;
|
||||||
skin.SkinList.Add(sk);
|
skin.SkinList[str] = sk;
|
||||||
}
|
}
|
||||||
|
|
||||||
skin.VideoList = new List<SkinElement>();
|
skin.VideoList = new List<SkinElement>();
|
||||||
@@ -573,16 +593,9 @@ namespace Vocaluxe.Base
|
|||||||
public static STexture GetSkinTexture(string TextureName)
|
public static STexture GetSkinTexture(string TextureName)
|
||||||
{
|
{
|
||||||
int SkinIndex = GetSkinIndex();
|
int SkinIndex = GetSkinIndex();
|
||||||
if (SkinIndex != -1)
|
if (SkinIndex != -1 && TextureName != null && _Skins[SkinIndex].SkinList.ContainsKey(TextureName))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _Skins[SkinIndex].SkinList.Count; i++)
|
return _Skins[SkinIndex].SkinList[TextureName].Texture;
|
||||||
{
|
|
||||||
SkinElement sk = _Skins[SkinIndex].SkinList[i];
|
|
||||||
if (sk.Name == TextureName)
|
|
||||||
{
|
|
||||||
return sk.Texture;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return new STexture(-1);
|
return new STexture(-1);
|
||||||
}
|
}
|
||||||
@@ -599,7 +612,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
private static string GetSkinFileName(string SkinName, int SkinIndex, bool ReturnPath)
|
private static string GetSkinFileName(string SkinName, int SkinIndex, bool ReturnPath)
|
||||||
{
|
{
|
||||||
foreach (SkinElement sk in _Skins[SkinIndex].SkinList)
|
foreach (SkinElement sk in _Skins[SkinIndex].SkinList.Values)
|
||||||
{
|
{
|
||||||
if (sk.Name == SkinName)
|
if (sk.Name == SkinName)
|
||||||
{
|
{
|
||||||
|
|||||||
+20
-18
@@ -69,8 +69,11 @@ namespace Vocaluxe.Base
|
|||||||
public int Y;
|
public int Y;
|
||||||
public bool LB; //left button click
|
public bool LB; //left button click
|
||||||
public bool RB; //right button click
|
public bool RB; //right button click
|
||||||
|
public bool MB; //middle button click
|
||||||
|
|
||||||
public bool LBH; //left button hold (when moving)
|
public bool LBH; //left button hold (when moving)
|
||||||
public bool RBH; //right button hold (when moving)
|
public bool RBH; //right button hold (when moving)
|
||||||
|
public bool MBH; //middle button hold (when moving)
|
||||||
|
|
||||||
public bool ModALT;
|
public bool ModALT;
|
||||||
public bool ModSHIFT;
|
public bool ModSHIFT;
|
||||||
@@ -79,15 +82,17 @@ namespace Vocaluxe.Base
|
|||||||
public Modifier Mod;
|
public Modifier Mod;
|
||||||
public int Wheel;
|
public int Wheel;
|
||||||
|
|
||||||
public MouseEvent(bool alt, bool shift, bool ctrl, int x, int y, bool lb, bool rb, int wheel, bool lbh, bool rbh)
|
public MouseEvent(bool alt, bool shift, bool ctrl, int x, int y, bool lb, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh)
|
||||||
{
|
{
|
||||||
X = x;
|
X = x;
|
||||||
Y = y;
|
Y = y;
|
||||||
LB = lb;
|
LB = lb;
|
||||||
RB = rb;
|
RB = rb;
|
||||||
|
MB = mb;
|
||||||
|
|
||||||
LBH = lbh;
|
LBH = lbh;
|
||||||
RBH = rbh;
|
RBH = rbh;
|
||||||
|
MBH = mbh;
|
||||||
|
|
||||||
ModALT = alt;
|
ModALT = alt;
|
||||||
ModSHIFT = shift;
|
ModSHIFT = shift;
|
||||||
@@ -311,7 +316,7 @@ namespace Vocaluxe.Base
|
|||||||
class CMouse
|
class CMouse
|
||||||
{
|
{
|
||||||
private List<MouseEvent> _EventsPool;
|
private List<MouseEvent> _EventsPool;
|
||||||
private List<MouseEvent> _ActualPool;
|
private List<MouseEvent> _CurrentPool;
|
||||||
|
|
||||||
private int _x = 0;
|
private int _x = 0;
|
||||||
private int _y = 0;
|
private int _y = 0;
|
||||||
@@ -322,8 +327,6 @@ namespace Vocaluxe.Base
|
|||||||
private bool _ModCTRL;
|
private bool _ModCTRL;
|
||||||
private bool _ModSHIFT;
|
private bool _ModSHIFT;
|
||||||
|
|
||||||
private System.Diagnostics.Stopwatch _timer;
|
|
||||||
|
|
||||||
public int X
|
public int X
|
||||||
{
|
{
|
||||||
get { return _x; }
|
get { return _x; }
|
||||||
@@ -343,15 +346,14 @@ namespace Vocaluxe.Base
|
|||||||
_ModSHIFT = false;
|
_ModSHIFT = false;
|
||||||
|
|
||||||
_EventsPool = new List<MouseEvent>();
|
_EventsPool = new List<MouseEvent>();
|
||||||
_ActualPool = new List<MouseEvent>();
|
_CurrentPool = new List<MouseEvent>();
|
||||||
_timer = new System.Diagnostics.Stopwatch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Add(bool alt, bool shift, bool ctrl, int x, int y, bool lb, bool rb, int wheel, bool lbh, bool rbh)
|
private void Add(bool alt, bool shift, bool ctrl, int x, int y, bool lb, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh)
|
||||||
{
|
{
|
||||||
x = (int)((float)x * (float)CSettings.iRenderW / (float)CDraw.GetScreenWidth());
|
x = (int)((float)x * (float)CSettings.iRenderW / (float)CDraw.GetScreenWidth());
|
||||||
y = (int)((float)y * (float)CSettings.iRenderH / (float)CDraw.GetScreenHeight());
|
y = (int)((float)y * (float)CSettings.iRenderH / (float)CDraw.GetScreenHeight());
|
||||||
MouseEvent pool = new MouseEvent(alt, shift, ctrl, x, y, lb, rb, -wheel/120, lbh, rbh);
|
MouseEvent pool = new MouseEvent(alt, shift, ctrl, x, y, lb, rb, -wheel/120, lbh, rbh, mb, mbh);
|
||||||
|
|
||||||
lock (_CopyLock)
|
lock (_CopyLock)
|
||||||
{
|
{
|
||||||
@@ -359,14 +361,11 @@ namespace Vocaluxe.Base
|
|||||||
}
|
}
|
||||||
_x = x;
|
_x = x;
|
||||||
_y = y;
|
_y = y;
|
||||||
|
|
||||||
_timer.Reset();
|
|
||||||
_timer.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Del(int index)
|
private void Del(int index)
|
||||||
{
|
{
|
||||||
_ActualPool.RemoveAt(index);
|
_CurrentPool.RemoveAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckModifiers()
|
private void CheckModifiers()
|
||||||
@@ -381,19 +380,22 @@ namespace Vocaluxe.Base
|
|||||||
public void MouseMove(MouseEventArgs e)
|
public void MouseMove(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
CheckModifiers();
|
CheckModifiers();
|
||||||
Add(_ModALT, _ModSHIFT, _ModCTRL, e.X, e.Y, false, false, e.Delta, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right);
|
Add(_ModALT, _ModSHIFT, _ModCTRL, e.X, e.Y, false, false, e.Delta, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right,
|
||||||
|
false, e.Button == MouseButtons.Middle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MouseWheel(MouseEventArgs e)
|
public void MouseWheel(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
CheckModifiers();
|
CheckModifiers();
|
||||||
Add(_ModALT, _ModSHIFT, _ModCTRL, e.X, e.Y, false, false, e.Delta, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right);
|
Add(_ModALT, _ModSHIFT, _ModCTRL, e.X, e.Y, false, false, e.Delta, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right,
|
||||||
|
false, e.Button == MouseButtons.Middle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MouseDown(MouseEventArgs e)
|
public void MouseDown(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
CheckModifiers();
|
CheckModifiers();
|
||||||
Add(_ModALT, _ModSHIFT, _ModCTRL, e.X, e.Y, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right, e.Delta, false, false);
|
Add(_ModALT, _ModSHIFT, _ModCTRL, e.X, e.Y, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right, e.Delta, false, false,
|
||||||
|
e.Button == MouseButtons.Middle, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MouseUp(MouseEventArgs e)
|
public void MouseUp(MouseEventArgs e)
|
||||||
@@ -404,9 +406,9 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public bool PollEvent(ref MouseEvent MouseEvent)
|
public bool PollEvent(ref MouseEvent MouseEvent)
|
||||||
{
|
{
|
||||||
if (_ActualPool.Count > 0)
|
if (_CurrentPool.Count > 0)
|
||||||
{
|
{
|
||||||
MouseEvent = _ActualPool[0];
|
MouseEvent = _CurrentPool[0];
|
||||||
Del(0);
|
Del(0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -419,7 +421,7 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
foreach (MouseEvent e in _EventsPool)
|
foreach (MouseEvent e in _EventsPool)
|
||||||
{
|
{
|
||||||
_ActualPool.Add(e);
|
_CurrentPool.Add(e);
|
||||||
}
|
}
|
||||||
_EventsPool.Clear();
|
_EventsPool.Clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,8 +35,9 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
private Size _SizeBeforeMinimize;
|
private Size _SizeBeforeMinimize;
|
||||||
|
|
||||||
private Dictionary<int, STexture> _Textures;
|
private Dictionary<int, STexture> _Textures;
|
||||||
private List<Texture> _D3DTextures;
|
private Dictionary<int, Texture> _D3DTextures;
|
||||||
private List<STextureQueque> _Queque;
|
private List<STextureQueque> _Queque;
|
||||||
|
private Queue<int> _IDs;
|
||||||
|
|
||||||
private Object MutexTexture = new Object();
|
private Object MutexTexture = new Object();
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
private int y = 0;
|
private int y = 0;
|
||||||
private int x = 0;
|
private int x = 0;
|
||||||
|
|
||||||
private STexture blankTexture;
|
private STexture _BlankTexture;
|
||||||
|
|
||||||
private Queue<TexturedColoredVertex> _Vertices;
|
private Queue<TexturedColoredVertex> _Vertices;
|
||||||
private Queue<Texture> _VerticesTextures;
|
private Queue<Texture> _VerticesTextures;
|
||||||
@@ -63,8 +64,13 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
{
|
{
|
||||||
this.Icon = new System.Drawing.Icon(Path.Combine(System.Environment.CurrentDirectory, CSettings.sIcon));
|
this.Icon = new System.Drawing.Icon(Path.Combine(System.Environment.CurrentDirectory, CSettings.sIcon));
|
||||||
_Textures = new Dictionary<int, STexture>();
|
_Textures = new Dictionary<int, STexture>();
|
||||||
_D3DTextures = new List<Texture>();
|
_D3DTextures = new Dictionary<int, Texture>();
|
||||||
_Queque = new List<STextureQueque>();
|
_Queque = new List<STextureQueque>();
|
||||||
|
_IDs = new Queue<int>();
|
||||||
|
|
||||||
|
//Fill Queue with 100000 IDs
|
||||||
|
for (int i = 0; i < 100000; i++)
|
||||||
|
_IDs.Enqueue(i);
|
||||||
|
|
||||||
_Vertices = new Queue<TexturedColoredVertex>();
|
_Vertices = new Queue<TexturedColoredVertex>();
|
||||||
_VerticesTextures = new Queue<Texture>();
|
_VerticesTextures = new Queue<Texture>();
|
||||||
@@ -482,7 +488,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
Graphics g = Graphics.FromImage(blankMap);
|
Graphics g = Graphics.FromImage(blankMap);
|
||||||
g.Clear(Color.White);
|
g.Clear(Color.White);
|
||||||
g.Dispose();
|
g.Dispose();
|
||||||
blankTexture = AddTexture(blankMap);
|
_BlankTexture = AddTexture(blankMap);
|
||||||
|
|
||||||
blankMap.Dispose();
|
blankMap.Dispose();
|
||||||
return true;
|
return true;
|
||||||
@@ -505,6 +511,10 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
EnterFullScreen();
|
EnterFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Resize window if aspect ratio is incorrect
|
||||||
|
if ((float)w / (float)h != CSettings.GetRenderAspect())
|
||||||
|
RResize();
|
||||||
|
|
||||||
while (_Run)
|
while (_Run)
|
||||||
{
|
{
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
@@ -582,11 +592,14 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
public bool Unload()
|
public bool Unload()
|
||||||
{
|
{
|
||||||
//Dispose all textures
|
//Dispose all textures
|
||||||
for (int i = 0; i < _D3DTextures.Count; i++)
|
foreach (KeyValuePair<int, Texture> p in _D3DTextures)
|
||||||
{
|
{
|
||||||
if (_D3DTextures[i] != null)
|
if (p.Value != null)
|
||||||
_D3DTextures[i].Dispose();
|
{
|
||||||
|
p.Value.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TexturedColoredVertex.GetDeclaration(_Device).Dispose();
|
TexturedColoredVertex.GetDeclaration(_Device).Dispose();
|
||||||
_VertexBuffer.Dispose();
|
_VertexBuffer.Dispose();
|
||||||
_IndexBuffer.Dispose();
|
_IndexBuffer.Dispose();
|
||||||
@@ -712,7 +725,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
Surface textureSurface = tex.GetSurfaceLevel(0);
|
Surface textureSurface = tex.GetSurfaceLevel(0);
|
||||||
Surface.FromSurface(textureSurface, backbufferSurface, Filter.Default, 0);
|
Surface.FromSurface(textureSurface, backbufferSurface, Filter.Default, 0);
|
||||||
backbufferSurface.Dispose();
|
backbufferSurface.Dispose();
|
||||||
_D3DTextures.Add(tex);
|
_D3DTextures.Add(_IDs.Peek(), tex);
|
||||||
|
|
||||||
texture.color = new SColorF(1f, 1f, 1f, 1f);
|
texture.color = new SColorF(1f, 1f, 1f, 1f);
|
||||||
texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f);
|
texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f);
|
||||||
@@ -720,7 +733,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
texture.height = h;
|
texture.height = h;
|
||||||
texture.w2 = NextPowerOfTwo(texture.width);
|
texture.w2 = NextPowerOfTwo(texture.width);
|
||||||
texture.h2 = NextPowerOfTwo(texture.height);
|
texture.h2 = NextPowerOfTwo(texture.height);
|
||||||
texture.index = _D3DTextures.Count - 1;
|
texture.index = _IDs.Dequeue();
|
||||||
|
|
||||||
lock (MutexTexture)
|
lock (MutexTexture)
|
||||||
{
|
{
|
||||||
@@ -786,7 +799,7 @@ 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)
|
||||||
{
|
{
|
||||||
SColorF color = new SColorF(a / 255, g / 255, b / 255, a / 255);
|
SColorF color = new SColorF(a / 255, g / 255, b / 255, a / 255);
|
||||||
DrawTexture(blankTexture, new SRectF(x1, y1, x2, y2, 1), color);
|
DrawTexture(_BlankTexture, new SRectF(x1, y1, x2, y2, 1), color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -821,7 +834,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
/// <param name="rect">The coordinates in a SRectF struct</param>
|
/// <param name="rect">The coordinates in a SRectF struct</param>
|
||||||
public void DrawColor(SColorF color, SRectF rect)
|
public void DrawColor(SColorF color, SRectF rect)
|
||||||
{
|
{
|
||||||
DrawTexture(blankTexture, rect, color);
|
DrawTexture(_BlankTexture, rect, color);
|
||||||
}
|
}
|
||||||
#endregion Basic Draw Methods
|
#endregion Basic Draw Methods
|
||||||
#region Textures
|
#region Textures
|
||||||
@@ -890,13 +903,13 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
int w = bmp.Width;
|
int w = bmp.Width;
|
||||||
int h = bmp.Height;
|
int h = bmp.Height;
|
||||||
|
|
||||||
if (h >= w && w > MaxSize)
|
if (w > MaxSize)
|
||||||
{
|
{
|
||||||
h = (int)Math.Round((float)MaxSize / bmp.Width * bmp.Height);
|
h = (int)Math.Round((float)MaxSize / bmp.Width * bmp.Height);
|
||||||
w = MaxSize;
|
w = MaxSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w >= h && h > MaxSize)
|
if (h > MaxSize)
|
||||||
{
|
{
|
||||||
w = (int)Math.Round((float)MaxSize / bmp.Height * bmp.Width);
|
w = (int)Math.Round((float)MaxSize / bmp.Height * bmp.Width);
|
||||||
h = MaxSize;
|
h = MaxSize;
|
||||||
@@ -950,8 +963,8 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
texture.TexturePath = String.Empty;
|
texture.TexturePath = String.Empty;
|
||||||
lock (MutexTexture)
|
lock (MutexTexture)
|
||||||
{
|
{
|
||||||
_D3DTextures.Add(t);
|
_D3DTextures.Add(_IDs.Peek(), t);
|
||||||
texture.index = _D3DTextures.Count - 1;
|
texture.index = _IDs.Dequeue();
|
||||||
_Textures[texture.index] = texture;
|
_Textures[texture.index] = texture;
|
||||||
}
|
}
|
||||||
return texture;
|
return texture;
|
||||||
@@ -987,8 +1000,8 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
lock (MutexTexture)
|
lock (MutexTexture)
|
||||||
{
|
{
|
||||||
_D3DTextures.Add(null);
|
_D3DTextures.Add(_IDs.Peek(), null);
|
||||||
texture.index = _D3DTextures.Count - 1;
|
texture.index = _IDs.Dequeue();
|
||||||
queque.ID = texture.index;
|
queque.ID = texture.index;
|
||||||
_Queque.Add(queque);
|
_Queque.Add(queque);
|
||||||
_Textures[texture.index] = texture;
|
_Textures[texture.index] = texture;
|
||||||
@@ -1023,8 +1036,8 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
|
|
||||||
lock (MutexTexture)
|
lock (MutexTexture)
|
||||||
{
|
{
|
||||||
_D3DTextures.Add(t);
|
_D3DTextures.Add(_IDs.Peek(), t);
|
||||||
texture.index = _D3DTextures.Count - 1;
|
texture.index = _IDs.Dequeue();
|
||||||
_Textures[texture.index] = texture;
|
_Textures[texture.index] = texture;
|
||||||
}
|
}
|
||||||
return texture;
|
return texture;
|
||||||
@@ -1054,7 +1067,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
/// <returns>True if succeeded</returns>
|
/// <returns>True if succeeded</returns>
|
||||||
public bool UpdateTexture(ref STexture Texture, ref byte[] Data)
|
public bool UpdateTexture(ref STexture Texture, ref byte[] Data)
|
||||||
{
|
{
|
||||||
if ((Texture.index >= 0) && (_Textures.Count > 0) && (_D3DTextures.Count > Texture.index) && _TextureExists(ref Texture))
|
if ((Texture.index >= 0) && (_Textures.Count > 0) && _TextureExists(ref Texture))
|
||||||
{
|
{
|
||||||
DataRectangle rect = _D3DTextures[Texture.index].LockRectangle(0, LockFlags.None);
|
DataRectangle rect = _D3DTextures[Texture.index].LockRectangle(0, LockFlags.None);
|
||||||
for (int i = 0; i < Data.Length; )
|
for (int i = 0; i < Data.Length; )
|
||||||
@@ -1107,8 +1120,9 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
if ((Texture.index >= 0) && (_Textures.Count > 0))
|
if ((Texture.index >= 0) && (_Textures.Count > 0))
|
||||||
{
|
{
|
||||||
_D3DTextures[Texture.index].Dispose();
|
_D3DTextures[Texture.index].Dispose();
|
||||||
_D3DTextures[Texture.index] = null;
|
_D3DTextures.Remove(Texture.index);
|
||||||
_Textures.Remove(Texture.index);
|
_Textures.Remove(Texture.index);
|
||||||
|
_IDs.Enqueue(Texture.index);
|
||||||
Texture.index = -1;
|
Texture.index = -1;
|
||||||
Texture.ID = -1;
|
Texture.ID = -1;
|
||||||
}
|
}
|
||||||
@@ -1122,8 +1136,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
/// <param name="Texture">The texture to be drawn</param>
|
/// <param name="Texture">The texture to be drawn</param>
|
||||||
public void DrawTexture(STexture Texture)
|
public void DrawTexture(STexture Texture)
|
||||||
{
|
{
|
||||||
if ((Texture.index >= 0) && (_Textures.Count > 0) && (_D3DTextures.Count > Texture.index))
|
DrawTexture(Texture, Texture.rect, Texture.color);
|
||||||
DrawTexture(Texture, Texture.rect, Texture.color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1133,8 +1146,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
/// <param name="rect">A SRectF struct containing the destination coordinates</param>
|
/// <param name="rect">A SRectF struct containing the destination coordinates</param>
|
||||||
public void DrawTexture(STexture Texture, SRectF rect)
|
public void DrawTexture(STexture Texture, SRectF rect)
|
||||||
{
|
{
|
||||||
if ((Texture.index >= 0) && (_Textures.Count > 0) && (_D3DTextures.Count > Texture.index))
|
DrawTexture(Texture, rect, Texture.color, false);
|
||||||
DrawTexture(Texture, rect, Texture.color, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1145,8 +1157,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
/// <param name="color">A SColorF struct containing a color which the texture will be colored in</param>
|
/// <param name="color">A SColorF struct containing a color which the texture will be colored in</param>
|
||||||
public void DrawTexture(STexture Texture, SRectF rect, SColorF color)
|
public void DrawTexture(STexture Texture, SRectF rect, SColorF color)
|
||||||
{
|
{
|
||||||
if ((Texture.index >= 0) && (_Textures.Count > 0) && (_D3DTextures.Count > Texture.index))
|
DrawTexture(Texture, rect, color, false);
|
||||||
DrawTexture(Texture, rect, color, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1158,8 +1169,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
/// <param name="bounds">A SRectF struct containing which part of the texture should be drawn</param>
|
/// <param name="bounds">A SRectF struct containing which part of the texture should be drawn</param>
|
||||||
public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds)
|
public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds)
|
||||||
{
|
{
|
||||||
if ((Texture.index >= 0) && (_Textures.Count > 0) && (_D3DTextures.Count > Texture.index))
|
DrawTexture(Texture, rect, color, bounds, false);
|
||||||
DrawTexture(Texture, rect, color, bounds, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1171,8 +1181,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
/// <param name="mirrored">True if the texture should be mirrored</param>
|
/// <param name="mirrored">True if the texture should be mirrored</param>
|
||||||
public void DrawTexture(STexture Texture, SRectF rect, SColorF color, bool mirrored)
|
public void DrawTexture(STexture Texture, SRectF rect, SColorF color, bool mirrored)
|
||||||
{
|
{
|
||||||
if ((Texture.index >= 0) && (_Textures.Count > 0) && (_D3DTextures.Count > Texture.index))
|
DrawTexture(Texture, rect, color, new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, rect.Z), mirrored);
|
||||||
DrawTexture(Texture, rect, color, new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, rect.Z), mirrored);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1185,7 +1194,7 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
/// <param name="mirrored">True if the texture should be mirrored</param>
|
/// <param name="mirrored">True if the texture should be mirrored</param>
|
||||||
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)
|
||||||
{
|
{
|
||||||
if ((Texture.index >= 0) && (_Textures.Count > 0) && (_D3DTextures.Count > Texture.index) && _TextureExists(ref Texture))
|
if (_TextureExists(ref Texture))
|
||||||
{
|
{
|
||||||
if (_D3DTextures[Texture.index] == null)
|
if (_D3DTextures[Texture.index] == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -724,13 +724,13 @@ namespace Vocaluxe.Lib.Draw
|
|||||||
int w = bmp.Width;
|
int w = bmp.Width;
|
||||||
int h = bmp.Height;
|
int h = bmp.Height;
|
||||||
|
|
||||||
if (h >= w && w > MaxSize)
|
if (w > MaxSize)
|
||||||
{
|
{
|
||||||
h = (int)Math.Round((float)MaxSize / bmp.Width * bmp.Height);
|
h = (int)Math.Round((float)MaxSize / bmp.Width * bmp.Height);
|
||||||
w = MaxSize;
|
w = MaxSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w >= h && h > MaxSize)
|
if (h > MaxSize)
|
||||||
{
|
{
|
||||||
w = (int)Math.Round((float)MaxSize / bmp.Height * bmp.Width);
|
w = (int)Math.Round((float)MaxSize / bmp.Height * bmp.Width);
|
||||||
h = MaxSize;
|
h = MaxSize;
|
||||||
|
|||||||
@@ -43,9 +43,7 @@ namespace Vocaluxe.Lib.Song
|
|||||||
if (Index >= _Lines.Count)
|
if (Index >= _Lines.Count)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CLines lines = new CLines();
|
_Lines[Index] = Lines;
|
||||||
lines = Lines;
|
|
||||||
_Lines[Index] = lines;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,9 +547,16 @@ namespace Vocaluxe.Lib.Song
|
|||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
public void AddLine(CLine Line)
|
public void AddLine(CLine Line)
|
||||||
|
{
|
||||||
|
AddLine(Line, true);
|
||||||
|
}
|
||||||
|
public void AddLine(CLine Line, bool updateTimings)
|
||||||
{
|
{
|
||||||
_Lines.Add(Line);
|
_Lines.Add(Line);
|
||||||
UpdateTimings();
|
if (updateTimings)
|
||||||
|
{
|
||||||
|
UpdateTimings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool InsertLine(CLine Line, int Index)
|
public bool InsertLine(CLine Line, int Index)
|
||||||
@@ -581,16 +586,23 @@ namespace Vocaluxe.Lib.Song
|
|||||||
_Lines.Clear();
|
_Lines.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddNote(CNote Note, int LineIndex)
|
public bool AddNote(CNote Note, int LineIndex, bool updateTimings)
|
||||||
{
|
{
|
||||||
if (_Lines.Count > LineIndex)
|
if (_Lines.Count > LineIndex)
|
||||||
{
|
{
|
||||||
_Lines[LineIndex].AddNote(Note);
|
_Lines[LineIndex].AddNote(Note);
|
||||||
UpdateTimings();
|
if (updateTimings)
|
||||||
|
{
|
||||||
|
UpdateTimings();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
public bool AddNote(CNote Note, int LineIndex)
|
||||||
|
{
|
||||||
|
return AddNote(Note, LineIndex, true);
|
||||||
|
}
|
||||||
|
|
||||||
public bool InsertNote(CNote Note, int LineIndex, int NoteIndex)
|
public bool InsertNote(CNote Note, int LineIndex, int NoteIndex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -463,6 +463,10 @@ namespace Vocaluxe.Lib.Song
|
|||||||
TempC = (char)c;
|
TempC = (char)c;
|
||||||
} while ((TempC.CompareTo('E') != 0) && !sr.EndOfStream && (c == 19 || c == 16 || c == 13));
|
} while ((TempC.CompareTo('E') != 0) && !sr.EndOfStream && (c == 19 || c == 16 || c == 13));
|
||||||
}
|
}
|
||||||
|
foreach(CLines lines in this.Notes.Lines)
|
||||||
|
{
|
||||||
|
lines.UpdateTimings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -482,11 +486,11 @@ namespace Vocaluxe.Lib.Song
|
|||||||
{
|
{
|
||||||
CLine line = new CLine();
|
CLine line = new CLine();
|
||||||
line.AddNote(note);
|
line.AddNote(note);
|
||||||
lines.AddLine(line);
|
lines.AddLine(line, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lines.AddNote(note, lines.LineCount - 1);
|
lines.AddNote(note, lines.LineCount - 1, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+117
-86
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
@@ -33,126 +34,156 @@ namespace Vocaluxe
|
|||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
// Init Log
|
try
|
||||||
CLog.Init();
|
{
|
||||||
|
// Init Log
|
||||||
|
CLog.Init();
|
||||||
|
|
||||||
CSettings.CreateFolders();
|
CSettings.CreateFolders();
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
// Init Language
|
// Init Language
|
||||||
CLog.StartBenchmark(0, "Init Language");
|
CLog.StartBenchmark(0, "Init Language");
|
||||||
CLanguage.Init();
|
CLanguage.Init();
|
||||||
CLog.StopBenchmark(0, "Init Language");
|
CLog.StopBenchmark(0, "Init Language");
|
||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
// load config
|
// load config
|
||||||
CLog.StartBenchmark(0, "Init Config");
|
CLog.StartBenchmark(0, "Init Config");
|
||||||
CConfig.LoadCommandLineParams(args);
|
CConfig.LoadCommandLineParams(args);
|
||||||
CConfig.UseCommandLineParamsBefore();
|
CConfig.UseCommandLineParamsBefore();
|
||||||
CConfig.Init();
|
CConfig.Init();
|
||||||
CConfig.UseCommandLineParamsAfter();
|
CConfig.UseCommandLineParamsAfter();
|
||||||
CLog.StopBenchmark(0, "Init Config");
|
CLog.StopBenchmark(0, "Init Config");
|
||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
_SplashScreen = new SplashScreen();
|
_SplashScreen = new SplashScreen();
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
// Init Draw
|
// Init Draw
|
||||||
CLog.StartBenchmark(0, "Init Draw");
|
CLog.StartBenchmark(0, "Init Draw");
|
||||||
CDraw.InitDraw();
|
CDraw.InitDraw();
|
||||||
CLog.StopBenchmark(0, "Init Draw");
|
CLog.StopBenchmark(0, "Init Draw");
|
||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
// Init Database
|
// Init Database
|
||||||
CLog.StartBenchmark(0, "Init Database");
|
CLog.StartBenchmark(0, "Init Database");
|
||||||
CDataBase.Init();
|
CDataBase.Init();
|
||||||
CLog.StopBenchmark(0, "Init Database");
|
CLog.StopBenchmark(0, "Init Database");
|
||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
// Init Playback
|
// Init Playback
|
||||||
CLog.StartBenchmark(0, "Init Playback");
|
CLog.StartBenchmark(0, "Init Playback");
|
||||||
CSound.PlaybackInit();
|
CSound.PlaybackInit();
|
||||||
CLog.StopBenchmark(0, "Init Playback");
|
CLog.StopBenchmark(0, "Init Playback");
|
||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
// Init Record
|
// Init Record
|
||||||
CLog.StartBenchmark(0, "Init Record");
|
CLog.StartBenchmark(0, "Init Record");
|
||||||
CSound.RecordInit();
|
CSound.RecordInit();
|
||||||
CLog.StopBenchmark(0, "Init Record");
|
CLog.StopBenchmark(0, "Init Record");
|
||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
// Init Background Music
|
// Init Background Music
|
||||||
CLog.StartBenchmark(0, "Init Background Music");
|
CLog.StartBenchmark(0, "Init Background Music");
|
||||||
CBackgroundMusic.Init();
|
CBackgroundMusic.Init();
|
||||||
CLog.StopBenchmark(0, "Init Background Music");
|
CLog.StopBenchmark(0, "Init Background Music");
|
||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
// Init Profiles
|
// Init Profiles
|
||||||
CLog.StartBenchmark(0, "Init Profiles");
|
CLog.StartBenchmark(0, "Init Profiles");
|
||||||
CProfiles.Init();
|
CProfiles.Init();
|
||||||
CLog.StopBenchmark(0, "Init Profiles");
|
CLog.StopBenchmark(0, "Init Profiles");
|
||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
// Init Font
|
// Init Font
|
||||||
CLog.StartBenchmark(0, "Init Font");
|
CLog.StartBenchmark(0, "Init Font");
|
||||||
CFonts.Init();
|
CFonts.Init();
|
||||||
CLog.StopBenchmark(0, "Init Font");
|
CLog.StopBenchmark(0, "Init Font");
|
||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
// Init VideoDecoder
|
// Init VideoDecoder
|
||||||
CLog.StartBenchmark(0, "Init Videodecoder");
|
CLog.StartBenchmark(0, "Init Videodecoder");
|
||||||
CVideo.Init();
|
CVideo.Init();
|
||||||
CLog.StopBenchmark(0, "Init Videodecoder");
|
CLog.StopBenchmark(0, "Init Videodecoder");
|
||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
// Load Cover
|
// Load Cover
|
||||||
CLog.StartBenchmark(0, "Init Cover");
|
CLog.StartBenchmark(0, "Init Cover");
|
||||||
CCover.Init();
|
CCover.Init();
|
||||||
CLog.StopBenchmark(0, "Init Cover");
|
CLog.StopBenchmark(0, "Init Cover");
|
||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
// Theme System
|
// Theme System
|
||||||
CLog.StartBenchmark(0, "Init Theme");
|
CLog.StartBenchmark(0, "Init Theme");
|
||||||
CTheme.InitTheme();
|
CTheme.InitTheme();
|
||||||
CLog.StopBenchmark(0, "Init Theme");
|
CLog.StopBenchmark(0, "Init Theme");
|
||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
// Init Screens
|
// Init Screens
|
||||||
CLog.StartBenchmark(0, "Init Screens");
|
CLog.StartBenchmark(0, "Init Screens");
|
||||||
CGraphics.InitGraphics();
|
CGraphics.InitGraphics();
|
||||||
CLog.StopBenchmark(0, "Init Screens");
|
CLog.StopBenchmark(0, "Init Screens");
|
||||||
|
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
// Init Game;
|
|
||||||
CLog.StartBenchmark(0, "Init Game");
|
|
||||||
CGame.Init();
|
|
||||||
CLog.StopBenchmark(0, "Init Game");
|
|
||||||
|
|
||||||
|
// Init Game;
|
||||||
|
CLog.StartBenchmark(0, "Init Game");
|
||||||
|
CGame.Init();
|
||||||
|
CLog.StopBenchmark(0, "Init Game");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Error on start up: " + e.Message + e.StackTrace);
|
||||||
|
CLog.LogError("Error on start up: " + e.Message + e.StackTrace);
|
||||||
|
CloseProgram();
|
||||||
|
Environment.Exit(Environment.ExitCode);
|
||||||
|
}
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
// Start Main Loop
|
// Start Main Loop
|
||||||
_SplashScreen.Close();
|
_SplashScreen.Close();
|
||||||
CDraw.MainLoop();
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CDraw.MainLoop();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Unhandled error: " + e.Message + e.StackTrace);
|
||||||
|
CLog.LogError("Unhandled error: " + e.Message + e.StackTrace);
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseProgram();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CloseProgram()
|
||||||
|
{
|
||||||
// Unloading
|
// Unloading
|
||||||
CSound.RecordCloseAll();
|
try
|
||||||
CSound.CloseAllStreams();
|
{
|
||||||
CVideo.VdCloseAll();
|
CSound.RecordCloseAll();
|
||||||
CDraw.Unload();
|
CSound.CloseAllStreams();
|
||||||
CLog.CloseAll();
|
CVideo.VdCloseAll();
|
||||||
CDataBase.CloseConnections();
|
CDraw.Unload();
|
||||||
|
CLog.CloseAll();
|
||||||
|
CDataBase.CloseConnections();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Assembly AssemblyResolver(Object sender, ResolveEventArgs args)
|
static Assembly AssemblyResolver(Object sender, ResolveEventArgs args)
|
||||||
|
|||||||
@@ -155,7 +155,14 @@ namespace Vocaluxe.Screens
|
|||||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||||
}
|
}
|
||||||
|
|
||||||
SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent);
|
if (MouseEvent.MB && CSongs.Category != -1)
|
||||||
|
{
|
||||||
|
Console.WriteLine("MB pressed");
|
||||||
|
SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent);
|
||||||
|
|
||||||
if (MouseEvent.LB && CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1)
|
if (MouseEvent.LB && CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1)
|
||||||
{
|
{
|
||||||
StartSong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong());
|
StartSong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong());
|
||||||
|
|||||||
Reference in new issue
Block a user