コード例 #1
0
 public FloatingMessage(Game game, string text) : base(game)
 {
     Ani               = new Animation(null);
     Text              = new TextSprite();
     Text.Text         = text;
     Text.TextColor    = "#FFFFFF";
     Text.ShadowColor  = "#000000";
     Text.ShadowOffset = new Vector2(2, 2);
     Text.ShadowBlur   = 1;
     Text.FontSize     = 14;
     time              = 30 + (text.Length * 20);
 }
コード例 #2
0
        public ButtonSprite AddButton(string buttonText, int row = -1, dynamic data = null)
        {
            TextSprite T = new TextSprite();

            T.Text     = buttonText;
            T.FontSize = FontSize;
            //ButtonSprite B = new ButtonSprite(T, (int)(FontSize * 0.05));
            ButtonSprite B = new ButtonSprite(T, (int)(FontSize * 0.1));

            if (data != null)
            {
                B.Data = data;
            }
            AddButton(B, row);
            return(B);
        }
コード例 #3
0
 public void CenterText(TextSprite T, Vector2 Location)
 {
     T.ForceUpdate();
     T.Position.X = Location.X - (T.spriteBuffer.Width / 2);
     T.Position.Y = Location.Y - (T.spriteBuffer.Height / 2);
 }
コード例 #4
0
        public TitleScreen()
        {
            spriteBuffer.Width  = App.Canvas.Width;
            spriteBuffer.Height = (int)(spriteBuffer.Width * App.TargetAspect);
            Title          = new TextSprite();
            Title.FontSize = (int)(spriteBuffer.Width * 0.06f);
            //Title.Text = "Cirno and the mysterious tower";
            Title.Text         = App.GameName;
            Title.TextColor    = "#77FFFF";
            Title.ShadowColor  = "#000000";
            Title.ShadowOffset = new Vector2(2, 2);
            Title.ShadowBlur   = 2;

            CenterTextWithFloats(Title, 0.5f, 0.06f);

            Version              = new TextSprite();
            Version.FontSize     = (int)(spriteBuffer.Width * 0.016f);
            Version.Text         = "Version:" + App.GameVersion;
            Version.TextColor    = "#FFFFFF";
            Version.ShadowColor  = "#000000";
            Version.ShadowOffset = new Vector2(2, 2);
            Version.ShadowBlur   = 2;

            CenterTextWithFloats(Version, 0.75f, 0.11f);

            /*Title.ForceUpdate();
             * Title.Position.Y = spriteBuffer.Height * 0.01f;
             * Title.Position.X = (spriteBuffer.Width / 2) - (Title.spriteBuffer.Width / 2);*/



            Desc           = new TextSprite();
            Desc.FontSize  = (int)(spriteBuffer.Width * 0.030f);
            Desc.TextColor = "#FFFFFF";
            //Desc.Text = "Cirno has found herself in a strange dungeon filled with ghosts!\nHer energy has been stolen, reclaim the energy orbs to extend your time.\nFind the big key to unlock the door.";
            //Desc.Text = "Cirno has found herself in a strange dungeon filled with ghosts!\nReclaim your stolen energy sealed inside the orbs to extend your time.\nFind the gold key to unlock the door.";
            Desc.Text         = "Cirno has found herself in a strange tower filled with ghosts!\nReclaim your stolen energy sealed inside the orbs to extend your time.\nRemember the door's location and search for the gold key.";
            Desc.ShadowColor  = "#000000";
            Desc.ShadowOffset = new Vector2(2, 2);
            Desc.ShadowBlur   = 2;
            CenterTextWithFloats(Desc, 0.5f, 0.2f);

            Controls              = new TextSprite();
            Controls.FontSize     = (int)(spriteBuffer.Width * 0.025f);
            Controls.TextColor    = "#FFFFFF";
            Controls.Text         = "Keyboard Controls:\nLeft/Right=Move\nUp/Down=Aim(Up activates chests/doors)\nZ=Shoot\nX=Jump/Mid-air jump\nA=Place block below you(costs time)\nEnter=Pause\nM=Toggle mute";
            Controls.ShadowColor  = "#000000";
            Controls.ShadowOffset = new Vector2(2, 2);
            Controls.ShadowBlur   = 2;
            CenterTextWithFloats(Controls, 0.5f, 0.4f);
            Controls.Position.X = Desc.Position.X;

            menu = new ButtonMenu(spriteBuffer.Width * 0.8f, spriteBuffer.Height * 0.5f, (int)(spriteBuffer.Width * 0.05f));
            var B = menu.AddButton("Start Game");

            B.OnClick = () => {
                game.Start();
            };
            //menu.Finish();
            B.Position.X += spriteBuffer.Width * 0.38f;
            B.Position.Y  = spriteBuffer.Height * 0.7f;

            //var CB = menu.AddButton("Controller:"+InputControllerManager._this.Controllers[0].id);
            var CB = menu.AddButton("Controller:" + App.IC.id);

            Controller = CB;
            CB.OnClick = () => {
                var ind = InputControllerManager._this.Controllers.IndexOf(App.IC);
                ind++;
                if (ind >= InputControllerManager._this.Controllers.Count)
                {
                    ind -= InputControllerManager._this.Controllers.Count;
                }
                App.IC = InputControllerManager._this.Controllers[ind];
                var TS = CB.Contents.As <TextSprite>();
                var W  = TS.spriteBuffer.Width;
                TS.Text = "Controller:" + App.IC.id;
                TS.ForceUpdate();
                CB.Position.X -= ((TS.spriteBuffer.Width - W) / 2);
            };
            CB.Position.X += spriteBuffer.Width * 0.38f;;
            CB.Position.Y  = B.Position.Y + (spriteBuffer.Height * 0.15f);
            //CB.Visible = false;
            CB.Lock();

            Credits           = new TextSprite();
            Credits.FontSize  = (int)(spriteBuffer.Width * 0.015f);
            Credits.TextColor = "#77FFFF";
            //Credits.Text = "Made by:RSGmaker                                                                                                                     Touhou Project and it's characters are owned by ZUN";
            Credits.Text         = "Made by:RSGmaker                                                                                                           Touhou Project and it's characters are owned by ZUN";
            Credits.ShadowColor  = "#000000";
            Credits.ShadowOffset = new Vector2(2, 2);
            Credits.ShadowBlur   = 2;
            CenterTextWithFloats(Credits, 0.5f, 0.98f);
        }
コード例 #5
0
 public void CenterTextWithFloats(TextSprite T, float X, float Y)
 {
     CenterText(T, new Vector2(spriteBuffer.Width * X, spriteBuffer.Height * Y));
 }