Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Sprite"/> class.
 /// </summary>
 /// <param name="fluxGame">The flux game.</param>
 /// <param name="size">The size.</param>
 /// <param name="position">The position.</param>
 protected Sprite( BaseFluxGame fluxGame, Vector2 size, Vector2 position )
 {
     this.Game = fluxGame;
     this.Size = size;
     this.Position = position;
     this.Visible = true;
 }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Sprite"/> class.
 /// </summary>
 /// <param name="fluxGame">The flux game.</param>
 /// <param name="size">The size.</param>
 /// <param name="position">The position.</param>
 protected Sprite(BaseFluxGame fluxGame, Vector2 size, Vector2 position)
 {
     this.Game     = fluxGame;
     this.Size     = size;
     this.Position = position;
     this.Visible  = true;
 }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HUD"/> class.
        /// </summary>
        /// <param name="game">The game.</param>
        public HUD( BaseFluxGame game )
            : base(game)
        {
            fluxGame = game;

            HUDObjects = new List<IHUDComponent> ();

            Height = game.GraphicsDevice.Viewport.Height;
            Width = game.GraphicsDevice.Viewport.Width;
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HUD"/> class.
        /// </summary>
        /// <param name="game">The game.</param>
        public HUD(BaseFluxGame game)
            : base(game)
        {
            fluxGame = game;

            HUDObjects = new List <IHUDComponent> ();

            Height = game.GraphicsDevice.Viewport.Height;
            Width  = game.GraphicsDevice.Viewport.Width;
        }
Example #5
0
        /// <summary>
        /// Creates a rectangle texture from a specified color.
        /// </summary>
        /// <param name="color">The color.</param>
        /// <returns></returns>
        public static Texture2D CreateFromColor( BaseFluxGame game, Microsoft.Xna.Framework.Color color, int width, int height )
        {
            var texture = new Texture2D ( game.GraphicsDevice, width, height, true, SurfaceFormat.Color );

            Microsoft.Xna.Framework.Color[] colors = new Microsoft.Xna.Framework.Color[ (int) ( width * height ) ];
            for ( int i = 0; i < colors.Length; i++ ) {
                colors[ i ] = color;
            }

            texture.SetData ( colors );

            return texture;
        }
Example #6
0
        /// <summary>
        /// Creates a rectangle texture from a specified color.
        /// </summary>
        /// <param name="color">The color.</param>
        /// <returns></returns>
        public static Texture2D CreateFromColor(BaseFluxGame game, Microsoft.Xna.Framework.Color color, int width, int height)
        {
            var texture = new Texture2D(game.GraphicsDevice, width, height, true, SurfaceFormat.Color);

            Microsoft.Xna.Framework.Color[] colors = new Microsoft.Xna.Framework.Color[(int)(width * height)];
            for (int i = 0; i < colors.Length; i++)
            {
                colors[i] = color;
            }

            texture.SetData(colors);

            return(texture);
        }
Example #7
0
        /// <summary>
        /// The constructor for the Camera2D class.
        /// </summary>
        public Camera(BaseFluxGame game)
        {
            this.game  = game;
            projection = Matrix.CreateOrthographicOffCenter(0f, ConvertUnits.ToSimUnits(game.GraphicsDevice.Viewport.Width),
                                                            ConvertUnits.ToSimUnits(game.GraphicsDevice.Viewport.Height), 0f, 0f,
                                                            1f);
            screen    = Matrix.Identity;
            transform = Matrix.Identity;

            center = new Vector2(ConvertUnits.ToSimUnits(game.GraphicsDevice.Viewport.Width / 2f),
                                 ConvertUnits.ToSimUnits(game.GraphicsDevice.Viewport.Height / 2f));

            ResetCamera();
        }
Example #8
0
        public static Texture2D CreateFromGradient( BaseFluxGame game, Microsoft.Xna.Framework.Color top, Microsoft.Xna.Framework.Color bottom, int width, int height )
        {
            var texture = new Texture2D ( game.GraphicsDevice, width, height, true, SurfaceFormat.Color );

            Microsoft.Xna.Framework.Color[] colors = new Microsoft.Xna.Framework.Color[ width * height ];
            for ( int y = 0; y < height; y++ ) {
                for ( int x = 0; x < width; x++ ) {
                    int a = 0xFF; //top.A * ( index / height ) + bottom.A * ( ( index / height ) - 1 );
                    int r = (int) ( top.R * (float) ( (float) y / (float) height ) + bottom.R * ( (float) ( (float) y / (float) height ) - 1 ) );
                    int g = (int) ( top.G * (float) ( (float) y / (float) height ) + bottom.G * ( (float) ( (float) y / (float) height ) - 1 ) );
                    int b = (int) ( top.B * (float) ( (float) y / (float) height ) + bottom.B * ( (float) ( (float) y / (float) height ) - 1 ) );

                    colors[ x ] = new Microsoft.Xna.Framework.Color ( Math.Abs ( r ), Math.Abs ( g ), Math.Abs ( b ), Math.Abs ( a ) );
                }
            }

            texture.SetData ( colors );

            return texture;
        }
Example #9
0
        public static Texture2D CreateFromGradient(BaseFluxGame game, Microsoft.Xna.Framework.Color top, Microsoft.Xna.Framework.Color bottom, int width, int height)
        {
            var texture = new Texture2D(game.GraphicsDevice, width, height, true, SurfaceFormat.Color);

            Microsoft.Xna.Framework.Color[] colors = new Microsoft.Xna.Framework.Color[width * height];
            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    int a = 0xFF; //top.A * ( index / height ) + bottom.A * ( ( index / height ) - 1 );
                    int r = (int)(top.R * (float)((float)y / (float)height) + bottom.R * ((float)((float)y / (float)height) - 1));
                    int g = (int)(top.G * (float)((float)y / (float)height) + bottom.G * ((float)((float)y / (float)height) - 1));
                    int b = (int)(top.B * (float)((float)y / (float)height) + bottom.B * ((float)((float)y / (float)height) - 1));



                    colors[x] = new Microsoft.Xna.Framework.Color(Math.Abs(r), Math.Abs(g), Math.Abs(b), Math.Abs(a));
                }
            }

            texture.SetData(colors);

            return(texture);
        }
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Tool"/> class.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="size">The size.</param>
 protected Tool(BaseFluxGame game, Vector2 size) : base(game, size)
 {
 }
Example #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Tool"/> class.
 /// </summary>
 /// <param name="game">The game.</param>
 protected Tool(BaseFluxGame game) : base(game)
 {
 }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PhysicsSprite"/> class.
 /// </summary>
 /// <param name="game">The game.</param>
 protected PhysicsSprite(BaseFluxGame game) : this(game, Vector2.Zero, Vector2.Zero)
 {
 }
Example #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Tool"/> class.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="size">The size.</param>
 /// <param name="position">The position.</param>
 protected Tool(BaseFluxGame game, Vector2 size, Vector2 position) : base(game, size, position)
 {
 }
Example #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PhysicsSprite"/> class.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="size">The size.</param>
 /// <param name="position">The position.</param>
 protected PhysicsSprite(BaseFluxGame game, Vector2 size, Vector2 position) : base(game, size, position)
 {
 }
Example #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PhysicsSprite"/> class.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="position">The position.</param>
 protected PhysicsSprite(BaseFluxGame game, Vector2 position) : this(game, Vector2.Zero, position)
 {
 }
Example #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Sprite"/> class.
 /// </summary>
 /// <param name="fluxGame">The flux game.</param>
 /// <param name="size">The size.</param>
 protected Sprite( BaseFluxGame fluxGame, Vector2 size )
 {
     this.Game = fluxGame;
     this.Size = size;
     this.Visible = true;
 }
Example #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PhysicsSprite"/> class.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="position">The position.</param>
 protected PhysicsSprite( BaseFluxGame game, Vector2 position )
     : this(game, Vector2.Zero, position)
 {
 }
Example #18
0
 /// <summary>
 /// Initializes a new empty instance of the <see cref="Sprite"/> class.
 /// </summary>
 /// <param name="fluxGame">The flux game.</param>
 protected Sprite(BaseFluxGame fluxGame)
 {
     this.Game    = fluxGame;
     this.Visible = true;
 }
Example #19
0
        private float _zoomScale = 1f; //Default zoom scale

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes a new empty instance of the <see cref="Sprite"/> class.
        /// </summary>
        /// <param name="fluxGame">The flux game.</param>
        protected Sprite( BaseFluxGame fluxGame )
        {
            this.Game = fluxGame;
            this.Visible = true;
        }
Example #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Sprite"/> class.
 /// </summary>
 /// <param name="fluxGame">The flux game.</param>
 /// <param name="size">The size.</param>
 protected Sprite(BaseFluxGame fluxGame, Vector2 size)
 {
     this.Game    = fluxGame;
     this.Size    = size;
     this.Visible = true;
 }
Example #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Block"/> class.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="position">The position.</param>
 protected Block(BaseFluxGame game, Vector2 position)
     : base(game, position)
 {
 }
Example #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PhysicsSprite"/> class.
 /// </summary>
 /// <param name="game">The game.</param>
 protected PhysicsSprite( BaseFluxGame game )
     : this(game, Vector2.Zero, Vector2.Zero)
 {
 }
Example #23
0
 public Button( BaseFluxGame game )
     : base(game)
 {
     Visible = true;
 }
Example #24
0
 public View( BaseFluxGame game )
 {
     this.Game = game;
 }
Example #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Block"/> class.
 /// </summary>
 /// <param name="game">The game.</param>
 protected Block(BaseFluxGame game) : base(game)
 {
 }
Example #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PhysicsSprite"/> class.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="size">The size.</param>
 /// <param name="position">The position.</param>
 protected PhysicsSprite( BaseFluxGame game, Vector2 size, Vector2 position )
     : base(game, size, position)
 {
 }
Example #27
0
 public Button(BaseFluxGame game) : base(game)
 {
     Visible = true;
 }
Example #28
0
 public ViewManager(BaseFluxGame game)
 {
     Views     = new List <View> (255);
     this.game = game;
 }