Example #1
0
        public BitmapFont(Texture2D fontTextureGraphic, string fontPattern)
        {
            // the font could be an extended character set - let's say for Chinese
            // default it to 256, but search for the largest number.
            mTextures    = new Texture2D[1];
            mTextures[0] = fontTextureGraphic;

            //mTextureName = mTexture.Name;

            SetFontPattern(fontPattern);
        }
Example #2
0
 public Sprite FindSpriteWithTexture(Texture2D texture)
 {
     for (int i = 0; i < Count; i++)
     {
         Sprite sprite = this[i];
         if (sprite.Texture == texture)
         {
             return(sprite);
         }
     }
     return(null);
 }
        /// <summary>
        /// Adds a custom-textured Marker which will be positioned at the time specified
        /// by the "value" argument referencing the referenceObject argument.
        /// </summary>
        /// <param name="value">The time at which to place the new Marker.</param>
        /// <param name="referenceObject">The object that the Marker will reference - can be null.</param>
        /// <param name="textureToUse">The new Marker's texture - will use the default texture if null.</param>
        /// <returns>The newly-created Marker.</returns>
        #endregion
        public Marker AddMarker(double value, object referenceObject, Texture2D textureToUse)
        {
            Marker marker = new Marker();

            marker.Value           = value;
            marker.ReferenceObject = referenceObject;
            marker.Texture         = textureToUse; // if the marker has a null texture then the default rendering is used.

            markerArray.Add(marker);

            return(marker);
        }
Example #4
0
        /// <summary>
        /// Returns a one-way SpriteList containing all Sprites in this SpriteList which reference the texture argument.
        /// </summary>
        /// <param name="texture">The texture to match against.</param>
        /// <returns>SpriteList containing Sprites with matching textures.</returns>
        #endregion
        public SpriteList FindSpritesWithTexture(Texture2D texture)
        {
            SpriteList spriteListToReturn = new SpriteList();

            for (int i = 0; i < Count; i++)
            {
                Sprite sprite = this[i];
                if (sprite.Texture == texture)
                {
                    spriteListToReturn.AddOneWay(sprite);
                }
            }
            return(spriteListToReturn);
        }
Example #5
0
        // made public for unit tests
		public static void Initialize(Texture2D guiTextureToUse, Cursor cursor)

#endif
		{
#if FRB_MDX || XNA3_1
            RemoveInvisibleDominantWindows = true;

#else
            RemoveInvisibleDominantWindows = false;
#endif
            mPerishableArrayReadOnly = new ReadOnlyCollection<IWindow>(mPerishableArray);
            // Currently make the FRB XNA default to not using the UI, but the FRB MDX to true
            TextHeight = 2;
            TextSpacing = 1;

            mUIEnabled = true;



            //		sr.WriteLine("Inside the GuiManager constructor");
            //		sr.Close();
            mCursors = new List<Cursor>();

            mCursors.Add(cursor);

            mWindowArray = new WindowArray();
            mReadOnlyWindowArray = new ReadOnlyCollection<IWindow>(mWindowArray);

            mDominantWindows = new List<IWindow>();

#if !MONOGAME && !SILVERLIGHT && !UNIT_TESTS && !XNA4
            RenderingBasedInitializize();
#endif

            BringsClickedWindowsToFront = true;


            try
            {
#if FRB_MDX
                if (System.IO.File.Exists(FlatRedBall.IO.FileManager.RelativeDirectory + "Assets/Textures/upDirectory.bmp"))
                {

                    mUpDirectory = FlatRedBallServices.Load<Texture2D>(
                        FlatRedBall.IO.FileManager.RelativeDirectory + "Assets/Textures/upDirectory.bmp", 
                        InternalGuiContentManagerName);
                }
                if (System.IO.File.Exists(FlatRedBall.IO.FileManager.RelativeDirectory + "Assets/Textures/cursorTextBox.bmp"))
                {
                    mCursorTextBox = FlatRedBallServices.Load<Texture2D>(
                        FlatRedBall.IO.FileManager.RelativeDirectory + "Assets/Textures/cursorTextBox.bmp",
                        InternalGuiContentManagerName);
                }




                if (guiTextureToUse != null && guiTextureToUse != "")
                {
                    guiTexture = FlatRedBallServices.Load<Texture2D>(
                        guiTextureToUse, InternalGuiContentManagerName);

                    RefreshTextSize();
                }

#elif SUPPORTS_FRB_DRAWN_GUI
                guiTexture = guiTextureToUse;

                RefreshTextSize();
#endif

            }
            catch(Exception e)
            {
#if XBOX360 || SILVERLIGHT || WINDOWS_PHONE || MONODROID || WINDOWS_8 || IOS
                throw e;
#else
                System.Windows.Forms.MessageBox.Show("Error setting GuiManager textures." +
                    "  If you are seeing this, one reason may be that you do not have the " +
                    " correct Managed DirectX files on your computer.  To download them, " +
                    " go to www.flatredball.com, click on Resources on the top bar " + 
                    " and click on the \"DirectX Web Installer\" link under FlatRedBall " +
                    " Prerequisites.  If you have already done this and your problem is not " +
                    " solved, please visit the forums on www.flatredball.com and post about your " +
                    " problem.\n\nAdditional Information:\n" + e.ToString());                
#endif
            }
            try
            {

                nfi = new System.Globalization.NumberFormatInfo();
                //replaced the above line with the one below to used streamed images.

#if FRB_MDX

                if ( FlatRedBallServices.IsWindowsCursorVisible == false &&
                    System.IO.File.Exists(FlatRedBall.IO.FileManager.RelativeDirectory + "Assets/Textures/cursor1.bmp"))
                {
                    mCursors[0].SetCursor(
                        FlatRedBallServices.Load<Texture2D>(
                            FlatRedBall.IO.FileManager.RelativeDirectory + "Assets/Textures/cursor1.bmp", 
                            InternalGuiContentManagerName),
                        .5f, -.5f, 1);
                }
#endif

                ShowingCursorTextBox = true;

                renderingNotes = new List<String>();
            }
            catch(Exception e)
            {
#if XBOX360 || SILVERLIGHT || WINDOWS_PHONE || MONODROID || MONOGAME
                throw e;
#else
                System.Windows.Forms.MessageBox.Show("Error wrapping up GuiManager creation\n\n" + e.ToString());
#endif
            }

#if SUPPORTS_FRB_DRAWN_GUI
            SetPropertyGridTypeAssociations();
#endif

            // Let's do some updates because we want to make sure our "last" values are set to the current value
            // so we don't have any movement on the cursor initially:
            cursor.Update(TimeManager.CurrentTime);
            cursor.Update(TimeManager.CurrentTime);

        }
Example #6
0
        public virtual void SetOverlayTextures(Texture2D upTexture, Texture2D downTexture)
		{
			mOverlayTexture = upTexture;

            SetAnimationChain(null);
		}
Example #7
0
        public virtual void SetOverlayTextures(Texture2D upTexture, Texture2D downTexture)
        {
            mOverlayTexture = upTexture;

            SetAnimationChain(null);
        }