public override void LoadContent() { base.LoadContent(); background = Color.Black; borderColor = Color.White; borderTop = new Block(); borderLeft = new Block(); borderRight = new Block(); borderBottom = new Block(); }
private void setFrame(int width, int height, Color c) { frame = new Frame(); frame.texture = SpriteObject.CreateTexture(width, height, c); frame.LoadContent(); frame.origin = Vector2.Zero; frame.layer = 0; frame.parent = this; frame.hlColor = frame.hlOverColor; frame.state = Frame.STATE_ACTIVE; }
public void setBorders(int width, int inset, Texture2D texture, Color c) { //good inset values are between 0 and -width borderTop = new Block(); borderTop.texture = SpriteObject.CreateTexture( (int)(this.texture.Width - inset * 2), (int)width, texture, TextureStyle.Tile); borderTop.LoadContent(); borderTop.origin = Vector2.Zero; borderTop.parent = this; borderTop.position.X = 0 + inset; borderTop.position.Y = 0 + inset; borderTop.state = Block.STATE_ACTIVE; borderTop.layer = .1f; borderTop.color = c; borderBottom = new Block(); borderBottom.texture = SpriteObject.CreateTexture( (int)(this.texture.Width - inset * 2), (int)width, texture, TextureStyle.Tile); borderBottom.LoadContent(); borderBottom.origin = Vector2.Zero; borderBottom.parent = this; borderBottom.position.X = 0 + inset; borderBottom.position.Y = this.texture.Height - width - inset; borderBottom.state = Block.STATE_ACTIVE; borderBottom.layer = .1f; borderBottom.color = c; borderLeft = new Block(); borderLeft.texture = SpriteObject.CreateTexture( (int)width, (int)(this.texture.Height - inset * 2), texture, TextureStyle.Tile); borderLeft.LoadContent(); borderLeft.origin = Vector2.Zero; borderLeft.parent = this; borderLeft.position.X = 0 + inset; borderLeft.position.Y = 0 + inset; borderLeft.state = Block.STATE_ACTIVE; borderLeft.layer = .1f; borderLeft.color = c; borderRight = new Block(); borderRight.texture = SpriteObject.CreateTexture( (int)width, (int)(this.texture.Height - inset * 2), texture, TextureStyle.Tile); borderRight.LoadContent(); borderRight.origin = Vector2.Zero; borderRight.parent = this; borderRight.position.X = this.texture.Width - width - inset; borderRight.position.Y = 0 + inset; borderRight.state = Block.STATE_ACTIVE; borderRight.layer = .1f; borderRight.color = c; }
static public void ObjectsCollide(SpriteObject ob1, SpriteObject ob2) { //use bool collision to determine if there was a collision //use collisionPoint to find the point of collision ObjectsCollideByRectangle(ob1, ob2); if (collision) { collisionPoint = TexturesCollide(ob1.textureData, ob1.matrix, ob2.textureData, ob2.matrix); } if (collisionPoint.X == -1) { collision = false; } }
public override void LoadCopy(ScreenObject so) { base.LoadCopy(so); SpriteObject spo = (SpriteObject)so; texture = spo.texture; textureData = spo.textureData; matrix = spo.matrix; origin = spo.origin; _TR = spo._TR; _BL = spo._BL; _BR = spo._BR; hlColor = spo.hlColor; hlOverColor = spo.hlOverColor; hlTexture = spo.hlTexture; hlClickColor = spo.hlClickColor; hlSetColor = spo.hlSetColor; radius = spo.radius; }