public void SetLine(CLine Line) { _Notes.Clear(); _width = 0f; foreach (CNote note in Line.Notes) { SNote n = new SNote(); n.Text = note.Text; n.StartBeat = note.StartBeat; n.EndBeat = note.EndBeat; n.Duration = note.Duration; n.Type = note.NoteType; _Text.Text = note.Text; _Text.Style = EStyle.Bold; if (n.Type == ENoteType.Freestyle) { _Text.Style = EStyle.BoldItalic; } RectangleF rect = CDraw.GetTextBounds(_Text); _width += rect.Width; _Notes.Add(n); } }
private void DrawFill(float CurrentBeat) { float x = _X - _width / 2; // most left position foreach (SNote note in _Notes) { _Text.X = x; _Text.Style = EStyle.Bold; _Text.Text = note.Text; RectangleF rect = CDraw.GetTextBounds(_Text); if (note.Type == ENoteType.Freestyle) { _Text.Style = EStyle.BoldItalic; } if (CurrentBeat >= note.StartBeat) { _Text.Color = ColorProcessed; _Text.Draw(); } else { // not passed _Text.Color = Color; _Text.Draw(); } x += rect.Width; } }
public void DrawRelative(float rx, float ry, bool reflection, float reflectionSpace, float reflectionHeight, float rectHeight) { // Update Text Text = Text; float h = Height; float x = X + rx; float y = Y + ry; RectangleF bounds = CDraw.GetTextBounds(this); while (bounds.Width > Bounds.W) { h -= 0.2f; y += 0.1f; bounds = CDraw.GetTextBounds(this, h); } switch (Align) { case EAlignment.Center: x = x - bounds.Width / 2; break; case EAlignment.Right: x = x - bounds.Width; break; default: break; } SColorF CurrentColor = new SColorF(Color); if (Selected) { CurrentColor = new SColorF(SColor); } SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha); CFonts.SetFont(Fon); CFonts.Style = Style; CFonts.DrawText(_Text, h, x, y, Z, color); if (reflection) { float space = (rectHeight - Y - bounds.Height) * 2f + reflectionSpace; float height = reflectionHeight - (rectHeight - Y) + bounds.Height; CFonts.DrawTextReflection(_Text, h, x, y, Z, color, space, height); } if (Selected && (CSettings.GameState == EGameState.EditTheme)) { CDraw.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f * CGraphics.GlobalAlpha), new SRectF(x, y, bounds.Width, bounds.Height, Z)); } }
private void DrawJump(float CurrentBeat) { float x = _X - _width / 2; // most left position foreach (SNote note in _Notes) { _Text.X = x; _Text.Style = EStyle.Bold; _Text.Text = note.Text; RectangleF rect = CDraw.GetTextBounds(_Text); if (note.Type == ENoteType.Freestyle) { _Text.Style = EStyle.BoldItalic; } if (CurrentBeat >= note.StartBeat) { if (CurrentBeat <= note.EndBeat) { _Text.Color = ColorProcessed; float diff = note.EndBeat - note.StartBeat; if (diff == 0) { _Text.Draw(); } else { float y = _Text.Y; _Text.Y -= _Text.Height * 0.1f; _Text.Draw(); _Text.Y = y; } } else { // already passed _Text.Color = Color; _Text.Draw(); } } else { // not passed _Text.Color = Color; _Text.Draw(); } x += rect.Width; } }
public void Draw(float begin, float end) { RectangleF bounds = CDraw.GetTextBounds(this); float x = X; switch (Align) { case EAlignment.Center: x = X - bounds.Width / 2; break; case EAlignment.Right: x = X - bounds.Width; break; default: break; } SColorF CurrentColor = new SColorF(Color); if (Selected) { CurrentColor = new SColorF(SColor); } SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha); CFonts.SetFont(Fon); CFonts.Style = Style; if (!EditMode) { CFonts.DrawText(Text, Height, x, Y, Z, color, begin, end); } else { CFonts.DrawText(Text + "|", Height, x, Y, Z, color, begin, end); } if (Reflection) { // TODO } if (Selected && (CSettings.GameState == EGameState.EditTheme)) { CDraw.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(x, Y, bounds.Width, bounds.Height, Z)); } }
private void DrawSlide(float CurrentBeat) { float x = _X - _width / 2; foreach (SNote note in _Notes) { _Text.X = x; _Text.Style = EStyle.Bold; _Text.Text = note.Text; RectangleF rect = CDraw.GetTextBounds(_Text); if (note.Type == ENoteType.Freestyle) { _Text.Style = EStyle.BoldItalic; } if (CurrentBeat >= note.StartBeat) { if (CurrentBeat <= note.EndBeat) { _Text.Color = ColorProcessed; float diff = note.EndBeat - note.StartBeat; if (diff == 0) { _Text.Draw(0f, 1f); } else { _Text.Draw(0f, (CurrentBeat - note.StartBeat) / diff); _Text.Color = Color; _Text.Draw((CurrentBeat - note.StartBeat) / diff, 1f); } } else { _Text.Color = ColorProcessed; _Text.Draw(); } } else { _Text.Color = Color; _Text.Draw(); } x += rect.Width; } }
public void DrawRelative(float rx, float ry, bool reflection, float reflectionSpace, float reflectionHeight, float rectHeight) { // Update Text Text = Text; float h = Height; float x = X + rx; float y = Y + ry; RectangleF bounds = CDraw.GetTextBounds(this); if (bounds.Width > Bounds.W && Bounds.W > 0f && bounds.Width > 0f) { float factor = Bounds.W / bounds.Width; float step = h * (1 - factor); h *= factor; switch (HAlign) { case EHAlignment.Top: y += step * 0.25f; break; case EHAlignment.Center: y += step * 0.50f; break; case EHAlignment.Bottom: y += step * 0.75f; break; default: break; } bounds = CFonts.GetTextBounds(this, h); } switch (Align) { case EAlignment.Center: x = x - bounds.Width / 2; break; case EAlignment.Right: x = x - bounds.Width; break; default: break; } SColorF CurrentColor = new SColorF(Color); if (Selected) { CurrentColor = new SColorF(SColor); } SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha); CFonts.SetFont(Fon); CFonts.Style = Style; if (!EditMode) { CFonts.DrawText(_Text, h, x, y, Z, color); } else { CFonts.DrawText(_Text + "|", h, x, y, Z, color); } if (reflection) { float space = (rectHeight - Y - bounds.Height) * 2f + reflectionSpace; float height = reflectionHeight - (rectHeight - Y) + bounds.Height; if (!EditMode) { CFonts.DrawTextReflection(_Text, h, x, y, Z, color, space, height); } else { CFonts.DrawTextReflection(_Text + "|", h, x, y, Z, color, space, height); } } if (Selected && (CSettings.GameState == EGameState.EditTheme)) { CDraw.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f * CGraphics.GlobalAlpha), new SRectF(x, y, bounds.Width, bounds.Height, Z)); } }
private void DrawZoom(float CurrentBeat) { float x = _X - _width / 2; // most left position //find last active note int last_note = -1; for (int i = 0; i < _Notes.Count; i++) { if (CurrentBeat >= _Notes[i].StartBeat) { last_note = i; } } int zoom_note = -1; float zoomx = 0f; int current_note = -1; foreach (SNote note in _Notes) { current_note++; _Text.X = x; _Text.Style = EStyle.Bold; _Text.Text = note.Text; RectangleF rect = CDraw.GetTextBounds(_Text); if (note.Type == ENoteType.Freestyle) { _Text.Style = EStyle.BoldItalic; } if (CurrentBeat >= note.StartBeat) { if (CurrentBeat <= note.EndBeat) { zoom_note = current_note; zoomx = _Text.X; } else { // already passed if (current_note == last_note) { _Text.Color = ColorProcessed; } else { _Text.Color = Color; } _Text.Draw(); } } else { // not passed _Text.Color = Color; _Text.Draw(); } x += rect.Width; } if (zoom_note > -1) { if (_Notes[zoom_note].Duration == 0) { return; } _Text.X = zoomx; _Text.Text = _Notes[zoom_note].Text; _Text.Color = ColorProcessed; _Text.Style = EStyle.Bold; if (_Notes[zoom_note].Type == ENoteType.Freestyle) { _Text.Style = EStyle.BoldItalic; } RectangleF rect = CDraw.GetTextBounds(_Text); float diff = _Notes[zoom_note].EndBeat - _Notes[zoom_note].StartBeat; float p = (CurrentBeat - _Notes[zoom_note].StartBeat) / _Notes[zoom_note].Duration; if (p > 1f) { p = 1f; } p = 1f - p; float ty = _Text.Y; float tx = _Text.X; float th = _Text.Height; float tz = _Text.Z; _Text.Height += _Text.Height * p * 0.4f; RectangleF rectz = CDraw.GetTextBounds(_Text); _Text.X -= (rectz.Width - rect.Width) / 2f; _Text.Y -= (rectz.Height - rect.Height) / 2f; _Text.Z -= 0.1f; _Text.Draw(); _Text.Y = ty; _Text.X = tx; _Text.Height = th; _Text.Z = tz; } }
public override void LoadTheme() { //Vocaluxe-Logo CDataBase.GetCreditsRessource("Logo_voc.png", ref _TexLogo); //Little stars for logo CDataBase.GetCreditsRessource("PerfectNoteStar.png", ref _TexPerfectNoteStar); //brunzel CDataBase.GetCreditsRessource("brunzel.png", ref _TexNameBrunzel); //Darkice CDataBase.GetCreditsRessource("Darkice.png", ref _TexNameDarkice); //flokuep CDataBase.GetCreditsRessource("flokuep.png", ref _TexNameFlokuep); //bohning CDataBase.GetCreditsRessource("bohning.png", ref _TexNameBohning); //mesand CDataBase.GetCreditsRessource("mesand.png", ref _TexNameMesand); //babene03 CDataBase.GetCreditsRessource("babene03.png", ref _TexNameBabene03); //pantero CDataBase.GetCreditsRessource("pantero.png", ref _TexNamePantero); //Pinky007 CDataBase.GetCreditsRessource("Pinky007.png", ref _TexNamePinky007); //Prepare Text int lastY = 280; for (int i = 0; i < paragraphs.Count; i++) { string line = ""; for (int e = 0; e < paragraphs[i].Length; e++) { if (paragraphs[i][e] != null) { string newline = line + " " + paragraphs[i][e]; CText text = new CText(75, lastY, -2, 30, -1, EAlignment.Left, EStyle.Bold, "Outline", new SColorF(1, 1, 1, 1), line); if (CDraw.GetTextBounds(text).Width < (CSettings.iRenderW - 220)) { line = line + " " + paragraphs[i][e]; //Check if all words are used if ((e + 1) == paragraphs[i].Length) { text.Text = line; paragraphTexts.Add(text); line = ""; lastY += 40; } } else { paragraphTexts.Add(text); line = " " + paragraphs[i][e]; lastY += 27; } } } } }
private void DrawJump(float CurrentBeat) { float x = _X - _width / 2; // most left position //find last active note int last_note = -1; for (int i = 0; i < _Notes.Count; i++) { if (CurrentBeat >= _Notes[i].StartBeat) { last_note = i; } } int jump_note = -1; int end_beat = -1; float jumpx = 0f; for (int note = 0; note < _Notes.Count; note++) { _Text.X = x; _Text.Style = EStyle.Bold; _Text.Text = _Notes[note].Text; RectangleF rect = CDraw.GetTextBounds(_Text); if (_Notes[note].Type == ENoteType.Freestyle) { _Text.Style = EStyle.BoldItalic; } if (CurrentBeat >= _Notes[note].StartBeat) { bool last = note == _Notes.Count - 1; int endbeat = _Notes[note].EndBeat; if (note < _Notes.Count - 1) { endbeat = _Notes[note + 1].StartBeat - 1; } if (CurrentBeat <= _Notes[note].EndBeat) { jump_note = note; end_beat = endbeat; jumpx = _Text.X; } else { // already passed if (note == last_note) { _Text.Color = ColorProcessed; } else { _Text.Color = Color; } _Text.Draw(); } } else { // not passed _Text.Color = Color; _Text.Draw(); } x += rect.Width; } if (jump_note > -1) { if (_Notes[jump_note].Duration == 0) { return; } _Text.X = jumpx; _Text.Text = _Notes[jump_note].Text; _Text.Color = ColorProcessed; _Text.Style = EStyle.Bold; if (_Notes[jump_note].Type == ENoteType.Freestyle) { _Text.Style = EStyle.BoldItalic; } float diff = _Notes[jump_note].EndBeat - _Notes[jump_note].StartBeat; if (diff <= 0f) { diff = 1f; } float p = (CurrentBeat - _Notes[jump_note].StartBeat) / diff; if (p > 1f) { p = 1f; } p = 1f - p; if (diff == 1) { _Text.Draw(); } else { float y = _Text.Y; _Text.Y -= _Text.Height * 0.1f * p; _Text.Draw(); _Text.Y = y; } } }
public void Draw() { if (!Visible && CSettings.GameState != EGameState.EditTheme) { return; } STexture Texture = CTheme.GetSkinTexture(_Theme.TextureName); STexture TextureArrowLeft = CTheme.GetSkinTexture(_Theme.TextureArrowLeftName); STexture TextureArrowRight = CTheme.GetSkinTexture(_Theme.TextureArrowRightName); STexture STexture = CTheme.GetSkinTexture(_Theme.STextureName); STexture STextureArrowLeft = CTheme.GetSkinTexture(_Theme.STextureArrowLeftName); STexture STextureArrowRight = CTheme.GetSkinTexture(_Theme.STextureArrowRightName); STexture HTexture = CTheme.GetSkinTexture(_Theme.HTextureName); if (Selected) { if (Highlighted) { CDraw.DrawTexture(HTexture, Rect, HColor); } else { CDraw.DrawTexture(STexture, Rect, SColor); } } else { CDraw.DrawTexture(Texture, Rect, Color); } if (_Selection > 0 || CSettings.GameState == EGameState.EditTheme) { if (_ArrowLeftSelected) { CDraw.DrawTexture(STextureArrowLeft, RectArrowLeft, SColorArrow); } else { CDraw.DrawTexture(TextureArrowLeft, RectArrowLeft, ColorArrow); } } if (_Selection < _ValueNames.Count - 1 || CSettings.GameState == EGameState.EditTheme) { if (_ArrowRightSelected) { CDraw.DrawTexture(STextureArrowRight, RectArrowRight, SColorArrow); } else { CDraw.DrawTexture(TextureArrowRight, RectArrowRight, ColorArrow); } } if (_NumVisible < 1 || _ValueNames.Count == 0) { return; } float x = Rect.X + Rect.W * 0.1f; float dx = Rect.W * 0.8f / _NumVisible; //float y = Rect.Y + (Rect.H - TextH); int offset = _Selection - (int)_NumVisible / 2; if (_ValueNames.Count - _NumVisible - offset < 0) { offset = _ValueNames.Count - _NumVisible; } if (offset < 0) { offset = 0; } int numvis = _NumVisible; if (_ValueNames.Count < numvis) { numvis = _ValueNames.Count; } _ValueBounds.Clear(); for (int i = 0; i < numvis; i++) { CText Text = new CText(0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, _ValueNames[i + offset]); SColorF Alpha = new SColorF(1f, 1f, 1f, 0.35f); if (i + offset == _Selection) { Text.Color = STextColor; Alpha = new SColorF(1f, 1f, 1f, 1f); } RectangleF bounds = CDraw.GetTextBounds(Text); Text.X = x + dx / 2f + dx * i; if (!WithTextures) { Text.Y = (int)(Rect.Y + (Rect.H - bounds.Height) / 2); } else { Text.Y = (int)(Rect.Y + (Rect.H - bounds.Height)); } Text.Z = Rect.Z; Text.Draw(); if (WithTextures) { float dh = Text.Y - Rect.Y - Rect.H * 0.1f; SRectF rect = new SRectF(Text.X - dh / 2, Rect.Y + Rect.H * 0.05f, dh, dh, Rect.Z); CDraw.DrawTexture(_Textures[i + offset], rect, Alpha); _ValueBounds.Add(rect); } else { _ValueBounds.Add(new SRectF(Text.X - bounds.Width / 2f, Text.Y, bounds.Width, bounds.Height, Rect.Z)); } } }