Esempio n. 1
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         DrawTexture(Texture, rect, color, bounds, false);
     }
 }
Esempio n. 2
0
 public void DrawTexture(STexture Texture, SRectF rect)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         DrawTexture(Texture, rect, Texture.color);
     }
 }
Esempio n. 3
0
        public void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, bool mirrored = false, bool allMonitors = true)
        {
            if (Math.Abs(color.A) < 0.01)
            {
                return;
            }
            SDrawCoords  dc;
            TTextureType texture;

            if (!_GetTexture(textureRef, out texture))
            {
                return;
            }
            if (allMonitors)
            {
                for (int i = 0; i < CConfig.Config.Graphics.NumScreens; i++)
                {
                    SRectF newrect = rect;
                    newrect.X += CSettings.RenderW * i;
                    if (!_CalcDrawCoords(texture, newrect, out dc, mirrored))
                    {
                        return;
                    }
                    _DrawTexture(texture, dc, color);
                }
            }
            else
            {
                if (!_CalcDrawCoords(texture, rect, out dc, mirrored))
                {
                    return;
                }
                _DrawTexture(texture, dc, color);
            }
        }
Esempio n. 4
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, bool mirrored)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         DrawTexture(Texture, rect, color, rect, mirrored);
     }
 }
Esempio n. 5
0
        public CText()
        {
            _Theme = new SThemeText();
            _ThemeLoaded = false;
            _ButtonText = false;

            X = 0f;
            Y = 0f;
            Z = 0f;
            Height = 1f;
            MaxWidth = 0f;
            Bounds = new SRectF();
            Align = EAlignment.Left;
            Style = EStyle.Normal;
            Fon = "Normal";

            Color = new SColorF();
            SColor = new SColorF();
            Reflection = false;
            ReflectionSpace = 0f;
            ReflectionHeight = 0f;

            Text = String.Empty;
            Selected = false;
            Visible = true;
            Alpha = 1f;
        }
Esempio n. 6
0
        public void DrawRect(SColorF color, SRectF rect, bool allMonitors = true)
        {
            int loops = 1;

            if (allMonitors)
            {
                loops = CConfig.Config.Graphics.NumScreens;
            }
            for (int i = 0; i < loops; i++)
            {
                SRectF newrect = rect;
                newrect.X += CSettings.RenderW * i;

                GL.Enable(EnableCap.Blend);
                GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);

                GL.Begin(PrimitiveType.Quads);
                GL.MatrixMode(MatrixMode.Color);
                GL.PushMatrix();
                if (Math.Abs(newrect.Rotation) > 0.001)
                {
                    GL.Translate(0.5f, 0.5f, 0);
                    GL.Rotate(-newrect.Rotation, 0f, 0f, 1f);
                    GL.Translate(-0.5f, -0.5f, 0);
                }
                GL.Vertex3(newrect.X, newrect.Y, newrect.Z + CGraphics.ZOffset);
                GL.Vertex3(newrect.X, newrect.Y + newrect.H, newrect.Z + CGraphics.ZOffset);
                GL.Vertex3(newrect.X + newrect.W, newrect.Y + newrect.H, newrect.Z + CGraphics.ZOffset);
                GL.Vertex3(newrect.X + newrect.W, newrect.Y, newrect.Z + CGraphics.ZOffset);
                GL.End();
                GL.PopMatrix();
                GL.Disable(EnableCap.Blend);
            }
        }
Esempio n. 7
0
 public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, bool mirrored = false)
 {
     if (texture != null)
     {
         DrawTexture(texture, rect, color, rect, mirrored);
     }
 }
Esempio n. 8
0
        /// <summary>
        ///     Draws a reflection of a texture
        /// </summary>
        /// <param name="textureRef">The texture of which a reflection should be drawn</param>
        /// <param name="rect">A SRectF struct containing the destination coordinates</param>
        /// <param name="color">A SColorF struct containing a color which the texture will be colored in</param>
        /// <param name="bounds">A SRectF struct containing which part of the texture should be drawn</param>
        /// <param name="space">The space between the texture and the reflection</param>
        /// <param name="height">The height of the reflection</param>
        public void DrawTextureReflection(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, float space, float height)
        {
            Debug.Assert(height >= 0);

            if (Math.Abs(color.A) < 0.01 || height < 1)
            {
                return;
            }
            SDrawCoords  dc;
            TTextureType texture;

            if (!_GetTexture(textureRef, out texture))
            {
                return;
            }
            if (!_CalcDrawCoords(texture, rect, bounds, out dc, true))
            {
                return;
            }

            if (height > rect.H)
            {
                height = rect.H;
            }

            dc.Wy1 += rect.H + space;             // Move from start of rect to end of rect with spacing
            dc.Wy2 += space + height;             // Move from end of rect
            dc.Ty2 += (rect.H - height) / rect.H; // Adjust so not all of the start of the texture is drawn (mirrored--> Ty1>Ty2)
            if (dc.Ty2 < dc.Ty1)                  // Make sure we actually draw something
            {
                _DrawTexture(texture, dc, color, true);
            }
        }
Esempio n. 9
0
        public void DrawRectReflection(SColorF color, SRectF rect, float space, float height)
        {
            if (rect.H < height)
            {
                height = rect.H;
            }

            float rx1 = rect.X;
            float rx2 = rect.X + rect.W;
            float ry1 = rect.Y + rect.H + space;
            float ry2 = rect.Y + rect.H + space + height;

            if (rx1 < rect.X)
            {
                rx1 = rect.X;
            }

            if (rx2 > rect.X + rect.W)
            {
                rx2 = rect.X + rect.W;
            }

            if (ry1 < rect.Y + space)
            {
                ry1 = rect.Y + space;
            }

            if (ry2 > rect.Y + rect.H + space + height)
            {
                ry2 = rect.Y + rect.H + space + height;
            }


            GL.Enable(EnableCap.Blend);
            GL.MatrixMode(MatrixMode.Color);
            GL.PushMatrix();
            if (Math.Abs(rect.Rotation) > 0.001)
            {
                GL.Translate(0.5f, 0.5f, 0);
                GL.Rotate(-rect.Rotation, 0f, 0f, 1f);
                GL.Translate(-0.5f, -0.5f, 0);
            }

            GL.Begin(PrimitiveType.Quads);

            GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
            GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset);

            GL.Color4(color.R, color.G, color.B, 0f);
            GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset);
            GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset);

            GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
            GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset);

            GL.End();
            GL.PopMatrix();
            GL.Disable(EnableCap.Blend);
        }
Esempio n. 10
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         Bitmap ColoredBitmap = ColorizeBitmap(_Bitmaps[Texture.index], color);
         _g.DrawImage(ColoredBitmap, new RectangleF(rect.X, rect.Y, rect.W, rect.H));
         ColoredBitmap.Dispose();
     }
 }
Esempio n. 11
0
 public SRectF(SRectF rect)
 {
     X        = rect.X;
     Y        = rect.Y;
     W        = rect.W;
     H        = rect.H;
     Z        = rect.Z;
     Rotation = 0f;
 }
Esempio n. 12
0
 public SRectF(SRectF rect)
 {
     X = rect.X;
     Y = rect.Y;
     W = rect.W;
     H = rect.H;
     Z = rect.Z;
     Rotation = 0f;
 }
Esempio n. 13
0
        public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false)
        {
            if (!_TextureExists(texture))
            {
                return;
            }
            Bitmap coloredBitmap = _ColorizeBitmap(_Bitmaps[texture.ID], color);

            _G.DrawImage(coloredBitmap, new RectangleF(rect.X, rect.Y, rect.W, rect.H));
            coloredBitmap.Dispose();
        }
Esempio n. 14
0
        /// <summary>
        ///     Draws a reflection of a texture
        /// </summary>
        /// <param name="textureRef">The texture of which a reflection should be drawn</param>
        /// <param name="rect">A SRectF struct containing the destination coordinates</param>
        /// <param name="color">A SColorF struct containing a color which the texture will be colored in</param>
        /// <param name="bounds">A SRectF struct containing which part of the texture should be drawn</param>
        /// <param name="space">The space between the texture and the reflection</param>
        /// <param name="height">The height of the reflection</param>
        public void DrawTextureReflection(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, float space, float height, bool allMonitors = true)
        {
            Debug.Assert(height >= 0);

            if (Math.Abs(color.A) < 0.01 || height < 1)
            {
                return;
            }
            SDrawCoords  dc;
            TTextureType texture;

            if (!_GetTexture(textureRef, out texture))
            {
                return;
            }

            int loops;

            if (allMonitors)
            {
                loops = CConfig.Config.Graphics.NumScreens;
            }
            else
            {
                loops = 1;
            }

            for (int i = 0; i < loops; i++)
            {
                SRectF newrect   = rect;
                SRectF newbounds = bounds;
                newrect.X   += CSettings.RenderW * i;
                newbounds.X += CSettings.RenderW * i;
                if (!_CalcDrawCoords(texture, newrect, newbounds, out dc, true))
                {
                    return;
                }

                if (height > newrect.H)
                {
                    height = newrect.H;
                }

                dc.Wy1 += newrect.H + space;                // Move from start of rect to end of rect with spacing
                dc.Wy2 += space + height;                   // Move from end of rect
                dc.Ty2 += (newrect.H - height) / newrect.H; // Adjust so not all of the start of the texture is drawn (mirrored--> Ty1>Ty2)
                if (dc.Ty2 < dc.Ty1)                        // Make sure we actually draw something
                {
                    _DrawTexture(texture, dc, color, true);
                }
            }
        }
Esempio n. 15
0
        public CStatic(STexture texture, SColorF color, SRectF rect)
        {
            _Theme = new SThemeStatic();
            _ThemeLoaded = false;

            _Texture = texture;
            Color = color;
            Rect = rect;
            Reflection = false;
            ReflectionSpace = 0f;
            ReflectionHeight = 0f;

            Selected = false;
            Alpha = 1f;
            Visible = true;
        }
Esempio n. 16
0
        public CStatic(CStatic s)
        {
            _Theme = new SThemeStatic();
            _ThemeLoaded = false;

            _Texture = s.Texture;
            Color = new SColorF(s.Color);
            Rect = new SRectF(s.Rect);
            Reflection = s.Reflection;
            ReflectionSpace = s.ReflectionHeight;
            ReflectionHeight = s.ReflectionSpace;

            Selected = s.Selected;
            Alpha = s.Alpha;
            Visible = s.Visible;
        }
Esempio n. 17
0
        public CStatic()
        {
            _Theme = new SThemeStatic();
            _ThemeLoaded = false;

            _Texture = new STexture(-1);
            Color = new SColorF();
            Rect = new SRectF();
            Reflection = false;
            ReflectionSpace = 0f;
            ReflectionHeight = 0f;

            Selected = false;
            Alpha = 1f;
            Visible = true;
        }
Esempio n. 18
0
        public override void Init()
        {
            base.Init();

            _Rect = _Theme.songMenuTileBoard.TileRect;
 
            _NumW = _Theme.songMenuTileBoard.numW;
            _NumH = _Theme.songMenuTileBoard.numH;
            _SpaceW = _Theme.songMenuTileBoard.spaceW;
            _SpaceH = _Theme.songMenuTileBoard.spaceH;

            _PendingTime = 100L;

            _TileW = (int)((_Theme.songMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW);
            _TileH = (int)((_Theme.songMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH);

            _CoverTexture = CTheme.GetSkinTexture(_Theme.CoverBackgroundName);
            _CoverBigTexture = CTheme.GetSkinTexture(_Theme.CoverBigBackgroundName);

            _Tiles = new List<CStatic>();
            for (int i = 0; i < _NumH; i++)
            {
                for (int j = 0; j < _NumW; j++)
                {
                    SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW),
                        _Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
                    CStatic tile = new CStatic(_CoverTexture, Color, rect);
                    _Tiles.Add(tile);
                }
            }

            _ScrollRect = new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, _Theme.songMenuTileBoard.TileRect.Z);

            _PreviewSelected = -1;
            _Offset = 0;

            _CoverBig = _Theme.songMenuTileBoard.StaticCoverBig;
            _TextBG = _Theme.songMenuTileBoard.StaticTextBG;
            _DuetIcon = _Theme.songMenuTileBoard.StaticDuetIcon;
            _VideoIcon = _Theme.songMenuTileBoard.StaticVideoIcon;
            _MedleyCalcIcon = _Theme.songMenuTileBoard.StaticMedleyCalcIcon;
            _MedleyTagIcon = _Theme.songMenuTileBoard.StaticMedleyTagIcon;

            _Artist = _Theme.songMenuTileBoard.TextArtist;
            _Title = _Theme.songMenuTileBoard.TextTitle;
            _SongLength = _Theme.songMenuTileBoard.TextSongLength;
        }
Esempio n. 19
0
        public override void Update()
        {
            //Update CurrentRect
            if (!ResetMode)
            {
                CLog.LogError((CurrentRect.X + ((FinalRect.X - CurrentRect.X) / Speed * Timer.ElapsedMilliseconds)).ToString("#.#####"));
                CurrentRect.X = CurrentRect.X + ((FinalRect.X - CurrentRect.X) / Speed * Timer.ElapsedMilliseconds);
                CurrentRect.Y = CurrentRect.Y + ((FinalRect.Y - CurrentRect.Y) / Speed * Timer.ElapsedMilliseconds);
                CurrentRect.H = CurrentRect.H + ((FinalRect.H - CurrentRect.H) / Speed * Timer.ElapsedMilliseconds);
                CurrentRect.W = CurrentRect.W + ((FinalRect.W - CurrentRect.W) / Speed * Timer.ElapsedMilliseconds);
            }
            else
            {
                CurrentRect.X = CurrentRect.X + ((OriginalRect.X - CurrentRect.X) / Speed * Timer.ElapsedMilliseconds);
                CurrentRect.Y = CurrentRect.Y + ((OriginalRect.Y - CurrentRect.Y) / Speed * Timer.ElapsedMilliseconds);
                CurrentRect.H = CurrentRect.H + ((OriginalRect.H - CurrentRect.H) / Speed * Timer.ElapsedMilliseconds);
                CurrentRect.W = CurrentRect.W + ((OriginalRect.W - CurrentRect.W) / Speed * Timer.ElapsedMilliseconds);
            }

            if (CurrentRect.X == FinalRect.X && CurrentRect.Y == FinalRect.Y && CurrentRect.H == FinalRect.H && CurrentRect.W == FinalRect.W)
            {
                switch (Repeat)
                {
                    case EAnimationRepeat.Repeat:
                        StopAnimation();
                        CurrentRect = OriginalRect;
                        StartAnimation();
                        break;

                    case EAnimationRepeat.RepeatWithReset:
                        ResetAnimation();
                        break;

                    case EAnimationRepeat.Reset:
                        if (!ResetMode)
                            ResetAnimation();
                        else
                            StopAnimation();
                        break;

                    case EAnimationRepeat.None:
                        StopAnimation();
                        break;
                }
            }
        }
Esempio n. 20
0
        public CEqualizer()
        {
            _Theme = new SThemeEqualizer();
            _ThemeLoaded = false;

            Rect = new SRectF();
            Color = new SColorF();
            MaxColor = new SColorF();

            Selected = false;
            Visible = true;
            ScreenHandles = false;

            Reflection = false;
            ReflectionSpace = 0f;
            ReflectionHeight = 0f;
        }
Esempio n. 21
0
        public CStatic(string TextureSkinName, SColorF color, SRectF rect)
        {
            _Theme = new SThemeStatic();
            _Theme.TextureName = TextureSkinName;
            _ThemeLoaded = false;

            _Texture = new STexture(-1);
            Color = color;
            Rect = rect;
            Reflection = false;
            ReflectionSpace = 0f;
            ReflectionHeight = 0f;

            Selected = false;
            Alpha = 1f;
            Visible = true;
        }
Esempio n. 22
0
        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);
        }
Esempio n. 23
0
        protected virtual void Init()
        {
            _Interactions = new List<CInteraction>();
            _Selection = 0;

            _Statics = new List<CStatic>();
            _Texts = new List<CText>();
            _Buttons = new List<CButton>();
            _SelectSlides = new List<CSelectSlide>();

            _PrevMouseX = 0;
            _PrevMouseY = 0;

            _MouseDX = 0;
            _MouseDY = 0;

            Active = false;
            _ScreenArea = new SRectF(0f, 0f, CSettings.iRenderW, CSettings.iRenderH, 0f);
        }
Esempio n. 24
0
        public CButton()
        {
            _Theme = new SThemeButton();
            Rect = new SRectF();
            Color = new SColorF();
            SColor = new SColorF();

            Text = new CText();
            Selected = false;
            Visible = true;

            Reflection = false;
            ReflectionSpace = 0f;
            ReflectionHeight = 0f;

            SReflection = false;
            SReflectionSpace = 0f;
            SReflectionHeight = 0f;
        }
Esempio n. 25
0
        /// <summary>
        ///     Draws a texture
        /// </summary>
        /// <param name="textureRef">The texture to be drawn</param>
        /// <param name="rect">A SRectF struct containing the destination coordinates</param>
        /// <param name="color">A SColorF struct containing a color which the texture will be colored in</param>
        /// <param name="bounds">A SRectF struct containing which part of the texture should be drawn</param>
        /// <param name="mirrored">True if the texture should be mirrored</param>
        public void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false)
        {
            if (Math.Abs(color.A) < 0.01)
            {
                return;
            }
            SDrawCoords  dc;
            TTextureType texture;

            if (!_GetTexture(textureRef, out texture))
            {
                return;
            }
            if (!_CalcDrawCoords(texture, rect, bounds, out dc))
            {
                return;
            }

            _DrawTexture(texture, dc, color);
        }
Esempio n. 26
0
        /// <summary>
        ///     Draws a texture
        /// </summary>
        /// <param name="textureRef">The texture to be drawn</param>
        /// <param name="rect">A SRectF struct containing the destination coordinates</param>
        /// <param name="color">A SColorF struct containing a color which the texture will be colored in</param>
        /// <param name="begin">A Value ranging from 0 to 1 containing the beginning of the texture</param>
        /// <param name="end">A Value ranging from 0 to 1 containing the ending of the texture</param>
        public void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, float begin, float end)
        {
            if (Math.Abs(color.A) < 0.01)
            {
                return;
            }
            SDrawCoords  dc;
            TTextureType texture;

            if (!_GetTexture(textureRef, out texture))
            {
                return;
            }
            if (!_CalcDrawCoords(texture, rect, out dc, false, begin, end))
            {
                return;
            }

            _DrawTexture(texture, dc, color);
        }
Esempio n. 27
0
        /// <summary>
        ///     Calculates the texture and world coordinates for drawing the texture in the rect cropping at the the bounds
        /// </summary>
        /// <param name="texture"></param>
        /// <param name="rect">Rect to draw the texture (might stretch the texture)</param>
        /// <param name="bounds">Rect to stay in (might crop the texture)</param>
        /// <param name="drawCoords">Struct for the coordinates</param>
        /// <param name="mirrored">Mirror on y-axis</param>
        /// <returns>True if anything will be dawn</returns>
        protected bool _CalcDrawCoords(TTextureType texture, SRectF rect, SRectF bounds, out SDrawCoords drawCoords, bool mirrored = false)
        {
            drawCoords = new SDrawCoords();
            if (Math.Abs(rect.W) < 1 || Math.Abs(rect.H) < 1 || Math.Abs(bounds.H) < 1 || Math.Abs(bounds.W) < 1)
            {
                return(false);
            }

            if (bounds.X >= rect.Right || bounds.Right <= rect.X)
            {
                return(false);
            }

            if (bounds.Y >= rect.Bottom || bounds.Bottom <= rect.Y)
            {
                return(false);
            }

            drawCoords.Tx1 = Math.Max(0, (bounds.X - rect.X) / rect.W * texture.WidthRatio);
            drawCoords.Wx1 = Math.Max(rect.X, bounds.X);
            drawCoords.Tx2 = Math.Min(1, (bounds.Right - rect.X) / rect.W) * texture.WidthRatio;
            drawCoords.Wx2 = Math.Min(rect.Right, bounds.Right);

            drawCoords.Ty1 = Math.Max(0, (bounds.Y - rect.Y) / rect.H * texture.HeightRatio);
            drawCoords.Wy1 = Math.Max(rect.Y, bounds.Y);
            drawCoords.Ty2 = Math.Min(1, (bounds.Bottom - rect.Y) / rect.H) * texture.HeightRatio;
            drawCoords.Wy2 = Math.Min(rect.Bottom, bounds.Bottom);

            if (mirrored)
            {
                float tmp = drawCoords.Ty1;
                drawCoords.Ty1 = drawCoords.Ty2;
                drawCoords.Ty2 = tmp;
            }

            drawCoords.Wz       = rect.Z + CGraphics.ZOffset;
            drawCoords.Rotation = rect.Rotation;

            return(true);
        }
Esempio n. 28
0
        public void DrawRect(SColorF color, SRectF rect)
        {
            GL.Enable(EnableCap.Blend);
            GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);

            GL.Begin(PrimitiveType.Quads);
            GL.MatrixMode(MatrixMode.Color);
            GL.PushMatrix();
            if (Math.Abs(rect.Rotation) > 0.001)
            {
                GL.Translate(0.5f, 0.5f, 0);
                GL.Rotate(-rect.Rotation, 0f, 0f, 1f);
                GL.Translate(-0.5f, -0.5f, 0);
            }
            GL.Vertex3(rect.X, rect.Y, rect.Z + CGraphics.ZOffset);
            GL.Vertex3(rect.X, rect.Y + rect.H, rect.Z + CGraphics.ZOffset);
            GL.Vertex3(rect.X + rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset);
            GL.Vertex3(rect.X + rect.W, rect.Y, rect.Z + CGraphics.ZOffset);
            GL.End();
            GL.PopMatrix();
            GL.Disable(EnableCap.Blend);
        }
Esempio n. 29
0
        /// <summary>
        ///     Calculates the texture and world coordinates for drawing (a part of) the texture in the rect
        /// </summary>
        /// <param name="texture">Texture to draw</param>
        /// <param name="rect">Rect to draw in (might stretch the texture)</param>
        /// <param name="drawCoords">Struct for the coordinates</param>
        /// <param name="mirrored">Mirror on y axis</param>
        /// <param name="begin">Position of the texture to begin drawing (0 &lt;=x&lt;=1)</param>
        /// <param name="end">Position of the texture to end drawing (0 &lt;=x&lt;=1)</param>
        /// <returns>True if anything will be dawn</returns>
        protected bool _CalcDrawCoords(TTextureType texture, SRectF rect, out SDrawCoords drawCoords, bool mirrored = false, float begin = 0, float end = 1)
        {
            drawCoords = new SDrawCoords();
            if (Math.Abs(rect.W) < 1 || Math.Abs(rect.H) < 1)
            {
                return(false);
            }
            if (begin >= 1 || begin >= end)
            {
                return(false);
            }

            Debug.Assert(begin.IsInRange(0, 1) && end.IsInRange(0, 1));

            drawCoords.Tx1 = begin * texture.WidthRatio;
            drawCoords.Wx1 = rect.X + begin * rect.W;
            drawCoords.Tx2 = end * texture.WidthRatio;
            drawCoords.Wx2 = rect.X + end * rect.W;

            drawCoords.Ty1 = 0;
            drawCoords.Wy1 = rect.Y;
            drawCoords.Ty2 = texture.HeightRatio;
            drawCoords.Wy2 = rect.Bottom;

            if (mirrored)
            {
                float tmp = drawCoords.Ty1;
                drawCoords.Ty1 = drawCoords.Ty2;
                drawCoords.Ty2 = tmp;
            }

            drawCoords.Wz       = rect.Z + CGraphics.ZOffset;
            drawCoords.Rotation = rect.Rotation;

            return(true);
        }
Esempio n. 30
0
        private int _GetNextElement(KeyEvent Key, out float Distance, out int Stage)
        {
            Distance = float.MaxValue;
            int min = _Selection;
            SRectF actualRect = _GetRect(_Selection);
            Stage = int.MaxValue;

            for (int i = 0; i < _Interactions.Count; i++)
            {
                if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i))
                {
                    SRectF targetRect = _GetRect(i);
                    float dist = _GetDistance90(Key, actualRect, targetRect);
                    if (dist >= 0f && dist < Distance)
                    {
                        Distance = dist;
                        min = i;
                        Stage = 10;
                    }
                }
            }

            if (min == _Selection)
            {
                for (int i = 0; i < _Interactions.Count; i++)
                {
                    if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i))
                    {
                        SRectF targetRect = _GetRect(i);
                        float dist = _GetDistance180(Key, actualRect, targetRect);
                        if (dist >= 0f && dist < Distance)
                        {
                            Distance = dist;
                            min = i;
                            Stage = 20;
                        }
                    }
                }
            }

            if (min == _Selection)
            {
                switch (Key.Key)
                {
                    case Keys.Up:
                        actualRect = new SRectF(actualRect.X, CSettings.iRenderH, 1, 1, actualRect.Z);
                        break;
                    case Keys.Down:
                        actualRect = new SRectF(actualRect.X, 0, 1, 1, actualRect.Z);
                        break;
                    case Keys.Left:
                        actualRect = new SRectF(CSettings.iRenderW, actualRect.Y, 1, 1, actualRect.Z);
                        break;
                    case Keys.Right:
                        actualRect = new SRectF(0, actualRect.Y, 1, 1, actualRect.Z);
                        break;
                    default:
                        break;
                }

                for (int i = 0; i < _Interactions.Count; i++)
                {
                    if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i))
                    {
                        SRectF targetRect = _GetRect(i);
                        float dist = _GetDistance180(Key, actualRect, targetRect);
                        if (dist >= 0f && dist < Distance)
                        {
                            Distance = dist;
                            min = i;
                            Stage = 30;
                        }
                    }
                }
            }
            return min;
        }
Esempio n. 31
0
        private void DrawToneHelper(int n, int BaseLine, float XOffset)
        {
            int TonePlayer = CSound.RecordGetToneAbs(_PlayerNotes[n].PlayerNr);

            SRectF Rect = _PlayerNotes[n].Rect;

            while (TonePlayer - BaseLine < 0)
                TonePlayer += 12;

            while (TonePlayer - BaseLine > 12)
                TonePlayer -= 12;

            if (XOffset < 0f)
                XOffset = 0f;

            if (XOffset > Rect.W)
                XOffset = Rect.W;

            float dy = Rect.H / (CSettings.NumNoteLines);
            SRectF rect = new SRectF(
                        Rect.X - dy + XOffset,
                        Rect.Y + dy * (CSettings.NumNoteLines - 1 - (TonePlayer - BaseLine) / 2f),
                        dy,
                        dy,
                        Rect.Z
                        );

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

            STexture ToneHelper = CTheme.GetSkinTexture(_Theme.SkinToneHelperName);
            CDraw.DrawTexture(ToneHelper, rect, color);

            while (TonePlayer - BaseLine < 12)
                TonePlayer += 12;

            while (TonePlayer - BaseLine > 24)
                TonePlayer -= 12;

            rect = new SRectF(
                Rect.X - dy + XOffset,
                Rect.Y + dy * (CSettings.NumNoteLines - 1 - (TonePlayer - BaseLine) / 2f),
                dy,
                dy,
                Rect.Z
                );

            CDraw.DrawTexture(ToneHelper, rect, color);
        }
Esempio n. 32
0
        private void DrawNote(SRectF Rect, SColorF Color, float factor)
        {
            const int spacing = 0;

            float d = (1f - factor) / 2 * Rect.H;
            float dw = d;

            if (2 * dw > Rect.W)
                dw = Rect.W / 2;

            SRectF r = new SRectF(
                Rect.X + dw + spacing,
                Rect.Y + d + spacing,
                Rect.W - 2 * dw - 2 * spacing,
                Rect.H - 2 * d - 2 * spacing,
                Rect.Z
                );

            STexture NoteBegin = CTheme.GetSkinTexture(_Theme.SkinLeftName);
            STexture NoteMiddle = CTheme.GetSkinTexture(_Theme.SkinMiddleName);
            STexture NoteEnd = CTheme.GetSkinTexture(_Theme.SkinRightName);

            float dx = NoteBegin.width * r.H / NoteBegin.height;
            if (2 * dx > r.W)
                dx = r.W / 2;

            CDraw.DrawTexture(NoteBegin, new SRectF(r.X, r.Y, dx, r.H, r.Z), Color);
            CDraw.DrawTexture(NoteMiddle, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z), Color);
            CDraw.DrawTexture(NoteEnd, new SRectF(r.X + r.W - dx, r.Y, dx, r.H, r.Z), Color);
        }
Esempio n. 33
0
        private void AddPerfectNote(SRectF Rect, int n, float factor)
        {
            const int spacing = 0;

            float d = (1f - factor) / 2 * Rect.H;
            float dw = d;

            if (2 * dw > Rect.W)
                dw = Rect.W / 2;

            SRectF r = new SRectF(
                Rect.X + dw + spacing,
                Rect.Y + d + spacing,
                Rect.W - 2 * dw - 2 * spacing,
                Rect.H - 2 * d - 2 * spacing,
                Rect.Z
                );

            STexture NoteBegin = CTheme.GetSkinTexture(_Theme.SkinLeftName);
            float dx = NoteBegin.width * r.H / NoteBegin.height;
            if (2 * dx > r.W)
                dx = r.W / 2;

            r = new SRectF(
                r.X + r.W - dx,
                r.Y,
                dx * 0.5f,
                dx * 0.2f,
                Rect.Z
                );

            CParticleEffect stars = new CParticleEffect(CGame.Rand.Next(2) + 1, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinPerfectNoteStarName, 35, EParticeType.PerfNoteStar);
            _PlayerNotes[n].PerfectNoteEffect.Add(stars);
        }
Esempio n. 34
0
        private void AddGoldenNote(SRectF Rect, int n, int Nr, float factor)
        {
            const int spacing = 0;

            if ( Nr > _PlayerNotes[n].GoldenStars.Count)
            {
                float d = (1f - factor) / 2 * Rect.H;
                float dw = d;

                if (2 * dw > Rect.W)
                    dw = Rect.W / 2;

                SRectF r = new SRectF(
                    Rect.X + dw + spacing,
                    Rect.Y + d + spacing,
                    Rect.W - 2 * dw - 2 * spacing,
                    Rect.H - 2 * d - 2 * spacing,
                    Rect.Z
                    );

                int numstars = (int)(r.W * 0.25f);
                CParticleEffect stars = new CParticleEffect(numstars, new SColorF(1f, 1f, 0f, 1f), r, _Theme.SkinGoldenStarName, 20, EParticeType.Star);
                _PlayerNotes[n].GoldenStars.Add(stars);
            }
        }
Esempio n. 35
0
 /// <summary>
 ///     Draws a colored rectangle
 /// </summary>
 /// <param name="color">The color in which the rectangle will be drawn in</param>
 /// <param name="rect">The coordinates in a SRectF struct</param>
 public void DrawRect(SColorF color, SRectF rect)
 {
     DrawTexture(_BlankTexture, rect, color);
 }
Esempio n. 36
0
 /// <summary>
 ///     Draws reflection of a colored rectangle
 /// </summary>
 /// <param name="color">The color in which the rectangle will be drawn in</param>
 /// <param name="rect">The coordinates in a SRectF struct</param>
 /// <param name="space">The space between the texture and the reflection</param>
 /// <param name="height">The height of the reflection</param>
 public void DrawRectReflection(SColorF color, SRectF rect, float space, float height)
 {
     DrawTextureReflection(_BlankTexture, rect, color, rect, space, height);
 }
Esempio n. 37
0
 public void DrawRect(SColorF color, SRectF rect, bool allMonitors = true)
 {
 }
Esempio n. 38
0
 public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
 {
 }
Esempio n. 39
0
 private void AddGoldenNote(SRectF Rect, int n, int Nr)
 {
     AddGoldenNote(Rect, n, Nr, 1f);
 }
Esempio n. 40
0
 public void DrawColor(SColorF color, SRectF rect)
 {
 }
Esempio n. 41
0
 private void AddPerfectNote(SRectF Rect, int n)
 {
     AddPerfectNote(Rect, n, 1f);
 }
Esempio n. 42
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         DrawTexture(Texture, rect, color, bounds, false);
     }
 }
Esempio n. 43
0
 private void DrawNote(SRectF Rect, SColorF Color)
 {
     DrawNote(Rect, Color, 1f);
 }
Esempio n. 44
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         Bitmap ColoredBitmap = ColorizeBitmap(_Bitmaps[Texture.index], color);
         _g.DrawImage(ColoredBitmap, new RectangleF(rect.X, rect.Y, rect.W, rect.H));
         ColoredBitmap.Dispose();
     }
 }
Esempio n. 45
0
        private void DrawNoteBG(SRectF Rect, SColorF Color, float factor, Stopwatch Timer)
        {
            const int spacing = 0;
            const float period = 1.5f; //[s]

            if (!Timer.IsRunning)
                Timer.Start();

            if (Timer.ElapsedMilliseconds / 1000f > period)
            {
                Timer.Reset();
                Timer.Start();
            }

            float alpha = (float)((Math.Cos((Timer.ElapsedMilliseconds / 1000f) / period * Math.PI * 2) + 1) / 2.0) / 2f + 0.5f;
            float d = (1f - factor) / 2 * Rect.H;
            float dw = d;
            if (2 * dw > Rect.W)
                dw = Rect.W / 2;

            SRectF r = new SRectF(
                Rect.X + dw + spacing,
                Rect.Y + d + spacing,
                Rect.W - 2 * dw - 2 * spacing,
                Rect.H - 2 * d - 2 * spacing,
                Rect.Z
                );

            STexture NoteBackgroundBegin = CTheme.GetSkinTexture(_Theme.SkinBackgroundLeftName);
            STexture NoteBackgroundMiddle = CTheme.GetSkinTexture(_Theme.SkinBackgroundMiddleName);
            STexture NoteBackgroundEnd = CTheme.GetSkinTexture(_Theme.SkinBackgroundRightName);

            float dx = NoteBackgroundBegin.width * r.H / NoteBackgroundBegin.height;
            if (2 * dx > r.W)
                dx = r.W / 2;

            SColorF col = new SColorF(Color.R, Color.G, Color.B, Color.A * alpha);

            CDraw.DrawTexture(NoteBackgroundBegin, new SRectF(r.X, r.Y, dx, r.H, r.Z), col);
            CDraw.DrawTexture(NoteBackgroundMiddle, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z), col);
            CDraw.DrawTexture(NoteBackgroundEnd, new SRectF(r.X + r.W - dx, r.Y, dx, r.H, r.Z), col);
        }
Esempio n. 46
0
 public void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
 {
 }
Esempio n. 47
0
        private void DrawColor()
        {
            SRectF bounds = new SRectF(0f, 0f, CSettings.iRenderW, CSettings.iRenderH, CSettings.zFar/4);

            CDraw.DrawColor(Color, bounds);
        }
Esempio n. 48
0
 public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, float begin, float end, bool allMonitors = true)
 {
 }
Esempio n. 49
0
 public void DrawTexture(STexture Texture, SRectF rect)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         DrawTexture(Texture, rect, Texture.color);
     }
 }
Esempio n. 50
0
 public void DrawRect(SColorF color, SRectF rect)
 {
 }
Esempio n. 51
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, bool mirrored)
 {
     if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
     {
         DrawTexture(Texture, rect, color, rect, mirrored);
     }
 }
Esempio n. 52
0
 public void DrawRectReflection(SColorF color, SRectF rect, float space, float height)
 {
 }
Esempio n. 53
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end)
 {
 }
Esempio n. 54
0
 /// <summary>
 ///     Draws a colored rectangle
 /// </summary>
 /// <param name="color">The color in which the rectangle will be drawn in</param>
 /// <param name="rect">The coordinates in a SRectF struct</param>
 public void DrawRect(SColorF color, SRectF rect, bool allMonitors = true)
 {
     DrawTexture(_BlankTexture, rect, color, false, allMonitors);
 }
Esempio n. 55
0
        private float _GetDistance90(KeyEvent Key, SRectF actualRect, SRectF targetRect)
        {
            PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f);
            PointF dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f);

            PointF vector = new PointF(dest.X - source.X, dest.Y - source.Y);
            float distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
            bool inDirection = false;
            switch (Key.Key)
            {
                case Keys.Up:
                    if (vector.Y < 0f && (vector.Y <= vector.X && vector.X <= 0 || -vector.Y >= vector.X && vector.X >= 0f))
                        inDirection = true;
                    break;

                case Keys.Down:
                    if (vector.Y > 0f && (vector.Y >= vector.X && vector.X >= 0 || vector.Y >= -vector.X && vector.X <= 0f))
                        inDirection = true;
                    break;

                case Keys.Left:
                    if (vector.X < 0f && (vector.X <= vector.Y && vector.Y <= 0 || -vector.X >= vector.Y && vector.Y >= 0f))
                        inDirection = true;
                    break;

                case Keys.Right:
                    if (vector.X > 0f && (vector.X >= vector.Y && vector.Y >= 0 || vector.X >= -vector.Y && vector.Y <= 0f))
                        inDirection = true;
                    break;

                default:
                    break;
            }
            if (!inDirection)
                return float.MaxValue;
            else
                return distance;
        }
Esempio n. 56
0
 public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, float begin, float end)
 {
 }
Esempio n. 57
0
        private SRectF _GetRect(int interaction)
        {
            SRectF Result = new SRectF();
            switch (_Interactions[interaction].Type)
            {
                case EType.TButton:
                    return _Buttons[_Interactions[interaction].Num].Rect;

                case EType.TSelectSlide:
                    return _SelectSlides[_Interactions[interaction].Num].Rect;

                case EType.TStatic:
                    return _Statics[_Interactions[interaction].Num].Rect;

                case EType.TText:
                    return _Texts[_Interactions[interaction].Num].Bounds;

                case EType.TSongMenu:
                    return _SongMenus[_Interactions[interaction].Num].Rect;

                case EType.TLyric:
                    return _Lyrics[_Interactions[interaction].Num].Rect;
            }

            return Result;
        }
Esempio n. 58
0
 public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float space, float height, bool allMonitors = true)
 {
 }