/// <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; }
/// <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; }
/// <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; }
/// <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; }
/// <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; }
/// <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); }
/// <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(); }
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; }
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); }
/// <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) { }
/// <summary> /// Initializes a new instance of the <see cref="Tool"/> class. /// </summary> /// <param name="game">The game.</param> protected Tool(BaseFluxGame game) : base(game) { }
/// <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) { }
/// <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) { }
/// <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) { }
/// <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) { }
/// <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; }
/// <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) { }
/// <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; }
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; }
/// <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; }
/// <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) { }
/// <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) { }
public Button( BaseFluxGame game ) : base(game) { Visible = true; }
public View( BaseFluxGame game ) { this.Game = game; }
/// <summary> /// Initializes a new instance of the <see cref="Block"/> class. /// </summary> /// <param name="game">The game.</param> protected Block(BaseFluxGame game) : base(game) { }
/// <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) { }
public Button(BaseFluxGame game) : base(game) { Visible = true; }
public ViewManager(BaseFluxGame game) { Views = new List <View> (255); this.game = game; }