public DebugPixel(int xOffset, int yOffset, CowMouseGame game, Color c, InWorldObject parent) : base(game.WorldManager) { this.xOffset = xOffset; this.yOffset = yOffset; this.parent = parent; loadTexture(game, c); }
public SideMenu(CowMouseGame game) : base(game) { this.Game = game; this.Visible = false; batch = new SpriteBatch(game.GraphicsDevice); setupButtons(); }
public SideMenuButton(int width, int height, int leftX, int topY, CowMouseGame game, Action action, String text, SpriteFont font) { this.Width = width; this.Height = height; this.Left = leftX; this.Top = topY; this.Action = action; this.Text = text; this.Font = font; LoadImage(game); }
/// <summary> /// These pixels are for debugging purposes; they allow one to see the /// bounding box of an object. /// </summary> /// <param name="game"></param> /// <returns></returns> public IEnumerable<DebugPixel> BoundingPixels(CowMouseGame game) { Rectangle box = this.InWorldPixelBoundingBox; //top side is BLUE //bottom side is YELLOW for (int x = box.Left + 1; x < box.Right - 1; x++) { yield return new DebugPixel( x - xPositionWorld, box.Top - yPositionWorld, game, Color.Blue, this ); yield return new DebugPixel( x - xPositionWorld, box.Bottom - 1 - yPositionWorld, game, Color.Yellow, this ); } //left side is WHITE //right side is BLACK for (int y = box.Top + 1; y < box.Bottom - 1; y++) { yield return new DebugPixel( box.Left - xPositionWorld, y - yPositionWorld, game, Color.White, this ); yield return new DebugPixel( box.Right - 1 - xPositionWorld, y - yPositionWorld, game, Color.Black, this ); } }
private void loadTexture(CowMouseGame game, Color c) { texture = new Texture2D(game.GraphicsDevice, 1, 1); texture.SetData<Color>(new Color[] { c }); }
private void LoadImage(CowMouseGame game) { int length = Width * Height; Blank = new Texture2D(game.GraphicsDevice, Width, Height); Color[] colors = new Color[length]; for (int i = 0; i < length; i++) colors[i] = Color.White; Blank.SetData<Color>(colors); }