Esempio n. 1
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. 2
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. 3
0
        /// <summary>
        ///     Adds a texture to the vertext buffer
        /// </summary>
        /// <param name="texture">Texture to draw</param>
        /// <param name="dc">Coordinates to draw on</param>
        /// <param name="color">Color to use</param>
        /// <param name="isReflection">If true, then color is faded out in y direction</param>
        protected override void _DrawTexture(CD3DTexture texture, SDrawCoords dc, SColorF color, bool isReflection = false)
        {
            //Align the pixels because Direct3D expects the pixels to be the left top corner
            dc.Wx1 -= 0.5f;
            dc.Wy1 -= 0.5f;
            dc.Wx2 -= 0.5f;
            dc.Wy2 -= 0.5f;

            color.A *= CGraphics.GlobalAlpha;
            int c = color.AsColor().ToArgb();
            int c2;

            if (isReflection)
            {
                color.A = 0;
                c2      = color.AsColor().ToArgb();
            }
            else
            {
                c2 = c;
            }

            var vert = new STexturedColoredVertex[4];

            vert[0] = new STexturedColoredVertex(new Vector3(dc.Wx1, -dc.Wy1, dc.Wz), new Vector2(dc.Tx1, dc.Ty1), c);
            vert[1] = new STexturedColoredVertex(new Vector3(dc.Wx1, -dc.Wy2, dc.Wz), new Vector2(dc.Tx1, dc.Ty2), c2);
            vert[2] = new STexturedColoredVertex(new Vector3(dc.Wx2, -dc.Wy2, dc.Wz), new Vector2(dc.Tx2, dc.Ty2), c2);
            vert[3] = new STexturedColoredVertex(new Vector3(dc.Wx2, -dc.Wy1, dc.Wz), new Vector2(dc.Tx2, dc.Ty1), c);
            _AddToVertexBuffer(vert, texture.D3DTexture, _CalculateRotationMatrix(dc.Rotation, dc.Wx1, dc.Wx2, dc.Wy1, dc.Wy2));
        }
Esempio n. 4
0
        public static Bitmap ColorizeBitmap(Bitmap original, SColorF color)
        {
            Bitmap newBitmap = new Bitmap(original.Width, original.Height);

            Graphics g = Graphics.FromImage(newBitmap);

            ColorMatrix cm = new ColorMatrix();

            cm.Matrix33 = color.A;
            cm.Matrix00 = color.R;
            cm.Matrix11 = color.G;
            cm.Matrix22 = color.B;
            cm.Matrix44 = 1;

            ImageAttributes ia = new ImageAttributes();

            ia.SetColorMatrix(cm);

            g.DrawImage(original, new Rectangle(0, 0, original.Width, original.Height),
                        0, 0, original.Width, original.Height, GraphicsUnit.Pixel, ia);

            ia.Dispose();
            g.Dispose();

            return(newBitmap);
        }
Esempio n. 5
0
 public SColorF(SColorF Color)
 {
     R = Color.R;
     G = Color.G;
     B = Color.B;
     A = Color.A;
 }
Esempio n. 6
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. 7
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. 8
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. 9
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. 10
0
 public CBackground()
 {
     _ThemeLoaded = false;
     _Theme = new SThemeBackground();
     
     Color = new SColorF(0f, 0f, 0f, 1f);
 }
Esempio n. 11
0
 public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, bool mirrored = false)
 {
     if (texture != null)
     {
         DrawTexture(texture, rect, color, rect, mirrored);
     }
 }
Esempio n. 12
0
 public SColorF(SColorF Color)
 {
     R = Color.R;
     G = Color.G;
     B = Color.B;
     A = Color.A;
 }
Esempio n. 13
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. 14
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. 15
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. 16
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. 17
0
        protected override void _DrawTexture(COGLTexture texture, SDrawCoords dc, SColorF color, bool isReflection = false)
        {
            // Align textures to full pixels to reduce artefacts
            dc.Wx1 = (float)Math.Round(dc.Wx1);
            dc.Wy1 = (float)Math.Round(dc.Wy1);
            dc.Wx2 = (float)Math.Round(dc.Wx2);
            dc.Wy2 = (float)Math.Round(dc.Wy2);

            GL.BindTexture(TextureTarget.Texture2D, texture.Name);

            GL.Enable(EnableCap.Blend);

            GL.MatrixMode(MatrixMode.Texture);
            GL.PushMatrix();

            if (Math.Abs(dc.Rotation) > float.Epsilon)
            {
                GL.Translate(0.5f, 0.5f, 0);
                GL.Rotate(-dc.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.TexCoord2(dc.Tx1, dc.Ty1);
            GL.Vertex3(dc.Wx1, dc.Wy1, dc.Wz);

            if (isReflection)
            {
                GL.Color4(color.R, color.G, color.B, 0);
            }
            GL.TexCoord2(dc.Tx1, dc.Ty2);
            GL.Vertex3(dc.Wx1, dc.Wy2, dc.Wz);

            GL.TexCoord2(dc.Tx2, dc.Ty2);
            GL.Vertex3(dc.Wx2, dc.Wy2, dc.Wz);

            if (isReflection)
            {
                GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
            }
            GL.TexCoord2(dc.Tx2, dc.Ty1);
            GL.Vertex3(dc.Wx2, dc.Wy1, dc.Wz);

            GL.End();

            GL.PopMatrix();

            GL.Disable(EnableCap.Blend);
            GL.BindTexture(TextureTarget.Texture2D, 0);
        }
Esempio n. 18
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. 19
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. 20
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. 21
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. 22
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. 23
0
        public CCursor(string textureName, SColorF color, float w, float h, float z)
        {
            _CursorFadingTimer = new Stopwatch();
            ShowCursor = true;
            _CursorTargetAlpha = 1f;
            _CursorStartAlpha = 0f;
            _CursorFadingTime = 0.5f;

            _CursorName = textureName;
            _Cursor = CDraw.AddTexture(CTheme.GetSkinFilePath(_CursorName));

            _Cursor.color = color;
            _Cursor.rect.W = w;
            _Cursor.rect.H = h;
            _Cursor.rect.Z = z;

            _Movetimer = new Stopwatch();
        }
Esempio n. 24
0
        public CLyric()
        {
            _Theme = new SThemeLyrics();
            _ThemeLoaded = false;
            Color = new SColorF();
            ColorProcessed = new SColorF();

            _X = 0f;
            _Y = 0f;
            _Z = 0f;
            _MaxW = 1f;
            _H = 1f;
            _width = 1f;
            _Notes = new List<SNote>();
            _Text = new CText();

            _Style = ELyricStyle.Slide;
        }
Esempio n. 25
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. 26
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. 27
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. 28
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. 29
0
        private static Bitmap _ColorizeBitmap(Bitmap original, SColorF color)
        {
            var newBitmap = new Bitmap(original.Width, original.Height);

            using (Graphics g = Graphics.FromImage(newBitmap))
            {
                var cm = new ColorMatrix {
                    Matrix33 = color.A, Matrix00 = color.R, Matrix11 = color.G, Matrix22 = color.B, Matrix44 = 1
                };

                using (var ia = new ImageAttributes())
                {
                    ia.SetColorMatrix(cm);

                    g.DrawImage(original, new Rectangle(0, 0, original.Width, original.Height),
                                0, 0, original.Width, original.Height, GraphicsUnit.Pixel, ia);
                }
            }

            return(newBitmap);
        }
Esempio n. 30
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. 31
0
        public static Bitmap ColorizeBitmap(Bitmap original, SColorF color)
        {
            Bitmap newBitmap = new Bitmap(original.Width, original.Height);

            Graphics g = Graphics.FromImage(newBitmap);

            ColorMatrix cm = new ColorMatrix();
            cm.Matrix33 = color.A;
            cm.Matrix00 = color.R;
            cm.Matrix11 = color.G;
            cm.Matrix22 = color.B;
            cm.Matrix44 = 1;

            ImageAttributes ia = new ImageAttributes();
            ia.SetColorMatrix(cm);

            g.DrawImage(original, new Rectangle(0, 0, original.Width, original.Height),
                0, 0, original.Width, original.Height, GraphicsUnit.Pixel, ia);

            ia.Dispose();
            g.Dispose();

            return newBitmap;
        }
Esempio n. 32
0
 public void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
 {
 }
Esempio n. 33
0
 public void DrawRect(SColorF color, SRectF rect, bool allMonitors = true)
 {
 }
Esempio n. 34
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. 35
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. 36
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. 37
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. 38
0
 public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
 {
 }
Esempio n. 39
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. 40
0
 public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, float begin, float end, bool allMonitors = true)
 {
 }
Esempio n. 41
0
 public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, float begin, float end)
 {
 }
Esempio n. 42
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. 43
0
 public void DrawRectReflection(SColorF color, SRectF rect, float space, float height)
 {
 }
Esempio n. 44
0
 public void DrawRect(SColorF color, SRectF rect)
 {
 }
Esempio n. 45
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. 46
0
 public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float space, float height, bool allMonitors = true)
 {
 }
Esempio n. 47
0
 private void DrawNote(SRectF Rect, SColorF Color)
 {
     DrawNote(Rect, Color, 1f);
 }
Esempio n. 48
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds)
 {
     DrawTexture(Texture, rect, color, bounds, false);
 }
Esempio n. 49
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. 50
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, bool mirrored)
 {
     DrawTexture(Texture, rect, color, new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, rect.Z), mirrored);
 }
Esempio n. 51
0
 public void LoadTextures()
 {
     if (_Theme.ColorName != String.Empty)
         Color = CTheme.GetColor(_Theme.ColorName);
 }
Esempio n. 52
0
 /// <summary>
 ///     Adds a texture to the vertext buffer
 /// </summary>
 /// <param name="texture">Texture to draw</param>
 /// <param name="dc">Coordinates to draw on</param>
 /// <param name="color">Color to use</param>
 /// <param name="isReflection">If true, then color is faded out in y direction</param>
 protected abstract void _DrawTexture(TTextureType texture, SDrawCoords dc, SColorF color, bool isReflection = false);
Esempio n. 53
0
 public void DrawColor(SColorF color, SRectF rect)
 {
 }
Esempio n. 54
0
        public void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
        {
            if (rect.W == 0f || rect.H == 0f || bounds.H == 0f || bounds.W == 0f || color.A == 0f || height <= 0f)
                return;

            if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X)
                return;

            if (bounds.Y > rect.Y + rect.H || bounds.Y + bounds.H < rect.Y)
                return;

            if (height > bounds.H)
                height = bounds.H;

            if (_TextureExists(ref Texture))
            {
                GL.BindTexture(TextureTarget.Texture2D, Texture.ID);

                float x1 = (bounds.X - rect.X) / rect.W * Texture.width_ratio;
                float x2 = (bounds.X + bounds.W - rect.X) / rect.W * Texture.width_ratio;
                float y1 = (bounds.Y - rect.Y + rect.H - height) / rect.H * Texture.height_ratio;
                float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * Texture.height_ratio;

                if (x1 < 0)
                    x1 = 0f;

                if (x2 > Texture.width_ratio)
                    x2 = Texture.width_ratio;

                if (y1 < 0)
                    y1 = 0f;

                if (y2 > Texture.height_ratio)
                    y2 = Texture.height_ratio;

                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 < bounds.X)
                    rx1 = bounds.X;

                if (rx2 > bounds.X + bounds.W)
                    rx2 = bounds.X + bounds.W;

                if (ry1 < bounds.Y + space)
                    ry1 = bounds.Y + space;

                if (ry2 > bounds.Y + bounds.H + space + height)
                    ry2 = bounds.Y + bounds.H + space + height;

                GL.Enable(EnableCap.Blend);

                GL.MatrixMode(MatrixMode.Texture);
                GL.PushMatrix();

                if (rect.Rotation != 0f)
                {
                    GL.Translate(0.5f, 0.5f, 0);
                    GL.Rotate(-rect.Rotation, 0f, 0f, 1f);
                    GL.Translate(-0.5f, -0.5f, 0);
                }

                GL.Begin(BeginMode.Quads);

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

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

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

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

                GL.End();

                GL.PopMatrix();

                GL.Disable(EnableCap.Blend);
                GL.BindTexture(TextureTarget.Texture2D, 0);
            }
        }
Esempio n. 55
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. 56
0
        public virtual int AddPlayer(SRectF Rect, SColorF Color, int PlayerNr)
        {
            SPlayerNotes notes = new SPlayerNotes();

            notes.Rect = Rect;
            notes.Color = Color;
            notes.Alpha = 1f;
            notes.ID = ++_ActID;
            notes.Lines = null;
            notes.LineNr = -1;
            notes.PlayerNr = PlayerNr;
            notes.Timer = new Stopwatch();
            notes.GoldenStars = new List<CParticleEffect>();
            notes.Flares = new List<CParticleEffect>();
            notes.PerfectNoteEffect = new List<CParticleEffect>();
            notes.PerfectLineTwinkle = new List<CParticleEffect>();
            _PlayerNotes.Add(notes);

            return notes.ID;
        }
Esempio n. 57
0
 public void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end)
 {
 }
Esempio n. 58
0
        public virtual void Draw(int ID, List<CLine> SingLine, int Player)
        {
            int n = FindPlayerLine(ID);
            if (n == -1)
                return;

            if (_PlayerNotes[n].LineNr == -1)
                return;

            if (_PlayerNotes[n].Lines == null)
                return;

            if (_PlayerNotes[n].Lines.Length <= _PlayerNotes[n].LineNr)
                return;

            CLine Line = _PlayerNotes[n].Lines[_PlayerNotes[n].LineNr];

            if (CConfig.DrawNoteLines == EOffOn.TR_CONFIG_ON)
            {
                DrawNoteLines(_PlayerNotes[n].Rect, new SColorF(0.5f, 0.5f, 0.5f, 0.5f * _PlayerNotes[n].Alpha));
            }

            if (Line.NoteCount == 0)
                return;

            float w = _PlayerNotes[n].Rect.W;
            float h = _PlayerNotes[n].Rect.H;
            float dh = h / CSettings.NumNoteLines * (2f - (int)CGame.Player[_PlayerNotes[n].PlayerNr].Difficulty) / 4f;

            float beats = Line.LastBeat - Line.FirstBeat + 1;

            if (beats == 0)
                return;

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

            float BaseLine = Line.BaseLine;
            int Nr = 1;
            foreach (CNote note in Line.Notes)
            {
                if (note.NoteType != ENoteType.Freestyle)
                {
                    float width = note.Duration / beats * w;

                    SRectF rect = new SRectF(
                        _PlayerNotes[n].Rect.X + (note.StartBeat - Line.FirstBeat) / beats * w,
                        _PlayerNotes[n].Rect.Y + (CSettings.NumNoteLines - 1 - (note.Tone - BaseLine)/2) / CSettings.NumNoteLines * h - dh,
                        width,
                        h / CSettings.NumNoteLines + 2 * dh,
                        _PlayerNotes[n].Rect.Z
                        );

                    DrawNoteBG(rect, color, 1f, _PlayerNotes[n].Timer);
                    DrawNote(rect, new SColorF(5f, 5f, 5f, 0.7f * _PlayerNotes[n].Alpha), 0.7f);

                    if (note.NoteType == ENoteType.Golden)
                    {
                        AddGoldenNote(rect, n, Nr);
                        Nr++;
                    }
                }
            }

            if (CConfig.DrawToneHelper == EOffOn.TR_CONFIG_ON)
            {
                DrawToneHelper(n, (int)BaseLine, (CGame.MidBeatD - Line.FirstBeat) / beats * w);
            }

            int i = 0;
            while (i < _PlayerNotes[n].PerfectLineTwinkle.Count)
            {
                _PlayerNotes[n].PerfectLineTwinkle[i].Update();
                if (!_PlayerNotes[n].PerfectLineTwinkle[i].IsAlive)
                {
                    _PlayerNotes[n].PerfectLineTwinkle.RemoveAt(i);
                }
                else
                    i++;
            }

            foreach (CParticleEffect perfline in _PlayerNotes[n].PerfectLineTwinkle)
            {
                perfline.Draw();
            }

            if (SingLine == null || SingLine.Count == 0 || CGame.Player[Player].CurrentLine == -1 || SingLine.Count <= CGame.Player[Player].CurrentLine)
            {
                foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
                {
                    stars.Update();
                    stars.Alpha = _PlayerNotes[n].Alpha;
                    stars.Draw();
                }
                return;
            }

            foreach (CNote note in SingLine[CGame.Player[Player].CurrentLine].Notes)
            {
                if (note.StartBeat >= Line.FirstBeat && note.EndBeat <= Line.LastBeat)
                {
                    float width = note.Duration / beats * w;

                    if (note.EndBeat == CGame.ActBeatD)
                        width -= (1 - (CGame.MidBeatD - CGame.ActBeatD)) / beats * w;

                    SRectF rect = new SRectF(
                        _PlayerNotes[n].Rect.X + (note.StartBeat - Line.FirstBeat) / beats * w,
                        _PlayerNotes[n].Rect.Y + (CSettings.NumNoteLines - 1 - (note.Tone - BaseLine)/2) / CSettings.NumNoteLines * h - dh,
                        width,
                        h / CSettings.NumNoteLines + 2 * dh,
                        _PlayerNotes[n].Rect.Z
                        );

                    float f = 0.7f;
                    if (!note.Hit)
                        f = 0.4f;

                    DrawNote(rect, color, f);

                    if (note.EndBeat >= CGame.ActBeatD && note.Hit && note.NoteType == ENoteType.Golden)
                    {
                        AddFlare(rect, n);
                    }

                    if (note.Perfect && note.EndBeat < CGame.ActBeatD)
                    {
                        AddPerfectNote(rect, n);
                        note.Perfect = false;
                    }
                }
            }

            int currentLine = CGame.Player[Player].SingLine.Count - 1;
            if (currentLine > 0)
            {
                if (CGame.Player[Player].SingLine[currentLine - 1].PerfectLine)
                {
                    AddPerfectLine(n);
                    CGame.Player[Player].SingLine[currentLine - 1].PerfectLine = false;
                }
            }

            i = 0;
            while (i < _PlayerNotes[n].Flares.Count)
            {
                _PlayerNotes[n].Flares[i].Update();
                if (!_PlayerNotes[n].Flares[i].IsAlive)
                {
                    _PlayerNotes[n].Flares.RemoveAt(i);
                }
                else
                    i++;
            }

            i = 0;
            while (i < _PlayerNotes[n].PerfectNoteEffect.Count)
            {
                _PlayerNotes[n].PerfectNoteEffect[i].Update();
                if (!_PlayerNotes[n].PerfectNoteEffect[i].IsAlive)
                {
                    _PlayerNotes[n].PerfectNoteEffect.RemoveAt(i);
                }
                else
                    i++;
            }

            foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
            {
                stars.Update();
                stars.Alpha = _PlayerNotes[n].Alpha;
                stars.Draw();
            }

            foreach (CParticleEffect flare in _PlayerNotes[n].Flares)
            {
                flare.Draw();
            }

            foreach (CParticleEffect perfnote in _PlayerNotes[n].PerfectNoteEffect)
            {
                perfnote.Draw();
            }
        }
Esempio n. 59
0
        public void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end)
        {
            if (_TextureExists(ref Texture))
            {
                GL.BindTexture(TextureTarget.Texture2D, Texture.ID);

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

                GL.Begin(BeginMode.Quads);

                GL.TexCoord2(0f + begin * Texture.width_ratio, 0f);
                GL.Vertex3(rect.X + begin * rect.W, rect.Y, rect.Z + CGraphics.ZOffset);

                GL.TexCoord2(0f + begin * Texture.width_ratio, Texture.height_ratio);
                GL.Vertex3(rect.X + begin * rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset);

                GL.TexCoord2(Texture.width_ratio * end, Texture.height_ratio);
                GL.Vertex3(rect.X + end * rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset);

                GL.TexCoord2(Texture.width_ratio * end, 0f);
                GL.Vertex3(rect.X + end * rect.W, rect.Y, rect.Z + CGraphics.ZOffset);

                GL.End();

                GL.Disable(EnableCap.Blend);
                GL.BindTexture(TextureTarget.Texture2D, 0);
            }
        }
Esempio n. 60
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);
 }