Esempio n. 1
0
        public bool IsOn3D(FlatRedBall.Graphics.Text text, bool relativeToCamera)
        {
            Vector3 offset = new Vector3();

            switch (text.HorizontalAlignment)
            {
            case FlatRedBall.Graphics.HorizontalAlignment.Left:
                offset.X = text.ScaleX;
                break;

            case FlatRedBall.Graphics.HorizontalAlignment.Right:
                offset.X = -text.ScaleX;
                break;
            }

            switch (text.VerticalAlignment)
            {
            case FlatRedBall.Graphics.VerticalAlignment.Top:
                offset.Y = -text.ScaleY;
                break;

            case FlatRedBall.Graphics.VerticalAlignment.Bottom:
                offset.Y = text.ScaleY;
                break;
            }

            text.Position += offset;
            bool value = IsOn3D <FlatRedBall.Graphics.Text>(text, relativeToCamera);

            text.Position -= offset;

            return(value);
        }
Esempio n. 2
0
        public Hero(string name, HeroClass heroClass)
        {
            Collect = false;
            Online = TimeSpan.Zero;
            Target = Position;
            AcceptArrows = true;
            zLastPosition = Position;
            Netid = 0;
            Name = name;
            Class = heroClass;
            Position.Z = ZLayer.Npc;
            WalkingSpeed = 10;

            SpriteManager.AddPositionedObject(this);

            Collider = ShapeManager.AddCircle();
            Collider.AttachTo(this, false);
            Collider.Visible = false;

            Sprite = LoadSprite();
            Sprite.AttachTo(this, false);
            Sprite.Resize(4);
            Sprite.AnimationSpeed = 0.1f;            

            Label = TextManager.AddText(name, Globals.Font);
            Label.AttachTo(this, false);
            Label.HorizontalAlignment = HorizontalAlignment.Center;
            Label.RelativePosition = new Vector3(0, 4, ZLayer.NpcLabel - Position.Z);            

            InitStats();
        }
Esempio n. 3
0
        public override void Initialize(bool addToManagers)
        {
            base.Initialize(addToManagers);

            screenTitle = new Text();
            screenTitle.DisplayText = "Options";
            Vector2 titlePosition = PositionHelper.percentToCoordSprite(0.0f, 50.0f);
            screenTitle.Y = titlePosition.Y;
            screenTitle.HorizontalAlignment = HorizontalAlignment.Center;
            TextManager.AddText(screenTitle);

            GuiManager.IsUIEnabled = true;
            listBox = GuiManager.AddListBox();
            listBox.ScaleX = 20;
            listBox.ScaleY = 12;
            // The first argument to AddItem is the text to show for the item
            // The second argument is the object that the Item will store.
            // The second argment is optional, but we'll use it to reference
            // the background color that we want to use.
            listBox.AddItem("Red", Color.Red);
            listBox.AddItem("Blue", Color.Blue);
            listBox.AddItem("Yellow", Color.Yellow);

            for (int i = 0; i < 200; i++)
                listBox.AddItem("BLAAA" + i);

            if(addToManagers)
                AddToManagers();
        }
Esempio n. 4
0
 public LayoutableText()
 {
     _text = new Text
     {
         HorizontalAlignment = HorizontalAlignment.Center
     };
 }
Esempio n. 5
0
		void CustomInitialize()
		{
            mText = TextManager.AddText("");
            mText.SetPixelPerfectScale(SpriteManager.Camera);

            
		}
Esempio n. 6
0
 public TextBox(int x, int y, int width)
 {
     text = FlatRedBall.Graphics.TextManager.AddText("Enter Server IP");
     text.SetColor(66, 66, 66);
     mfont = GlobalData.GlobalData.Font;
     X     = x;
     Y     = y;
     Width = width;
 }
Esempio n. 7
0
 public ConnectScreen(Sprite sprite, Game game, string ip)
     : base(game, sprite)
 {
     mIP     = ip;
     timeout = TimeManager.CurrentTime;
     mAgent  = new NetworkAgent(AgentRole.Client, "VikingArcade");
     mAgent.Connect(mIP);
     tries++;
     prompter             = FlatRedBall.Graphics.TextManager.AddText("Attempting to Connect, Attempt #" + tries + " of 4");
     prompter.Position.Y += 7;
     prompter.Position.X -= 5;
 }
Esempio n. 8
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            TextInstance      = new FlatRedBall.Graphics.Text();
            TextInstance.Name = "TextInstance";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Creates a gamescreen and adds it to the proper list
        /// </summary>
        /// <param name="gameObjects"></param>
        /// <param name="ip"></param>
        //public void Creategamescreen(List<GameObject> gameObjects, string ip)
        //{
        //    this.Kill(gameObjects);
        //    multiplayerarena1 = new Gamescreen(game, null, gameObjects, ip);
        //    gameObjects.Add(multiplayerarena1);

        //    if (multiplayerarena1.Stop)
        //    {
        //        gameObjects.Remove(multiplayerarena1);
        //        Createmainmenu(gameObjects);
        //    }
        //    else gameObjects.Remove(this);
        //}

        /// <summary>
        /// Should create all the classes needed for a joinscreen and add them to the proper lists
        /// </summary>
        /// <param name="gameObjects"></param>
        public void CreateJoinScreen(List <GameObject> gameObjects) //FIX
        {
            //JoinGameScreen joinScreen = new JoinGameScreen(game, null, gameObjects, this);
            //gameObjects.Add(joinScreen);
            this.Kill(gameObjects);
            ipbox                = new TextBox(0, 0, 20);
            ipbox.Selected       = true;
            prompter             = FlatRedBall.Graphics.TextManager.AddText("Enter the IP of the server you wish to join");
            prompter.Position.Y += 140;
            prompter.Position.X -= 100;
            GlobalData.GlobalData.keyboardDispatcher.Subscriber = ipbox;
            screentype = Screentype.Join;
        }
Esempio n. 10
0
		public void SetValuesFrom(SpriteFrame baseFrame, Text text)
		{
			base.SetValuesFrom(baseFrame);
			TextSpacing = text.Spacing;
			TextScale = text.Scale;

			TextRed = text.Red;
			TextGreen = text.Green;
			TextBlue = text.Blue;

			Font = text.Font;

		}
Esempio n. 11
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            ScorePoints      = new FlatRedBall.Graphics.Text();
            ScorePoints.Name = "ScorePoints";
            ScoreLabel       = new FlatRedBall.Graphics.Text();
            ScoreLabel.Name  = "ScoreLabel";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
        public override void Initialize(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            TextInstance      = new FlatRedBall.Graphics.Text();
            TextInstance.Name = "TextInstance";


            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }
Esempio n. 13
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            LabelText      = new FlatRedBall.Graphics.Text();
            LabelText.Name = "LabelText";
            this.Click    += CallLosePush;
            this.RollOff  += CallLosePush;

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 14
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            SpriteInstance      = new FlatRedBall.Sprite();
            SpriteInstance.Name = "SpriteInstance";
            TextInstance        = new FlatRedBall.Graphics.Text();
            TextInstance.Name   = "TextInstance";
            this.Click         += CallLosePush;
            this.RollOff       += CallLosePush;

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 15
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            TextInstance        = new FlatRedBall.Graphics.Text();
            TextInstance.Name   = "TextInstance";
            SpriteInstance      = new FlatRedBall.Sprite();
            SpriteInstance.Name = "SpriteInstance";
            mCollision          = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mCollision.Name     = "mCollision";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 16
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            SpriteInstance      = new FlatRedBall.Sprite();
            SpriteInstance.Name = "SpriteInstance";
            TextInstance        = new FlatRedBall.Graphics.Text();
            TextInstance.Name   = "TextInstance";
            mHitbox             = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mHitbox.Name        = "mHitbox";
            WeaponInstance      = new Pirates.Entities.WeaponEntity(ContentManagerName, false);
            WeaponInstance.Name = "WeaponInstance";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 17
0
        public override void Initialize(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            TiledMap                   = new FlatRedBall.TileGraphics.LayeredTileMap();
            TiledMap.Name              = "TiledMap";
            TileCollisionShapes        = new FlatRedBall.Math.Geometry.ShapeCollection();
            TileCollisionShapes.Name   = "TileCollisionShapes";
            BulletList                 = new PositionedObjectList <LudumDare29.Entities.Bullet>();
            BulletList.Name            = "BulletList";
            NextLevelEntityList        = new PositionedObjectList <LudumDare29.Entities.NextLevelEntity>();
            NextLevelEntityList.Name   = "NextLevelEntityList";
            PlayerInstance             = new LudumDare29.Entities.Player(ContentManagerName, false);
            PlayerInstance.Name        = "PlayerInstance";
            SignEntityList             = new PositionedObjectList <LudumDare29.Entities.SignEntity>();
            SignEntityList.Name        = "SignEntityList";
            ActionEntityList           = new PositionedObjectList <LudumDare29.Entities.ActionEntity>();
            ActionEntityList.Name      = "ActionEntityList";
            EnemyBulletList            = new PositionedObjectList <LudumDare29.Entities.EnemyBullet>();
            EnemyBulletList.Name       = "EnemyBulletList";
            EnemyCornerList            = new PositionedObjectList <LudumDare29.Entities.EnemyCorner>();
            EnemyCornerList.Name       = "EnemyCornerList";
            GroundEnemyList            = new PositionedObjectList <LudumDare29.Entities.GroundEnemy>();
            GroundEnemyList.Name       = "GroundEnemyList";
            EntityCollisionShapes      = new FlatRedBall.Math.Geometry.ShapeCollection();
            EntityCollisionShapes.Name = "EntityCollisionShapes";
            EnemyCollisionGround       = new FlatRedBall.Math.Geometry.ShapeCollection();
            EnemyCollisionGround.Name  = "EnemyCollisionGround";
            TheEndText                 = new FlatRedBall.Graphics.Text();
            TheEndText.Name            = "TheEndText";


            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }
Esempio n. 18
0
        public override void Initialize(bool addToManagers)
        {
            base.Initialize(addToManagers);

            screenTitle = new Text();
            screenTitle.DisplayText = "Song Selection";
            Vector2 titlePosition = PositionHelper.percentToCoordSprite(0.0f, 80.0f);
            screenTitle.Y = titlePosition.Y;
            screenTitle.HorizontalAlignment = HorizontalAlignment.Center;
            TextManager.AddText(screenTitle);

            GuiManager.IsUIEnabled = true;
            listBox = GuiManager.AddListBox();
            listBox.ScaleX = 10;
            listBox.ScaleY = 20;

            for (int i = 0; i < 200; i++)
                listBox.AddItem("Song " + i);

            if(addToManagers)
                AddToManagers();
        }
Esempio n. 19
0
        public void InitializeToScreen(TowerScreen screen)
        {
            _atomNameText = screen.AddText(string.Empty);
            _atomValenceText = screen.AddText(string.Empty);
            _atomElectronegativityText = screen.AddText(string.Empty);
            _atomDescription = screen.AddText(string.Empty);
            _background = screen.AddSprite("Content/message-panel.png");

            _atomNameText.Y = 70;
            _atomValenceText.Y = _atomNameText.Y;
            _atomElectronegativityText.Y = _atomNameText.Y;
            _atomDescription.Y = _atomNameText.Y - 20;

            _atomNameText.Scale = 18;
            _atomValenceText.Scale = 18;
            _atomElectronegativityText.Scale = 18;
            _atomDescription.Scale = 18;

            _atomNameText.HorizontalAlignment = FlatRedBall.Graphics.HorizontalAlignment.Left;
            _atomNameText.X = -175;

            _atomDescription.HorizontalAlignment = FlatRedBall.Graphics.HorizontalAlignment.Left;
            _atomDescription.X = _atomNameText.X;
            _atomDescription.VerticalAlignment = FlatRedBall.Graphics.VerticalAlignment.Top;

            _atomElectronegativityText.HorizontalAlignment = FlatRedBall.Graphics.HorizontalAlignment.Right;
            _atomElectronegativityText.X = (this._background.Texture.Width / 2) - 25;

            // Climb on top of everything
            this._background.Z = 1;
            this._atomDescription.Z = 2;
            this._atomElectronegativityText.Z = 2;
            this._atomNameText.Z = 2;
            this._atomValenceText.Z = 2;

            this.Hide();
        }
Esempio n. 20
0
        protected bool Collect; //used to signal running events that this window has been destroyed

        public Window(Window owner = null, bool modal = false, string sprite = "")
        {            
            if (owner != null && modal)
                throw new ArgumentException("Child cannot be modal");
            Collect = false;
            Immovable = false;
            zEventEscape = null;
            zModal = modal;
            Name = string.Empty;
            zOrigin = new Vector2(0, 0);
            if (sprite == "")
                zSprite = SpriteManager.AddSprite(Path.Make(Path.Misc, "pixel.bmp"));
            else
                zSprite = SpriteManager.AddSprite(sprite);
            zSprite.ColorOperation = ColorOperation.ColorTextureAlpha;
            Color = Color.White;
            zVisible = true;
            OnClick = delegate () { };
            Hover = delegate () { };
            HoverMousedown = delegate () { };
            MouseLeave = delegate () { };
            MouseEnter = delegate () { };
            zParent = owner;
            zChildren = new List<Window>();
            zText = TextManager.AddText(string.Empty, Globals.Font);
            zText.ColorOperation = ColorOperation.ColorTextureAlpha;
            zText.AttachTo(zSprite, false);
            Size = new Vector2(1, 1);
            if (owner == null)
                InitializeAsTopLevel();
            else
                InitializeAsChild();
            SpriteManager.AddToLayer(zSprite, zLayer);
            TextManager.AddToLayer(zText, zLayer);
            zSprite.AttachTo(Camera.Main, true);
        }
Esempio n. 21
0
        public TowerMessagePanel(Screen screen, string backgroundSprite, string text)
        {
            if (screen is TowerScreen) {
                // Automatically managed and removed
                TowerScreen t = screen as TowerScreen;
                this._background = t.AddSprite(backgroundSprite);
                this._text = t.AddText(string.Empty);
            } else {
                // User must manage them since we can't touch mTexts and mSprites.
                throw new ArgumentException(TowerUtils.USE_TOWER_FRAMEWORK_MESSAGE);
            }

            this._background.PixelSize = 0.5f;
            // +4 to offset so we don't TOUCH the border

            this._text.Scale = 18;
            this.DisplayText = text;

            this._background.CustomBehavior += new SpriteCustomBehavior(_background_CustomBehavior);

            // We need to be really high up.
            this._background.Z = 1;
            this._text.Z = this._background.Z + 1;
        }
Esempio n. 22
0
        public EditingLogic()
        {
            mNewConnectionLine = new Line();

            mCurrentNodesReadOnly = new ReadOnlyCollection<PositionedNode>(mCurrentNodes);

            mDebugText = TextManager.AddText("");

            mReactiveHud = new ReactiveHud();
        }
Esempio n. 23
0
        public Button(GuiSkin guiSkin, Cursor cursor)
            : base(guiSkin, cursor)
        {
            mUpSkin = guiSkin.ButtonSkin;
            mDownSkin = guiSkin.ButtonDownSkin;

            mTextObject = TextManager.AddText(this.Text, guiSkin.ButtonSkin.Font);
            mTextObject.HorizontalAlignment = HorizontalAlignment.Center;
            mTextObject.VerticalAlignment = VerticalAlignment.Center;
            mTextObject.AttachTo(SpriteFrame, false);
            mTextObject.RelativeZ = -.001f * FlatRedBall.Math.MathFunctions.ForwardVector3.Z;

            SetTexturePropertiesFromSkin(mUpSkin);

            ScaleX = 1;
            ScaleY = 1;
        }
Esempio n. 24
0
        public static TextSave FromText(Text text)
        {
            TextSave textSave = new TextSave();
            textSave.X = text.Position.X;
            textSave.Y = text.Position.Y;
            textSave.Z = text.Position.Z;

            textSave.RotationX = text.RotationX;
            textSave.RotationY = text.RotationY;
            textSave.RotationZ = text.RotationZ;

            textSave.RelativeX = text.RelativePosition.X;
            textSave.RelativeY = text.RelativePosition.Y;
            textSave.RelativeZ = text.RelativePosition.Z;

            textSave.RelativeRotationX = text.RelativeRotationX;
            textSave.RelativeRotationY = text.RelativeRotationY;
            textSave.RelativeRotationZ = text.RelativeRotationZ;

            textSave.DisplayText = text.DisplayText;
            textSave.Name = text.Name;

            textSave.MaxWidth = text.MaxWidth;
            textSave.MaxWidthBehavior = text.MaxWidthBehavior;

            textSave.Scale = text.Scale;
            textSave.Spacing = text.Spacing;
            textSave.NewLineDistance = text.NewLineDistance;

            textSave.VerticalAlignment = text.VerticalAlignment;
            textSave.HorizontalAlignment = text.HorizontalAlignment;

            textSave.Visible = text.Visible;

            textSave.CursorSelectable = text.CursorSelectable;

            if (text.Parent != null)
            {
                textSave.Parent = text.Parent.Name;
            }

            if (text.Font != null && text.Font != TextManager.DefaultFont)
            {
                textSave.FontFile = text.Font.mFontFile;

                if (text.Font.mTextures.Length == 1)
                {

                    textSave.FontTexture = text.Font.Texture.Name;
                }
                else
                {
                    textSave.FontTexture = "";
                }
            }

#if FRB_MDX
            //spriteSave.Fade = 255 - spriteToCreateSaveFrom.Alpha;
            //spriteSave.FadeRate = -spriteToCreateSaveFrom.AlphaRate;

            textSave.Red = text.Red;
            textSave.Green = text.Green;
            textSave.Blue = text.Blue;



            //spriteSave.TintRedRate = spriteToCreateSaveFrom.RedRate;
            //spriteSave.TintGreenRate = spriteToCreateSaveFrom.GreenRate;
            //spriteSave.TintBlueRate = spriteToCreateSaveFrom.BlueRate;

            textSave.ColorOperation =
                GraphicalEnumerations.TranslateColorOperation(text.ColorOperation);
#elif FRB_XNA
            //spriteSave.Fade = (1 - spriteToCreateSaveFrom.Alpha) * 255.0f;
            //spriteSave.FadeRate = -spriteToCreateSaveFrom.AlphaRate * 255.0f;

            textSave.Red = text.Red * 255.0f;
            textSave.Green = text.Green * 255.0f;
            textSave.Blue = text.Blue * 255.0f;

            //spriteSave.TintRedRate = spriteToCreateSaveFrom.RedRate * 255.0f;
            //spriteSave.TintGreenRate = spriteToCreateSaveFrom.GreenRate * 255.0f;
            //spriteSave.TintBlueRate = spriteToCreateSaveFrom.BlueRate * 255.0f;

            textSave.ColorOperation =
                GraphicalEnumerations.ColorOperationToFlatRedBallMdxString(text.ColorOperation);
            
#endif



            return textSave;
        }
Esempio n. 25
0
        public bool IsTextInView(Text text)
        {
            if(this.CameraCullMode == Graphics.CameraCullMode.UnrotatedDownZ)
            {
                float cameraLeft = this.AbsoluteLeftXEdgeAt(text.Z);
                float cameraRight = this.AbsoluteRightXEdgeAt(text.Z);
                float cameraTop = this.AbsoluteTopYEdgeAt(text.Z);
                float cameraBottom = this.AbsoluteBottomYEdgeAt(text.Z);

                float textVerticalCenter = text.VerticalCenter;
                float textHorizontalCenter = text.HorizontalCenter;

                float longestCenterToEdge
                    = (float)(System.Math.Max(text.Width, text.Height) * 1.42f/2.0f);


                float textLeft = textHorizontalCenter - longestCenterToEdge;
                float textRight = textHorizontalCenter + longestCenterToEdge;
                float textTop = textVerticalCenter + longestCenterToEdge;
                float textBottom = textVerticalCenter - longestCenterToEdge;

                return textRight > cameraLeft &&
                    textLeft < cameraRight &&
                    textBottom < cameraTop &&
                    textTop > cameraBottom;                
            }


            return true;
        }
Esempio n. 26
0
 public void AddText(Text text)
 {
     TextManager.AddText(text);
     text.HorizontalAlignment = FlatRedBall.Graphics.HorizontalAlignment.Center;
     this.ManageForGarbageCollection(text);
 }
Esempio n. 27
0
		protected virtual void CreatePolygonForText(Text t)
		{

			//PropertyInfo scaleXProperty = t.GetType().GetProperty("ScaleX");
			//PropertyInfo scaleYProperty = t.GetType().GetProperty("ScaleY");

            // Why aren't we multiplying this by 2?
            float width = t.ScaleX;// (float)scaleYProperty.GetValue(t, null);
            float height = t.ScaleY;// (float)scaleXProperty.GetValue(t, null);


			Polygon newPoly = Polygon.CreateRectangle(width, height);
			InitializeNewPoly(newPoly);
			mHighlightShapes.Add(newPoly);

			Vector3 pos = new Vector3(t.HorizontalCenter, t.VerticalCenter, t.Z);
			newPoly.Position = pos;

			newPoly.RotationMatrix = t.RotationMatrix;

            newPoly.Color = new Color(1, 1, 1,  .5f);
            newPoly.AttachTo((PositionedObject)t, true);

            if (!float.IsInfinity(t.MaxWidth))
            {
			    newPoly = Polygon.CreateRectangle(t.MaxWidth/2.0f, height);
			    InitializeNewPoly(newPoly);
			    mHighlightShapes.Add(newPoly);


                float x;
                if (t.HorizontalAlignment == HorizontalAlignment.Left)
                {
                    x = t.X + t.MaxWidth / 2.0f;
                }
                else if (t.HorizontalAlignment == HorizontalAlignment.Center)
                {
                    x = t.X;
                }
                else
                {
                    x = t.X - t.MaxWidth / 2.0f;
                }

			    pos = new Vector3(x, t.VerticalCenter, t.Z);
			    newPoly.Position = pos;

			    newPoly.RotationMatrix = t.RotationMatrix;

                newPoly.AttachTo((PositionedObject)t, true);

                newPoly.Color = new Color(1, .25f, 0, .5f);
            }

		}
Esempio n. 28
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            HealthBarList = new PositionedObjectList<HealthBar>();
            TextObject = new FlatRedBall.Graphics.Text();

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 29
0
        private void GameOver()
        {
            if (_winning)
            {
                BirdInstance.Alive = false;
                BirdInstance.Velocity = Vector3.Zero;
                BirdInstance.Acceleration = Vector3.Zero;
                _winning = false;
                foreach (var obstacle1 in ObstacleList)
                {
                    obstacle1.Velocity = Vector3.Zero;
                }
                GroundInstance.Velocity = Vector3.Zero;
            }
            else
            {
                if (_retryText == null)
                {
                    _retryText = new Text
                    {
                        DisplayText = "Hit Enter to try again",
                        Scale = 16,
                        Spacing = 16,
                        X = -100
                    };
                    TextManager.AddText(_retryText);
                }

                if (InputManager.Keyboard.KeyPushed(Keys.Enter))
                {
                    TextManager.RemoveText(_retryText);
                    _retryText = null;
                    _winning = true;
                    _score = 0;
                    foreach (var obstacle in ObstacleList)
                    {
                        obstacle.X = -1000f;
                    }
                    _lastSpawn = Double.MinValue;
                    BirdInstance.Reset();
                    GroundInstance.Reset();
                }
            }
        }
Esempio n. 30
0
        public static void RecordInstructions(InstructionList listToRecordTo, double timeToExecute,
            List<string> membersToIgnore, Text textToRecord)
        {
            foreach (string member in EditorData.CurrentTextMembersWatching)
            {
                if (membersToIgnore.Contains(member) == false)
                {
                    Type memberType = InstructionManager.GetTypeForMember(mTextType, member);

                    Type genericType = typeof(Instruction<,>).MakeGenericType(
                        mTextType, memberType);
                    object value = FlatRedBall.Instructions.Reflection.LateBinder<Text>.Instance[textToRecord, member];

                    Instruction instruction = Activator.CreateInstance(genericType,
                        textToRecord, member, value, timeToExecute) as Instruction;

                    listToRecordTo.Add(instruction);
                }
            }
        }
Esempio n. 31
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            MessageObject = new FlatRedBall.Graphics.Text();

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Esempio n. 32
0
 public TowerText(Text baseText)
 {
     this._baseText = baseText;
 }
Esempio n. 33
0
        public void AddShadow(int xOffset, int yOffset)
        {
            Screen screen = ScreenManager.CurrentScreen;
            this._effectText = this._baseText.Clone();

            if (screen is TowerScreen)
            {
                TowerScreen ts = screen as TowerScreen;
                ts.AddText(this._effectText);
            }
            else
            {
                // User must self-manage since we can't touch mTexts
                throw new ArgumentException(TowerUtils.USE_TOWER_FRAMEWORK_MESSAGE);
            }

            // Requirement: baseText Z of 1, so that shadowText Z is >= 0
            if (this._baseText.Z == 0) { this._baseText.Z++; }

            this._effectText.AttachTo(this._baseText, true);
            // Make sure this is negative so that positive Y offsets are downward.
            yOffset = -Math.Abs(yOffset);
            this._effectText.RelativeX = xOffset;
            this._effectText.RelativeY = yOffset;
            this._effectText.RelativeZ = -1;

            this._effectText.Red = 0;
            this._effectText.Blue = 0;
            this._effectText.Green = 0;
        }
Esempio n. 34
0
 private void InitLabel()
 {
     Label = TextManager.AddText(Name, Globals.Font);
     Label.AttachTo(this, false);
     Label.HorizontalAlignment = HorizontalAlignment.Center;
     Label.RelativePosition = new Vector3(0, 4, ZLayer.NpcLabel - Position.Z);
 }
Esempio n. 35
0
        public static void Initialize(ShapeCollection shapeCollectionEditing)
        {
            //ColorDisplay colorDisplay = new ColorDisplay(GuiManager.Cursor);
            //GuiManager.AddWindow(colorDisplay);

            ShapeManager.ShapeDrawingOrder = ShapeDrawingOrder.OverEverything;
            ShapeManager.UseZTestingWhenDrawing = false;

            //Increase the number of particles available
            SpriteManager.AutoIncrementParticleCountValue = 500;
            SpriteManager.MaxParticleCount = 5000;

            if (shapeCollectionEditing == null)
            {
                mShapeCollection = new ShapeCollection();
            }

            mSceneCamera = new Camera(FlatRedBallServices.GlobalContentManager);

            mEditingLogic = new EditingLogic();

            mDebugText = TextManager.AddText("Hello");
            mDebugText.Visible = false;
        }
Esempio n. 36
0
 /// <summary>
 /// Remove the text from the screen. Note that if you
 /// have a reference to this text, that still needs to be set to null.
 /// </summary>
 /// <param name="text"></param>
 internal void RemoveText(Text text)
 {
     TextManager.RemoveText(text);
     this.mTexts.Remove(text);
 }
Esempio n. 37
0
        public Text ToText(string contentManagerName)
        {
            Text text = new Text();

            text.X = X;
            text.Y = Y;
            text.Z = Z;

            text.RotationX = RotationX;
            text.RotationY = RotationY;
            text.RotationZ = RotationZ;

            text.RelativePosition.X = RelativeX;
            text.RelativePosition.Y = RelativeY;
            text.RelativePosition.Z = RelativeZ;

            text.RelativeRotationX = RelativeRotationX;
            text.RelativeRotationY = RelativeRotationY;
            text.RelativeRotationZ = RelativeRotationZ;

            text.DisplayText = DisplayText;
            text.Name = Name;

            text.Scale = Scale;
            text.Spacing = Spacing;
            text.NewLineDistance = NewLineDistance;

            text.MaxWidth = MaxWidth;
            text.MaxWidthBehavior = MaxWidthBehavior;

            text.VerticalAlignment = VerticalAlignment;
            text.HorizontalAlignment = HorizontalAlignment;

            text.Visible = Visible;

            text.CursorSelectable = CursorSelectable;

#if !SILVERLIGHT

#if !MONODROID
            if (this.mFontTextureInstance != null)
            {
                BitmapFont bitmapFont = new BitmapFont(
                     mFontTextureInstance, FontPatternText);

                text.Font = bitmapFont;
            }
            else
#endif

            if (!string.IsNullOrEmpty(FontFile))
            {

                BitmapFont bitmapFont = null;

                if (!string.IsNullOrEmpty(FontTexture))
                {
                    bitmapFont = new BitmapFont(
                        FontTexture, FontFile, contentManagerName);
                }
                else
                {
                    bitmapFont = new BitmapFont(
                        FontFile, contentManagerName);
                }

                text.Font = bitmapFont;
            }
            else
            {
                text.Font = TextManager.DefaultFont;
            }
#endif

#if FRB_XNA
            //valueToDivideBy = 255;
#endif

            //sprite.Alpha = (255 - Fade) / valueToDivideBy;
            //sprite.AlphaRate = -FadeRate / valueToDivideBy;
            //sprite.BlendOperation = GraphicalEnumerations.TranslateBlendOperation(BlendOperation);

            //sprite.RedRate = TintRedRate / valueToDivideBy;
            //sprite.GreenRate = TintGreenRate / valueToDivideBy;
            //sprite.BlueRate = TintBlueRate / valueToDivideBy;


            var colorOperation = ColorOperation;

#if MONODROID
            if (colorOperation == "SelectArg2")
            {
                colorOperation = "Modulate";
            }
#endif

            GraphicalEnumerations.SetColors(text, Red, Green, Blue, colorOperation);


            return text;
        }
Esempio n. 38
0
        private void CustomInitialize()
        {
            facing = Game1.RIGHT;
            CurrentState = VariableState.R_Idle;

            this.PlayerIndex = 0;
            Acceleration.Y = -400F;

            debugText = TextManager.AddText("");
            debugText.Position.Y += 40;
            debugText.AttachTo(this, true);
            UpdateDebugText();
        }
Esempio n. 39
0
        public ReactiveHud()
        {
            mCameraBounds = new CameraBounds(EditorData.BoundsCamera);

            mCurrentAxisAlignedRectangleHighlight = ShapeManager.AddAxisAlignedRectangle();
            mCurrentAxisAlignedRectangleHighlight.Visible = false;

            mCurrentAxisAlignedCubeHighlight = ShapeManager.AddAxisAlignedRectangle();
            mCurrentAxisAlignedCubeHighlight.Visible = false;

            mCurrentCircleHighlight = ShapeManager.AddAxisAlignedRectangle();
            mCurrentCircleHighlight.Visible = false;

            mCurrentSphereHighlight = ShapeManager.AddAxisAlignedRectangle();
            mCurrentSphereHighlight.Visible = false;

            mCrossHair = new Crosshair();
            mCrossHair.Visible = false;


            float screensize = 5f;
            Vector3 forwardVector = MathFunctions.ForwardVector3;
            Matrix rotationMatrix = SpriteManager.Camera.RotationMatrix;
            MathFunctions.TransformVector(ref forwardVector, ref rotationMatrix);


            float planeDistance = Vector3.Dot(forwardVector, -SpriteManager.Camera.Position);

            float planeScreenHeight = 2f * planeDistance * (float)Math.Tan((double)SpriteManager.Camera.FieldOfView);
            float planeScreenWidth = planeScreenHeight / SpriteManager.Camera.FieldOfView;


            float width = screensize * planeScreenWidth / (float)SpriteManager.Camera.DestinationRectangle.Width;
            float height = screensize * planeScreenHeight / (float)SpriteManager.Camera.DestinationRectangle.Height;


            mNewPointPolygon = Polygon.CreateEquilateral(3, Math.Min(width, height), 0); //.3f, 0);
            mNewPointPolygon.Color = EditorProperties.NewPointPolygonColor;

            mPointText = TextManager.AddText("");

            NewPointPolygonScale = 10 / SpriteManager.Camera.PixelsPerUnitAt(mNewPointPolygon.Z);

        }
Esempio n. 40
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            TextInstance = SceneFile.Texts.FindByName("Text").Clone();
            TextInstance.AdjustPositionForPixelPerfectDrawing = true;

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
 protected override void CreatePolygonForText(Text t)
 {
     base.CreatePolygonForText(t);
     //To do??
 }
Esempio n. 42
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            EntireScene = SceneFile.Clone();
            for (int i = 0; i < EntireScene.Texts.Count; i++)
            {
                EntireScene.Texts[i].AdjustPositionForPixelPerfectDrawing = true;
            }
            mBody = new FlatRedBall.Math.Geometry.Circle();
            InstructionText = new FlatRedBall.Graphics.Text();

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }