Exemple #1
0
        private void DrawEachMenuBox(DrawingLayer d, Color EdgeColor, Color InnerColor)        //테두리와 내부를 별도로 그리기 위한 일회성 메소드.
        {
            d.Draw(EdgeColor);
            DrawingLayer Inner = new DrawingLayer("Light", new Rectangle(d.GetPos().X + EdgePixelSize, d.GetPos().Y + EdgePixelSize, d.GetBound().Width - 2 * EdgePixelSize, d.GetBound().Height - 2 * EdgePixelSize));

            Inner.Draw(InnerColor);
        }
Exemple #2
0
 public static void DrawString(Camera2D cam, string s, DrawingLayer d, Vector2 vector2, Color color)
 {
     Game1.spriteBatch.Begin(SpriteSortMode.BackToFront,
                             BlendState.AlphaBlend,
                             null,
                             null,
                             null,
                             null,
                             cam.get_transformation(Game1.graphics.GraphicsDevice /*Send the variable that has your graphic device here*/));
     Game1.spriteBatch.DrawString(Standardfont, s, vector2 + new Vector2(d.GetPos().X, d.GetPos().Y), color);
     Game1.spriteBatch.End();
 }
Exemple #3
0
 public static void DrawString(string FontName, string s, DrawingLayer d, Vector2 vector2, Color color)
 {
     Temporaryfont = Game1.content.Load <SpriteFont>(FontName);
     Game1.spriteBatch.Begin(SpriteSortMode.BackToFront,
                             BlendState.AlphaBlend,
                             null,
                             null,
                             null,
                             null,
                             Standard.MainCamera.get_transformation(Game1.graphics.GraphicsDevice /*Send the variable that has your graphic device here*/));
     Game1.spriteBatch.DrawString(Temporaryfont, s, vector2 + new Vector2(d.GetPos().X, d.GetPos().Y), color);
     Game1.spriteBatch.End();
 }
Exemple #4
0
        public ScrollBar(DrawingLayer frame, string BarSpriteName, int BarSize, bool is_vertical, Action ScrollAction)
        {
            Frame      = frame;
            isVertical = is_vertical;
            if (isVertical)
            {
                Interval = Frame.GetBound().Height - BarSize;
            }
            else
            {
                Interval = Frame.GetBound().Width - BarSize;
            }

            ScrollEvent += ScrollAction;

            if (is_vertical)
            {
                Bar = new DrawingLayer(BarSpriteName, new Rectangle(Frame.GetPos(), new Point(Frame.GetBound().Width, BarSize)));
            }
            else
            {
                Bar = new DrawingLayer(BarSpriteName, new Rectangle(Frame.GetPos().X + Interval, Frame.GetPos().Y, BarSize, Frame.GetBound().Height));
            }
        }
Exemple #5
0
 public static Point GetPos()
 {
     return(mouseLayer.GetPos());
 }
Exemple #6
0
        public void Update()
        {
            if (ScrollEvent != null)
            {
                ScrollEvent();
            }

            //마우스 입력 처리
            if (Cursor.IsDragging(Bar) || (Cursor.JustdidLeftClick() && Cursor.IsOn(Frame)))
            {
                if (isVertical)
                {
                    Bar.SetCenter(new Point(Bar.GetPos().X, Cursor.GetPos().Y));
                }
                else
                {
                    Bar.SetCenter(new Point(Cursor.GetPos().X, Bar.GetPos().Y));
                }
            }

            //바가 범위를 벗어나지 않도록 조정.
            if (isVertical)
            {
                if (Bar.GetPos().Y < Frame.GetPos().Y)
                {
                    Bar.SetPos(Frame.GetPos());
                }
                if (Bar.GetPos().Y > Frame.GetPos().Y + Interval)
                {
                    Bar.SetPos(Bar.GetPos().X, Frame.GetPos().Y + Interval);
                }
                Bar.SetPos(Frame.GetPos().X, Bar.GetPos().Y);
            }
            else
            {
                if (Bar.GetPos().X < Frame.GetPos().X)
                {
                    Bar.SetPos(Frame.GetPos());
                }
                if (Bar.GetPos().X > Frame.GetPos().X + Interval)
                {
                    Bar.SetPos(Frame.GetPos().X + Interval, Bar.GetPos().Y);
                }
                Bar.SetPos(Bar.GetPos().X, Frame.GetPos().Y);
            }

            //계수조정.
            if (isVertical)
            {
                Coefficient = 1 - (Bar.GetPos().Y - Frame.GetPos().Y) / (float)Interval;
            }
            else
            {
                Coefficient = (Bar.GetPos().X - Frame.GetPos().X) / (float)Interval;
            }
        }
Exemple #7
0
 public Point GetPos()
 {
     return(Frame.GetPos());
 }