From 125a624c929a60035b9a114fb9ee15e1096dd422 Mon Sep 17 00:00:00 2001 From: Alexander Eckart Date: Sun, 7 Apr 2013 13:52:07 +0200 Subject: [PATCH] some code reconstructions (no code changes) --- VocaluxeLib/Menu/CPoints.cs | 89 +++++ VocaluxeLib/Menu/Enums.cs | 285 +++++++++++++++ VocaluxeLib/Menu/IMenu.cs | 638 --------------------------------- VocaluxeLib/Menu/Structs.cs | 292 +++++++++++++++ VocaluxeLib/VocaluxeLib.csproj | 3 + 5 files changed, 669 insertions(+), 638 deletions(-) create mode 100644 VocaluxeLib/Menu/CPoints.cs create mode 100644 VocaluxeLib/Menu/Enums.cs create mode 100644 VocaluxeLib/Menu/Structs.cs diff --git a/VocaluxeLib/Menu/CPoints.cs b/VocaluxeLib/Menu/CPoints.cs new file mode 100644 index 00000000..15dc154a --- /dev/null +++ b/VocaluxeLib/Menu/CPoints.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace VocaluxeLib.Menu +{ + public class CPoints + { + private readonly SPlayer[,] _Rounds; + + public CPoints(int NumRounds, SPlayer[] Player) + { + _Rounds = new SPlayer[NumRounds, Player.Length]; + + for (int round = 0; round < NumRounds; round++) + { + for (int player = 0; player < Player.Length; player++) + { + _Rounds[round, player].ProfileID = Player[player].ProfileID; + _Rounds[round, player].Name = Player[player].Name; + _Rounds[round, player].Difficulty = Player[player].Difficulty; + _Rounds[round, player].Points = 0f; + _Rounds[round, player].PointsGoldenNotes = 0f; + _Rounds[round, player].PointsLineBonus = 0f; + _Rounds[round, player].Medley = false; + _Rounds[round, player].Duet = false; + _Rounds[round, player].ShortSong = false; + _Rounds[round, player].SongFinished = false; + } + } + } + + public void SetPoints(int Round, int SongID, SPlayer[] Player, bool Medley, bool Duet, bool ShortSong) + { + long DateTicks = DateTime.Now.Ticks; + for (int player = 0; player < Player.Length; player++) + { + _Rounds[Round, player].SongID = SongID; + _Rounds[Round, player].LineNr = Player[player].LineNr; + _Rounds[Round, player].Points = Player[player].Points; + _Rounds[Round, player].PointsGoldenNotes = Player[player].PointsGoldenNotes; + _Rounds[Round, player].PointsLineBonus = Player[player].PointsLineBonus; + _Rounds[Round, player].Medley = Medley; + _Rounds[Round, player].Duet = Duet; + _Rounds[Round, player].ShortSong = ShortSong; + _Rounds[Round, player].DateTicks = DateTicks; + _Rounds[Round, player].SongFinished = Player[player].SongFinished; + } + } + + public int NumRounds + { + get { return _Rounds.GetLength(0); } + } + + public int NumPlayer + { + get { return _Rounds.GetLength(1); } + } + + public SPlayer[] GetPlayer(int Round, int numPlayer) + { + if (NumPlayer == 0) + return new SPlayer[1]; + if (Round >= NumRounds) + return new SPlayer[1]; + + SPlayer[] player = new SPlayer[numPlayer]; + + for (int p = 0; p < player.Length; p++) + { + player[p].Name = _Rounds[Round, p].Name; + player[p].Points = _Rounds[Round, p].Points; + player[p].PointsGoldenNotes = _Rounds[Round, p].PointsGoldenNotes; + player[p].PointsLineBonus = _Rounds[Round, p].PointsLineBonus; + player[p].SongID = _Rounds[Round, p].SongID; + player[p].LineNr = _Rounds[Round, p].LineNr; + player[p].Difficulty = _Rounds[Round, p].Difficulty; + player[p].Medley = _Rounds[Round, p].Medley; + player[p].Duet = _Rounds[Round, p].Duet; + player[p].ShortSong = _Rounds[Round, p].ShortSong; + player[p].DateTicks = _Rounds[Round, p].DateTicks; + player[p].SongFinished = _Rounds[Round, p].SongFinished; + player[p].ProfileID = _Rounds[Round, p].ProfileID; + } + return player; + } + } +} diff --git a/VocaluxeLib/Menu/Enums.cs b/VocaluxeLib/Menu/Enums.cs new file mode 100644 index 00000000..3acc1e8e --- /dev/null +++ b/VocaluxeLib/Menu/Enums.cs @@ -0,0 +1,285 @@ +using System; + +namespace VocaluxeLib.Menu +{ + #region Inputs + [Flags] + public enum EModifier + { + None = 0, + Shift = 1, + Alt = 2, + Ctrl = 4 + } + + public enum ESender + { + Mouse, + Keyboard, + WiiMote, + Gamepad + } + #endregion Inputs + + #region Fonts + public enum EAspect + { + Crop, + LetterBox, + Stretch + } + + public enum EAlignment + { + Left, + Center, + Right + } + + public enum EHAlignment + { + Top, + Center, + Bottom + } + + public enum EStyle + { + Normal, + Italic, + Bold, + BoldItalic + } + #endregion Fonts + + #region Config + public enum ERenderer + { +#if WIN + TR_CONFIG_DIRECT3D, +#endif + TR_CONFIG_OPENGL, + TR_CONFIG_SOFTWARE + } + + public enum EAntiAliasingModes + { + x0 = 0, + x2 = 2, + x4 = 4, + x8 = 8, + x16 = 16, + x32 = 32 + } + + public enum EColorDeep + { + Bit8 = 8, + Bit16 = 16, + Bit24 = 24, + Bit32 = 32 + } + + public enum ETextureQuality + { + TR_CONFIG_TEXTURE_LOWEST, + TR_CONFIG_TEXTURE_LOW, + TR_CONFIG_TEXTURE_MEDIUM, + TR_CONFIG_TEXTURE_HIGH, + TR_CONFIG_TEXTURE_HIGHEST + } + + public enum EOffOn + { + TR_CONFIG_OFF, + TR_CONFIG_ON + } + + public enum EDebugLevel + { + // don't change the order! + TR_CONFIG_OFF, //no debug infos + TR_CONFIG_ONLY_FPS, + TR_CONFIG_LEVEL1, + TR_CONFIG_LEVEL2, + TR_CONFIG_LEVEL3, + TR_CONFIG_LEVEL_MAX //all debug infos + } + + public enum EBufferSize + { + b0 = 0, + b512 = 512, + b1024 = 1024, + b1536 = 1536, + b2048 = 2048, + b2560 = 2560, + b3072 = 3072, + b3584 = 3584, + b4096 = 4096 + } + + public enum EPlaybackLib + { + PortAudio, + OpenAL, + Gstreamer + } + + public enum EWebcamLib + { + OpenCV, + AForgeNet + } + + public enum ERecordLib + { +#if WIN + DirectSound, +#endif + PortAudio + } + + public enum EVideoDecoder + { + FFmpeg, + Gstreamer + } + + public enum ESongMenu + { + //TR_CONFIG_LIST, //a simple list + //TR_CONFIG_DREIDEL, //as in ultrastar deluxe + TR_CONFIG_TILE_BOARD, //chessboard like + //TR_CONFIG_BOOK //for playlists + } + + public enum EDuetOptions + { + All, + Duets, + NoDuets + } + + public enum ESongSorting + { + TR_CONFIG_NONE, + //TR_CONFIG_RANDOM, + TR_CONFIG_FOLDER, + TR_CONFIG_ARTIST, + TR_CONFIG_ARTIST_LETTER, + TR_CONFIG_TITLE_LETTER, + TR_CONFIG_EDITION, + TR_CONFIG_GENRE, + TR_CONFIG_LANGUAGE, + TR_CONFIG_YEAR, + TR_CONFIG_DECADE + } + + public enum ECoverLoading + { + TR_CONFIG_COVERLOADING_ONDEMAND, + TR_CONFIG_COVERLOADING_ATSTART, + TR_CONFIG_COVERLOADING_DYNAMIC + } + + public enum EGameDifficulty + { + TR_CONFIG_EASY, + TR_CONFIG_NORMAL, + TR_CONFIG_HARD + } + + public enum ETimerMode + { + TR_CONFIG_TIMERMODE_CURRENT, + TR_CONFIG_TIMERMODE_REMAINING, + TR_CONFIG_TIMERMODE_TOTAL + } + + public enum ETimerLook + { + TR_CONFIG_TIMERLOOK_NORMAL, + TR_CONFIG_TIMERLOOK_EXPANDED + } + + public enum EBackgroundMusicSource + { + TR_CONFIG_NO_OWN_MUSIC, + TR_CONFIG_OWN_MUSIC, + TR_CONFIG_ONLY_OWN_MUSIC + } + + public enum EPlayerInfo + { + TR_CONFIG_PLAYERINFO_BOTH, + TR_CONFIG_PLAYERINFO_NAME, + TR_CONFIG_PLAYERINFO_AVATAR, + TR_CONFIG_PLAYERINFO_OFF + } + + public enum EFadePlayerInfo + { + TR_CONFIG_FADEPLAYERINFO_ALL, + TR_CONFIG_FADEPLAYERINFO_INFO, + TR_CONFIG_FADEPLAYERINFO_OFF + } + + public enum ELyricStyle + { + Fill, + Jump, + Slide, + Zoom + } + #endregion Config + + public enum EGameState + { + Start, + Normal, + EditTheme + } + + public enum EGameMode + { + TR_GAMEMODE_NORMAL, + TR_GAMEMODE_MEDLEY, + TR_GAMEMODE_DUET, + TR_GAMEMODE_SHORTSONG + } + + public enum ENoteType + { + Normal, + Golden, + Freestyle + } + + public enum EScreens + { + ScreenTest = 0, + ScreenLoad = 1, + ScreenMain = 2, + ScreenSong = 3, + ScreenOptions = 4, + ScreenSing = 5, + ScreenProfiles = 6, + ScreenScore = 7, + ScreenHighscore = 8, + + ScreenOptionsGame = 9, + ScreenOptionsSound = 10, + ScreenOptionsRecord = 11, + ScreenOptionsVideo = 12, + ScreenOptionsLyrics = 13, + ScreenOptionsTheme = 14, + + ScreenNames = 15, + ScreenCredits = 16, + ScreenParty = 17, + ScreenPartyDummy = 18, + + ScreenNull = -1 + } +} \ No newline at end of file diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs index 9a4d4620..42bfd321 100644 --- a/VocaluxeLib/Menu/IMenu.cs +++ b/VocaluxeLib/Menu/IMenu.cs @@ -312,642 +312,4 @@ namespace VocaluxeLib.Menu int GetPlaylistSongCount(int PlaylistID); CPlaylistSong GetPlaylistSong(int PlaylistID, int SongIndex); } - - [Flags] - public enum EModifier - { - None = 0, - Shift = 1, - Alt = 2, - Ctrl = 4 - } - - public enum ESender - { - Mouse, - Keyboard, - WiiMote, - Gamepad - } - - public struct KeyEvent - { - public ESender Sender; - public bool ModALT; - public bool ModSHIFT; - public bool ModCTRL; - public bool KeyPressed; - public bool Handled; - public Keys Key; - public Char Unicode; - public EModifier Mod; - - public KeyEvent(ESender sender, bool alt, bool shift, bool ctrl, bool pressed, char unicode, Keys key) - { - Sender = sender; - ModALT = alt; - ModSHIFT = shift; - ModCTRL = ctrl; - KeyPressed = pressed; - Unicode = unicode; - Key = key; - Handled = false; - - Mod = EModifier.None; - - if (alt) - Mod |= EModifier.Alt; - if (shift) - Mod |= EModifier.Shift; - if (ctrl) - Mod |= EModifier.Ctrl; - } - } - - public struct MouseEvent - { - public ESender Sender; - public bool Handled; - public int X; - public int Y; - public bool LB; //left button click - public bool LD; //left button double click - public bool RB; //right button click - public bool MB; //middle button click - - public bool LBH; //left 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 ModSHIFT; - public bool ModCTRL; - - public EModifier Mod; - public int Wheel; - - public MouseEvent(ESender sender, bool alt, bool shift, bool ctrl, int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh) - { - Sender = sender; - Handled = false; - X = x; - Y = y; - LB = lb; - LD = ld; - RB = rb; - MB = mb; - - LBH = lbh; - RBH = rbh; - MBH = mbh; - - ModALT = alt; - ModSHIFT = shift; - ModCTRL = ctrl; - - EModifier mALT = EModifier.None; - EModifier mSHIFT = EModifier.None; - EModifier mCTRL = EModifier.None; - - if (alt) - mALT = EModifier.Alt; - - if (shift) - mSHIFT = EModifier.Shift; - - if (ctrl) - mCTRL = EModifier.Ctrl; - - if (!alt && !shift && !ctrl) - Mod = EModifier.None; - else - Mod = mALT | mSHIFT | mCTRL; - - Wheel = wheel; - } - } - - public enum EGameState - { - Start, - Normal, - EditTheme - } - - public enum EAspect - { - Crop, - LetterBox, - Stretch - } - - #region Structs - public struct SColorF - { - public float R; - public float G; - public float B; - public float A; - - public SColorF(float r, float g, float b, float a) - { - R = r; - G = g; - B = b; - A = a; - } - - public SColorF(SColorF Color) - { - R = Color.R; - G = Color.G; - B = Color.B; - A = Color.A; - } - } - - public struct SRectF - { - public float X; - public float Y; - public float W; - public float H; - public float Z; - public float Rotation; //0..360° - - public SRectF(float x, float y, float w, float h, float z) - { - X = x; - Y = y; - W = w; - H = h; - Z = z; - Rotation = 0f; - } - - public SRectF(SRectF rect) - { - X = rect.X; - Y = rect.Y; - W = rect.W; - H = rect.H; - Z = rect.Z; - Rotation = 0f; - } - } - - public struct SPoint3f - { - public float X; - public float Y; - public float Z; - } - - public struct SPoint3 - { - public int X; - public int Y; - public int Z; - } - - public struct STexture - { - public int index; - public int PBO; - public int ID; - - public string TexturePath; - - public float width; - public float height; - public SRectF rect; - - public float w2; //power of 2 width - public float h2; //power of 2 height - public float width_ratio; - public float height_ratio; - - public SColorF color; - - public STexture(int Index) - { - index = Index; - PBO = 0; - ID = -1; - TexturePath = String.Empty; - - width = 1f; - height = 1f; - rect = new SRectF(0f, 0f, 1f, 1f, 0f); - - w2 = 2f; - h2 = 2f; - width_ratio = 0.5f; - height_ratio = 0.5f; - - color = new SColorF(1f, 1f, 1f, 1f); - } - } - #endregion Structs - - #region EnumsConfig - public enum ERenderer - { -#if WIN - TR_CONFIG_DIRECT3D, -#endif - TR_CONFIG_OPENGL, - TR_CONFIG_SOFTWARE - } - - public enum EAntiAliasingModes - { - x0 = 0, - x2 = 2, - x4 = 4, - x8 = 8, - x16 = 16, - x32 = 32 - } - - public enum EColorDeep - { - Bit8 = 8, - Bit16 = 16, - Bit24 = 24, - Bit32 = 32 - } - - public enum ETextureQuality - { - TR_CONFIG_TEXTURE_LOWEST, - TR_CONFIG_TEXTURE_LOW, - TR_CONFIG_TEXTURE_MEDIUM, - TR_CONFIG_TEXTURE_HIGH, - TR_CONFIG_TEXTURE_HIGHEST - } - - public enum EOffOn - { - TR_CONFIG_OFF, - TR_CONFIG_ON - } - - public enum EDebugLevel - { - // don't change the order! - TR_CONFIG_OFF, //no debug infos - TR_CONFIG_ONLY_FPS, - TR_CONFIG_LEVEL1, - TR_CONFIG_LEVEL2, - TR_CONFIG_LEVEL3, - TR_CONFIG_LEVEL_MAX //all debug infos - } - - public enum EBufferSize - { - b0 = 0, - b512 = 512, - b1024 = 1024, - b1536 = 1536, - b2048 = 2048, - b2560 = 2560, - b3072 = 3072, - b3584 = 3584, - b4096 = 4096 - } - - public enum EPlaybackLib - { - PortAudio, - OpenAL, - Gstreamer - } - - public enum EWebcamLib - { - OpenCV, - AForgeNet - } - - public enum ERecordLib - { -#if WIN - DirectSound, -#endif - PortAudio - } - - public enum EVideoDecoder - { - FFmpeg, - Gstreamer - } - - public enum ESongMenu - { - //TR_CONFIG_LIST, //a simple list - //TR_CONFIG_DREIDEL, //as in ultrastar deluxe - TR_CONFIG_TILE_BOARD, //chessboard like - //TR_CONFIG_BOOK //for playlists - } - - public enum EDuetOptions - { - All, - Duets, - NoDuets - } - - public enum ESongSorting - { - TR_CONFIG_NONE, - //TR_CONFIG_RANDOM, - TR_CONFIG_FOLDER, - TR_CONFIG_ARTIST, - TR_CONFIG_ARTIST_LETTER, - TR_CONFIG_TITLE_LETTER, - TR_CONFIG_EDITION, - TR_CONFIG_GENRE, - TR_CONFIG_LANGUAGE, - TR_CONFIG_YEAR, - TR_CONFIG_DECADE - } - - public enum ECoverLoading - { - TR_CONFIG_COVERLOADING_ONDEMAND, - TR_CONFIG_COVERLOADING_ATSTART, - TR_CONFIG_COVERLOADING_DYNAMIC - } - - public enum EGameDifficulty - { - TR_CONFIG_EASY, - TR_CONFIG_NORMAL, - TR_CONFIG_HARD - } - - public enum ETimerMode - { - TR_CONFIG_TIMERMODE_CURRENT, - TR_CONFIG_TIMERMODE_REMAINING, - TR_CONFIG_TIMERMODE_TOTAL - } - - public enum ETimerLook - { - TR_CONFIG_TIMERLOOK_NORMAL, - TR_CONFIG_TIMERLOOK_EXPANDED - } - - public enum EBackgroundMusicSource - { - TR_CONFIG_NO_OWN_MUSIC, - TR_CONFIG_OWN_MUSIC, - TR_CONFIG_ONLY_OWN_MUSIC - } - - public enum EPlayerInfo - { - TR_CONFIG_PLAYERINFO_BOTH, - TR_CONFIG_PLAYERINFO_NAME, - TR_CONFIG_PLAYERINFO_AVATAR, - TR_CONFIG_PLAYERINFO_OFF - } - - public enum EFadePlayerInfo - { - TR_CONFIG_FADEPLAYERINFO_ALL, - TR_CONFIG_FADEPLAYERINFO_INFO, - TR_CONFIG_FADEPLAYERINFO_OFF - } - - public enum ELyricStyle - { - Fill, - Jump, - Slide, - Zoom - } - #endregion EnumsConfig - - public enum EAlignment - { - Left, - Center, - Right - } - - public enum EHAlignment - { - Top, - Center, - Bottom - } - - public enum EStyle - { - Normal, - Italic, - Bold, - BoldItalic - } - - public enum ENoteType - { - Normal, - Golden, - Freestyle - } - - public struct SProfile - { - public string PlayerName; - public string ProfileFile; - - public EGameDifficulty Difficulty; - public SAvatar Avatar; - public EOffOn GuestProfile; - public EOffOn Active; - } - - public struct SAvatar - { - public string FileName; - public STexture Texture; - - public SAvatar(int dummy) - { - FileName = String.Empty; - Texture = new STexture(-1); - } - } - - public struct SPlayer - { - public int ProfileID; - public string Name; - public EGameDifficulty Difficulty; - public double Points; - public double PointsLineBonus; - public double PointsGoldenNotes; - public int NoteDiff; - public int LineNr; - public List SingLine; - public int CurrentLine; - public int CurrentNote; - - public int SongID; - public bool Medley; - public bool Duet; - public bool ShortSong; - public long DateTicks; - public bool SongFinished; - } - - public class CPoints - { - private readonly SPlayer[,] _Rounds; - - public CPoints(int NumRounds, SPlayer[] Player) - { - _Rounds = new SPlayer[NumRounds,Player.Length]; - - for (int round = 0; round < NumRounds; round++) - { - for (int player = 0; player < Player.Length; player++) - { - _Rounds[round, player].ProfileID = Player[player].ProfileID; - _Rounds[round, player].Name = Player[player].Name; - _Rounds[round, player].Difficulty = Player[player].Difficulty; - _Rounds[round, player].Points = 0f; - _Rounds[round, player].PointsGoldenNotes = 0f; - _Rounds[round, player].PointsLineBonus = 0f; - _Rounds[round, player].Medley = false; - _Rounds[round, player].Duet = false; - _Rounds[round, player].ShortSong = false; - _Rounds[round, player].SongFinished = false; - } - } - } - - public void SetPoints(int Round, int SongID, SPlayer[] Player, bool Medley, bool Duet, bool ShortSong) - { - long DateTicks = DateTime.Now.Ticks; - for (int player = 0; player < Player.Length; player++) - { - _Rounds[Round, player].SongID = SongID; - _Rounds[Round, player].LineNr = Player[player].LineNr; - _Rounds[Round, player].Points = Player[player].Points; - _Rounds[Round, player].PointsGoldenNotes = Player[player].PointsGoldenNotes; - _Rounds[Round, player].PointsLineBonus = Player[player].PointsLineBonus; - _Rounds[Round, player].Medley = Medley; - _Rounds[Round, player].Duet = Duet; - _Rounds[Round, player].ShortSong = ShortSong; - _Rounds[Round, player].DateTicks = DateTicks; - _Rounds[Round, player].SongFinished = Player[player].SongFinished; - } - } - - public int NumRounds - { - get { return _Rounds.GetLength(0); } - } - - public int NumPlayer - { - get { return _Rounds.GetLength(1); } - } - - public SPlayer[] GetPlayer(int Round, int numPlayer) - { - if (NumPlayer == 0) - return new SPlayer[1]; - if (Round >= NumRounds) - return new SPlayer[1]; - - SPlayer[] player = new SPlayer[numPlayer]; - - for (int p = 0; p < player.Length; p++) - { - player[p].Name = _Rounds[Round, p].Name; - player[p].Points = _Rounds[Round, p].Points; - player[p].PointsGoldenNotes = _Rounds[Round, p].PointsGoldenNotes; - player[p].PointsLineBonus = _Rounds[Round, p].PointsLineBonus; - player[p].SongID = _Rounds[Round, p].SongID; - player[p].LineNr = _Rounds[Round, p].LineNr; - player[p].Difficulty = _Rounds[Round, p].Difficulty; - player[p].Medley = _Rounds[Round, p].Medley; - player[p].Duet = _Rounds[Round, p].Duet; - player[p].ShortSong = _Rounds[Round, p].ShortSong; - player[p].DateTicks = _Rounds[Round, p].DateTicks; - player[p].SongFinished = _Rounds[Round, p].SongFinished; - player[p].ProfileID = _Rounds[Round, p].ProfileID; - } - return player; - } - } - - public struct SScores - { - public string Name; - public int Score; - public string Date; - public EGameDifficulty Difficulty; - public int LineNr; - public int ID; - } - - public enum EGameMode - { - TR_GAMEMODE_NORMAL, - TR_GAMEMODE_MEDLEY, - TR_GAMEMODE_DUET, - TR_GAMEMODE_SHORTSONG - } - - public struct SPartyModeInfos - { - public int PartyModeID; - public string Name; - public string Description; - public string TargetAudience; - public int MaxPlayers; - public int MinPlayers; - public int MaxTeams; - public int MinTeams; - - public string Author; - public bool Playable; - public int VersionMajor; - public int VersionMinor; - } - - public enum EScreens - { - ScreenTest = 0, - ScreenLoad = 1, - ScreenMain = 2, - ScreenSong = 3, - ScreenOptions = 4, - ScreenSing = 5, - ScreenProfiles = 6, - ScreenScore = 7, - ScreenHighscore = 8, - - ScreenOptionsGame = 9, - ScreenOptionsSound = 10, - ScreenOptionsRecord = 11, - ScreenOptionsVideo = 12, - ScreenOptionsLyrics = 13, - ScreenOptionsTheme = 14, - - ScreenNames = 15, - ScreenCredits = 16, - ScreenParty = 17, - ScreenPartyDummy = 18, - - ScreenNull = -1 - } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/Structs.cs b/VocaluxeLib/Menu/Structs.cs new file mode 100644 index 00000000..41938220 --- /dev/null +++ b/VocaluxeLib/Menu/Structs.cs @@ -0,0 +1,292 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +using VocaluxeLib.Menu.SingNotes; + +namespace VocaluxeLib.Menu +{ + #region Drawing + public struct SColorF + { + public float R; + public float G; + public float B; + public float A; + + public SColorF(float r, float g, float b, float a) + { + R = r; + G = g; + B = b; + A = a; + } + + public SColorF(SColorF Color) + { + R = Color.R; + G = Color.G; + B = Color.B; + A = Color.A; + } + } + + public struct SRectF + { + public float X; + public float Y; + public float W; + public float H; + public float Z; + public float Rotation; //0..360° + + public SRectF(float x, float y, float w, float h, float z) + { + X = x; + Y = y; + W = w; + H = h; + Z = z; + Rotation = 0f; + } + + public SRectF(SRectF rect) + { + X = rect.X; + Y = rect.Y; + W = rect.W; + H = rect.H; + Z = rect.Z; + Rotation = 0f; + } + } + + public struct SPoint3f + { + public float X; + public float Y; + public float Z; + } + + public struct SPoint3 + { + public int X; + public int Y; + public int Z; + } + + public struct STexture + { + public int index; + public int PBO; + public int ID; + + public string TexturePath; + + public float width; + public float height; + public SRectF rect; + + public float w2; //power of 2 width + public float h2; //power of 2 height + public float width_ratio; + public float height_ratio; + + public SColorF color; + + public STexture(int Index) + { + index = Index; + PBO = 0; + ID = -1; + TexturePath = String.Empty; + + width = 1f; + height = 1f; + rect = new SRectF(0f, 0f, 1f, 1f, 0f); + + w2 = 2f; + h2 = 2f; + width_ratio = 0.5f; + height_ratio = 0.5f; + + color = new SColorF(1f, 1f, 1f, 1f); + } + } + #endregion Drawing + + #region Inputs + public struct KeyEvent + { + public ESender Sender; + public bool ModALT; + public bool ModSHIFT; + public bool ModCTRL; + public bool KeyPressed; + public bool Handled; + public Keys Key; + public Char Unicode; + public EModifier Mod; + + public KeyEvent(ESender sender, bool alt, bool shift, bool ctrl, bool pressed, char unicode, Keys key) + { + Sender = sender; + ModALT = alt; + ModSHIFT = shift; + ModCTRL = ctrl; + KeyPressed = pressed; + Unicode = unicode; + Key = key; + Handled = false; + + Mod = EModifier.None; + + if (alt) + Mod |= EModifier.Alt; + if (shift) + Mod |= EModifier.Shift; + if (ctrl) + Mod |= EModifier.Ctrl; + } + } + + public struct MouseEvent + { + public ESender Sender; + public bool Handled; + public int X; + public int Y; + public bool LB; //left button click + public bool LD; //left button double click + public bool RB; //right button click + public bool MB; //middle button click + + public bool LBH; //left 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 ModSHIFT; + public bool ModCTRL; + + public EModifier Mod; + public int Wheel; + + public MouseEvent(ESender sender, bool alt, bool shift, bool ctrl, int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh) + { + Sender = sender; + Handled = false; + X = x; + Y = y; + LB = lb; + LD = ld; + RB = rb; + MB = mb; + + LBH = lbh; + RBH = rbh; + MBH = mbh; + + ModALT = alt; + ModSHIFT = shift; + ModCTRL = ctrl; + + EModifier mALT = EModifier.None; + EModifier mSHIFT = EModifier.None; + EModifier mCTRL = EModifier.None; + + if (alt) + mALT = EModifier.Alt; + + if (shift) + mSHIFT = EModifier.Shift; + + if (ctrl) + mCTRL = EModifier.Ctrl; + + if (!alt && !shift && !ctrl) + Mod = EModifier.None; + else + Mod = mALT | mSHIFT | mCTRL; + + Wheel = wheel; + } + } + #endregion Inputs + + #region Profiles + public struct SProfile + { + public string PlayerName; + public string ProfileFile; + + public EGameDifficulty Difficulty; + public SAvatar Avatar; + public EOffOn GuestProfile; + public EOffOn Active; + } + + public struct SAvatar + { + public string FileName; + public STexture Texture; + + public SAvatar(int dummy) + { + FileName = String.Empty; + Texture = new STexture(-1); + } + } + #endregion Profiles + + #region Game + public struct SPlayer + { + public int ProfileID; + public string Name; + public EGameDifficulty Difficulty; + public double Points; + public double PointsLineBonus; + public double PointsGoldenNotes; + public int NoteDiff; + public int LineNr; + public List SingLine; + public int CurrentLine; + public int CurrentNote; + + public int SongID; + public bool Medley; + public bool Duet; + public bool ShortSong; + public long DateTicks; + public bool SongFinished; + } + + public struct SScores + { + public string Name; + public int Score; + public string Date; + public EGameDifficulty Difficulty; + public int LineNr; + public int ID; + } + + public struct SPartyModeInfos + { + public int PartyModeID; + public string Name; + public string Description; + public string TargetAudience; + public int MaxPlayers; + public int MinPlayers; + public int MaxTeams; + public int MinTeams; + + public string Author; + public bool Playable; + public int VersionMajor; + public int VersionMinor; + } + #endregion Game +} \ No newline at end of file diff --git a/VocaluxeLib/VocaluxeLib.csproj b/VocaluxeLib/VocaluxeLib.csproj index 534de92e..97fcaf9e 100644 --- a/VocaluxeLib/VocaluxeLib.csproj +++ b/VocaluxeLib/VocaluxeLib.csproj @@ -126,11 +126,13 @@ + + @@ -145,6 +147,7 @@ +