/// <summary> /// Initializes a new instance of the <see cref="HUD"/> class. /// </summary> /// <param name="game">The game.</param> public HUD( CircularGame 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( CircularGame game, Color color, int width, int height ) { var texture = new Texture2D ( game.GraphicsDevice, width, height, true, SurfaceFormat.Color ); var colors = new Color[( width * height )]; for ( int i = 0; i < colors.Length; i++ ) { colors [i] = color; } texture.SetData ( colors ); return texture; }
public static Texture2D CreateFromGradient( CircularGame game, Color top, Color bottom, int width, int height ) { var texture = new Texture2D ( game.GraphicsDevice, width, height, true, SurfaceFormat.Color ); var colors = new 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 ); var r = (int) ( top.R * ( y / (float) height ) + bottom.R * ( ( y / (float) height ) - 1 ) ); var g = (int) ( top.G * ( y / (float) height ) + bottom.G * ( ( y / (float) height ) - 1 ) ); var b = (int) ( top.B * ( y / (float) height ) + bottom.B * ( ( y / (float) height ) - 1 ) ); colors [x] = new Color ( Math.Abs ( r ), Math.Abs ( g ), Math.Abs ( b ), Math.Abs ( a ) ); } } texture.SetData ( colors ); return texture; }
public CircularGameType() { InitializeComponent(); main = this; CenterWindowOnScreen(); _col = 10; _row = 10; //Create the players based on the user choise InitializeThePlayers(); Game = new CircularGame(new TurnMaker(3), new CircularBoard(36), new Random(), 9, _players, new DiceManager(2)); turnsLeft.Content = "Turns Left: 3"; MakeTheGrid(_col, _row); gs = new Thread(() => { Game.Start(); }); gs.Start(); }
/// <summary> /// The main entry point for the application. /// </summary> private static void Main( string[] args ) { using ( var game = new CircularGame () ) { game.Run (); } }