Esempio n. 1
0
 protected void DrawNoteLines(SRectF Rect, SColorF Color)
 {
     for (int i = 0; i < CSettings.NumNoteLines - 1; i++)
     {
         float y = Rect.Y + Rect.H / CSettings.NumNoteLines * (i + 1);
         CDraw.DrawColor(Color, new SRectF(Rect.X, y, Rect.W, 1, -0.5f));
     }
 }
Esempio n. 2
0
        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));
            }
        }
Esempio n. 3
0
        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));
            }
        }
Esempio n. 4
0
        public void Draw(float scale, float z, bool aspect, bool ForceDraw)
        {
            STexture texture;

            if (_Texture.index != -1)
            {
                texture = _Texture;
            }
            else
            {
                texture = CTheme.GetSkinTexture(_Theme.TextureName);
            }

            SRectF bounds = new SRectF(
                Rect.X - Rect.W * (scale - 1f),
                Rect.Y - Rect.H * (scale - 1f),
                Rect.W + 2 * Rect.W * (scale - 1f),
                Rect.H + 2 * Rect.H * (scale - 1f),
                z);

            SRectF rect = bounds;

            if (aspect)
            {
                RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H);
                RectangleF rect2   = new RectangleF(0f, 0f, texture.width, texture.height);
                CHelper.SetRect(bounds2, ref rect2, texture.width / texture.height, EAspect.Crop);

                rect.X = rect2.X;
                rect.Y = rect2.Y;
                rect.W = rect2.Width;
                rect.H = rect2.Height;
            }

            SColorF color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha);

            if (Visible || ForceDraw || (CSettings.GameState == EGameState.EditTheme))
            {
                CDraw.DrawTexture(texture, rect, color, bounds);
                if (Reflection)
                {
                    CDraw.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight);
                }
            }

            if (Selected && (CSettings.GameState == EGameState.EditTheme))
            {
                CDraw.DrawColor(new SColorF(1f, 1f, 1f, 0.5f), rect);
            }
        }
Esempio n. 5
0
        public void Draw(bool ForceDraw)
        {
            if (!ForceDraw && !Visible && CSettings.GameState != EGameState.EditTheme)
            {
                return;
            }

            // Update Text
            Text = Text;

            if (_PositionNeedsUpdate)
            {
                UpdateTextPosition();
            }

            CFonts.SetFont(Fon);
            CFonts.Style = Style;

            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.DrawText(_Text, _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color);

            if (Reflection)
            {
                CFonts.DrawTextReflection(_Text, _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color, ReflectionSpace, ReflectionHeight);
            }

            if (Selected && (CSettings.GameState == EGameState.EditTheme))
            {
                CDraw.DrawColor(
                    new SColorF(0.5f, 1f, 0.5f, 0.5f * CGraphics.GlobalAlpha),
                    new SRectF(_DrawPosition.X, _DrawPosition.Y, _DrawPosition.Width, _DrawPosition.Height, Z)
                    );
            }
        }
Esempio n. 6
0
        public void Draw()
        {
            if (_Bars == null)
            {
                return;
            }

            float dx   = (Rect.W) / _Bars.Length;
            int   max  = _Bars.Length - 1;
            float maxB = _Bars[max];

            for (int i = 0; i < _Bars.Length - 1; i++)
            {
                if (_Bars[i] > maxB)
                {
                    maxB = _Bars[i];
                    max  = i;
                }
            }

            for (int i = 0; i < _Bars.Length; i++)
            {
                SRectF  bar   = new SRectF(Rect.X + dx * i, Rect.Y + Rect.H - _Bars[i] * Rect.H, dx - Space, _Bars[i] * Rect.H, Rect.Z);
                SColorF color = Color;
                if (i == max)
                {
                    color = MaxColor;
                }

                CDraw.DrawColor(color, bar);

                if (Reflection)
                {
                    CDraw.DrawColorReflection(color, bar, ReflectionSpace, ReflectionHeight);
                }
            }
        }
Esempio n. 7
0
        public override bool Draw()
        {
            base.Draw();

            //Draw background
            CDraw.DrawColor(new SColorF(0, 0.18f, 0.474f, 1), new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, 0));

            //Draw stars
            starsBlue.Update();
            starsBlue.Draw();
            starsRed.Update();
            starsRed.Draw();

            logo.Draw();

            //Draw credit-entries
            for (int i = 0; i < _CreditNames.Count; i++)
            {
                if (_CreditNames[i].active)
                {
                    _CreditNames[i].image.Draw();
                    _CreditNames[i].particle.Update();
                    _CreditNames[i].particle.Draw();
                }
            }

            //Draw Text
            if (TextTimer.IsRunning)
            {
                for (int i = 0; i < paragraphTexts.Count; i++)
                {
                    paragraphTexts[i].Draw();
                }
            }
            return(true);
        }
Esempio n. 8
0
        private static void DrawDebugInfos()
        {
            string txt = String.Empty;

            CFonts.Style = EStyle.Normal;
            CFonts.SetFont("Normal");
            SColorF Gray = new SColorF(1f, 1f, 1f, 0.5f);

            float dy = 0;

            if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_ONLY_FPS)
            {
                txt           = CTime.GetFPS().ToString("FPS: 000");
                CFonts.Height = 30f;
                RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));

                CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
                CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
                dy += rect.Height;
            }

            if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1)
            {
                txt = CSound.GetStreamCount().ToString(CLanguage.Translate("TR_DEBUG_AUDIO_STREAMS") + ": 00");

                RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));

                CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
                CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
                dy += rect.Height;
            }

            if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1)
            {
                txt = CVideo.GetNumStreams().ToString(CLanguage.Translate("TR_DEBUG_VIDEO_STREAMS") + ": 00");

                RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));

                CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
                CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
                dy += rect.Height;
            }

            if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1)
            {
                txt = CDraw.TextureCount().ToString(CLanguage.Translate("TR_DEBUG_TEXTURES") + ": 00000");

                RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));

                CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
                CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
                dy += rect.Height;
            }

            if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL2)
            {
                txt = CSound.RecordGetToneAbs(0).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P1: 00");

                RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));

                CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
                CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
                dy += rect.Height;


                txt = CSound.RecordGetMaxVolume(0).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P1: 0.000");

                rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));

                CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
                CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
                dy += rect.Height;

                txt = CSound.RecordGetToneAbs(1).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P2: 00");

                rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));

                CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
                CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
                dy += rect.Height;


                txt = CSound.RecordGetMaxVolume(1).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P2: 0.000");

                rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));

                CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
                CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
                dy += rect.Height;
            }

            if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL3)
            {
                txt = CSongs.NumSongsWithCoverLoaded.ToString(CLanguage.Translate("TR_DEBUG_SONGS") + ": 00000");

                RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));

                CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
                CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
                dy += rect.Height;
            }

            if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL_MAX)
            {
                txt = _Cursor.X.ToString(CLanguage.Translate("TR_DEBUG_MOUSE") + " : (0000/") + _Cursor.Y.ToString("0000)");

                RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));

                CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
                CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
                dy += rect.Height;
            }
        }
Esempio n. 9
0
        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));
            }
        }
Esempio n. 10
0
        public void Draw(bool ForceDraw)
        {
            if (!ForceDraw && !Visible && CSettings.GameState != EGameState.EditTheme)
            {
                return;
            }

            // Update Text
            Text = Text;

            if (_PositionNeedsUpdate)
            {
                UpdateTextPosition();
            }

            CFonts.SetFont(Fon);
            CFonts.Style = Style;

            SColorF CurrentColor = new SColorF(Color);

            if (Selected)
            {
                CurrentColor = new SColorF(SColor);
            }

            SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha);

            if (!EditMode)
            {
                CFonts.DrawText(_Text, _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color);
            }
            else
            {
                CFonts.DrawText(_Text + "|", _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color);
            }

            if (Reflection)
            {
                float sFactor = 0f;
                switch (HAlign)
                {
                case EHAlignment.Top:
                    sFactor = (Height - _DrawPosition.tH) * 1.5f;
                    break;

                case EHAlignment.Center:
                    sFactor = (Height - _DrawPosition.tH) * 1.0f;
                    break;

                case EHAlignment.Bottom:
                    sFactor = (Height - _DrawPosition.tH) * 0.5f;
                    break;

                default:
                    break;
                }
                if (!EditMode)
                {
                    CFonts.DrawTextReflection(_Text, _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color, ReflectionSpace + sFactor, ReflectionHeight);
                }
                else
                {
                    CFonts.DrawTextReflection(_Text + "|", _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color, ReflectionSpace + sFactor, ReflectionHeight);
                }
            }

            if (Selected && (CSettings.GameState == EGameState.EditTheme))
            {
                CDraw.DrawColor(
                    new SColorF(0.5f, 1f, 0.5f, 0.5f * CGraphics.GlobalAlpha),
                    new SRectF(_DrawPosition.X, _DrawPosition.Y, _DrawPosition.Width, _DrawPosition.Height, Z)
                    );
            }
        }
Esempio n. 11
0
        private void DrawColor()
        {
            SRectF bounds = new SRectF(0f, 0f, CSettings.iRenderW, CSettings.iRenderH, CSettings.zFar / 4);

            CDraw.DrawColor(Color, bounds);
        }