Exemple #1
0
        public static void DrawString(int fontSize, string fontName, string s, REMOPoint p, Color c)
        {
            GfxStr t = new GfxStr(fontName, s, p);

            t.FontSize = fontSize;
            t.Draw(c);
        }
Exemple #2
0
 public GfxStr(int fontSize, string font, string text, REMOPoint pos)
 {
     FontSize = fontSize;
     Texture  = Game1.content.Load <SpriteFont>(font);
     Text     = text;
     Bound    = new Rectangle(pos, Texture.MeasureString(Text).ToPoint());
 }
Exemple #3
0
        /// <summary>
        /// 화면에 문자열을 그립니다. 백그라운드 색을 설정합니다.
        /// </summary>
        /// <param name="s"></param>
        /// <param name="p"></param>
        /// <param name="c"></param>
        /// <param name="BackGroundColor"></param>
        public static void DrawString(string s, REMOPoint p, Color c, Color BackGroundColor)
        {
            GfxStr t = new GfxStr(s, p);

            Filter.Absolute(t, BackGroundColor);
            t.Draw(c);
        }
Exemple #4
0
        /// <summary>
        /// 만약 Gfx의 rotate값이 0이 아닐 경우, RContains 함수가 정확합니다. 다만, 보시다시피, 비싼 계산을 요구합니다.
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public bool RContains(REMOPoint p)
        {
            Vector2   v  = p;
            REMOPoint RO = new REMOPoint(Pos.X + (ROrigin.X * Bound.Width) / Texture.Width, Pos.Y + (ROrigin.Y * Bound.Height) / Texture.Height); //실제 회전중심의 위치를 잡습니다.

            v = Vector2.Transform(v, Matrix2D.Rotate(RO, -Rotate));
            return(Bound.Contains(v));
        }
Exemple #5
0
        /// <summary>
        /// The method has some error while casting Vector2 to Point. Not Precise.
        /// </summary>
        /// <param name="Origin"></param>
        /// <param name="r"></param>
        public void Zoom(REMOPoint Origin, float r)
        {
            REMOPoint v  = Pos;
            REMOPoint v2 = Pos + Bound.Size;// Get Right lower point of the Bound.

            v     = Vector2.Transform(v, Matrix2D.Zoom(Origin, r));
            v2    = Vector2.Transform(v2, Matrix2D.Zoom(Origin, r));
            Bound = new Rectangle(v, v2 - v);
        }
Exemple #6
0
        public static Matrix Rotate(REMOPoint Origin, float rotate)//Origin을 중심으로 회전한다. 기본값은 0f. 단위는 radian.
        {
            Matrix translateToOrigin       = Matrix.CreateTranslation(-Origin.X, -Origin.Y, 0);
            Matrix rotationMatrix          = Matrix.CreateRotationZ(rotate);
            Matrix translateBackToPosition = Matrix.CreateTranslation(Origin.X, Origin.Y, 0);

            Matrix compositeMatrix = translateToOrigin * rotationMatrix * translateBackToPosition;

            return(compositeMatrix);
        }
Exemple #7
0
 public SimpleMenu(int fontsize, REMOPoint pos, REMOPoint interval, string[] MenuNames, params Action[] MenuActions)
 {
     Menus = new Aligned <Button>(pos, interval);
     for (int i = 0; i < MenuNames.Length; i++)
     {
         Button menu = new Button(new GfxStr(fontsize, MenuNames[i]), MenuActions[i]);
         Menus.Add(menu);
     }
     Menus.Align();
 }
Exemple #8
0
        public static Matrix Zoom(REMOPoint Origin, float Zoom)//Origin을 중심으로 줌을 한다. 기본값은 1f
        {
            Matrix translateToOrigin       = Matrix.CreateTranslation(-Origin.X, -Origin.Y, 0);
            Matrix zoomMatrix              = Matrix.CreateScale(Zoom);
            Matrix translateBackToPosition = Matrix.CreateTranslation(Origin.X, Origin.Y, 0);

            Matrix compositeMatrix = translateToOrigin * zoomMatrix * translateBackToPosition;

            return(compositeMatrix);
        }
Exemple #9
0
        public static Matrix Mat2D(REMOPoint Origin, float rotate, float Zoom)//Origin을 중심으로 회전한 후 Zoom합니다.
        {
            Matrix translateToOrigin       = Matrix.CreateTranslation(-Origin.X, -Origin.Y, 0);
            Matrix zoomMatrix              = Matrix.CreateScale(Zoom);
            Matrix rotationMatrix          = Matrix.CreateRotationZ(rotate);
            Matrix translateBackToPosition = Matrix.CreateTranslation(Origin.X, Origin.Y, 0);

            Matrix compositeMatrix = translateToOrigin * rotationMatrix * zoomMatrix * translateBackToPosition;

            return(compositeMatrix);
        }
Exemple #10
0
        public void MoveTo(REMOPoint Destination, double speed)
        {
            float distance = (Destination - Pos).Abs;

            if (distance < speed)
            {
                Pos = Destination;
            }
            else
            {
                MoveByVector(Destination - Pos, speed);
            }
        }
Exemple #11
0
        public void MoveTo(int x, int y, float speed)   // (x,y)를 향해 등속운동.
        {
            double N = (new REMOPoint(x, y) - Pos).Abs; //Distance between to point.

            if (N < speed)                              //거리가 스피드보다 가까우면 도착.
            {
                Pos = new REMOPoint(x, y);
                return;
            }

            Vector2 v = new REMOPoint(x, y) - Pos;

            MoveByVector(v, speed);
        }
Exemple #12
0
        public DialogLoader(int fontsize, REMOPoint Name_Pos, REMOPoint Dialog_Pos, Color StringColor, Color BackgroundColor)
        {
            ScriptReader.AddRule("CG", (s) =>
            {
                CGPipeline[s].Draw();
            });
            ScriptReader.AddRule("n", (s) => { StandAlone.DrawString(fontsize, "KoreanFont", s, Name_Pos, StringColor); });
            ScriptReader.AddRule("s", (s) => {
                s = s.Replace("@", "\n");
                if (currentString.Length < s.Length && StandAlone.FrameTimer % 4 == 0)
                {
                    currentString = s.Substring(0, currentString.Length + 1);
                }
                StandAlone.DrawString(fontsize, "KoreanFont", currentString, Dialog_Pos, StringColor);
            });

            scn = new Scene(() =>
            {
                line = 0;
            }, () =>
            {
                if (User.JustPressed(Keys.Z) || User.JustPressed(Keys.Space) || User.JustLeftClicked())
                {
                    string currentScript = ScriptReader.ParseLine("s", Scripts[line]);
                    currentScript        = currentScript.Replace("@", "\n");
                    if (currentString.Length == currentScript.Length)
                    {
                        line++;                     //다음 라인으로 넘어갑니다.
                        currentString = "";
                        if (line == Scripts.Length) //스크립트를 다 읽었을 경우, 지정해둔 액션으로 넘어갑니다.
                        {
                            Projectors.Projector.Unload(scn);
                            AfterAction();
                        }
                    }
                    else
                    {
                        currentString = currentScript;
                    }
                }
            }, () =>
            {
                Filter.Absolute(StandAlone.FullScreen, BackgroundColor);
                ScriptReader.ReadLine(Scripts[line]);
                Cursor.Draw(Color.White);
            });
        }
Exemple #13
0
 public void MoveByVector(REMOPoint p, double v) => ButtonGraphic.MoveByVector(p, v);
Exemple #14
0
 public void MoveTo(REMOPoint p) => ButtonGraphic.MoveTo(p);
Exemple #15
0
 public void MoveTo(REMOPoint p, double speed) => ButtonGraphic.MoveTo(p, speed);
Exemple #16
0
            public static REMOPoint operator *(float c, REMOPoint p1)
            {
                REMOPoint ret = new REMOPoint(c * p1.X, c * p1.Y);

                return(ret);
            }
Exemple #17
0
            public static REMOPoint operator -(REMOPoint p1, REMOPoint p2)
            {
                REMOPoint ret = new REMOPoint(p1.X + p2.X, p1.Y + p2.Y);

                return(ret);
            }
Exemple #18
0
 public void DrawAddon(string AddonName, REMOPoint newSize, params Color[] cs)//Graphic의 position에 새 사이즈를 가진 애드온을 그립니다.
 {
     Game1.Painter.Draw(new Gfx2D(AddonName, new Rectangle(Pos, newSize)), cs);
 }
Exemple #19
0
 public void MoveByVector(REMOPoint v, float speed)// 벡터 v의 방향으로 speed의 속도로 등속운동한다.
 {
     Pos += v * (speed / v.Abs);
 }
Exemple #20
0
        public static REMOPoint operator -(Vector2 p1, REMOPoint p2)
        {
            REMOPoint ret = new REMOPoint(p1.X - p2.X, p1.Y - p2.Y);

            return(ret);
        }
Exemple #21
0
        /// <summary>
        /// 화면에 문자열을 그립니다.
        /// </summary>
        /// <param name="s"></param>
        /// <param name="p"></param>
        /// <param name="c"></param>
        public static void DrawString(string s, REMOPoint p, Color c)
        {
            GfxStr t = new GfxStr(s, p);

            t.Draw(c);
        }
Exemple #22
0
 public bool Contains(REMOPoint p)
 {
     return(Bound.Contains(p.ToPoint()));
 }
Exemple #23
0
 public REMOPoint(REMOPoint p)
 {
     X = p.X;
     Y = p.Y;
 }
Exemple #24
0
 public void MoveByVector(REMOPoint v, double speed) => Pos += v * ((float)speed / v.Abs);
Exemple #25
0
 public GfxStr(string text, REMOPoint pos)
 {
     Texture = Game1.content.Load <SpriteFont>("DefaultFont");
     Text    = text;
     Bound   = new Rectangle(pos, Texture.MeasureString(Text).ToPoint());
 }
Exemple #26
0
 public Gfx2D(string SpriteName, Rectangle boundRect)
 {
     Texture = Game1.content.Load <Texture2D>(SpriteName);
     Bound   = boundRect;
     ROrigin = new REMOPoint(Texture.Width / 2, Texture.Height / 2);
 }
Exemple #27
0
 public Gfx2D(string SpriteName, REMOPoint p, double r)
 {
     Texture = Game1.content.Load <Texture2D>(SpriteName);
     Bound   = new Rectangle(p, new REMOPoint((int)(Texture.Width * r), (int)(Texture.Height * r)));
     ROrigin = new REMOPoint(Texture.Width / 2, Texture.Height / 2);
 }
Exemple #28
0
 public static Matrix Translate(REMOPoint p)
 {
     return(Matrix.CreateTranslation(p.X, p.Y, 0));
 }
Exemple #29
0
 public CheckBox(int size, string description, REMOPoint pos)
 {
     Box         = new Gfx2D("Box", new Rectangle(pos.X, pos.Y, size * 2, size * 2));
     Description = new GfxStr(size, description, pos + new REMOPoint(size * 2 + size / 2, size / 4));
 }
Exemple #30
0
 public void MoveTo(REMOPoint p) => Pos = p;