public override void Initialize() { Context.RemoveAllComponents(); var center = Context.Bounds.GetCenter(); var scale = new Point(40, 20); var rightBottom = Context.Bounds.RightBottomPoint() - scale; var rightTop = Context.Bounds.RightTopPoint() + new Point(scale.X * -1, 0); var leftBottom = Context.Bounds.LeftBottomPoint() + new Point(0, scale.Y * -1); var square = new RectangleComponent(center, 1, Context); square.Filled = true; square.Transform .CentralizePivot() .ScaleTo(scale, 1, Easing.Linear) .MoveTo(new Point(1, 1), 1, Easing.Linear) .MoveTo(rightBottom, 1, Easing.Linear) .ScaleTo(Point.One, 1, Easing.Linear) .ScaleTo(scale, 1, Easing.Linear) .MoveTo(center, 1, Easing.Linear) .MoveTo(rightTop, 1, Easing.Linear) .MoveTo(leftBottom, 1, Easing.Linear) .PingPong(); lines = new Line[20]; for (int i = 0; i < lines.Length; i++) { lines[i] = new Line(new Point(i * 10, i % 2 == 0 ? 10 : 20), new Point((i + 1) * 10, i % 2 != 0 ? 10 : 20)); } }
public PingPongEffectComponent(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager) : base(device) { this.resourceManager = resourceManager; this.AddChild(leftRect = new RectangleComponent(device, resourceManager, PPDColors.White) { RectangleWidth = 50, RectangleHeight = 200, Position = new Vector2(50, 0) }); this.AddChild(rightRect = new RectangleComponent(device, resourceManager, PPDColors.White) { RectangleWidth = 50, RectangleHeight = 200, Position = new Vector2(700, 250) }); this.AddChild(ballRect = new RectangleComponent(device, resourceManager, PPDColors.White) { RectangleHeight = 50, RectangleWidth = 50, Position = new Vector2(375, 200) }); var random = new Random(); ballVector = new Vector2(random.Next(1, 5), random.Next(1, 5)); Alpha = 0; }
public ChangeVolumeSprite(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager, MyGame myGame, ISound sound) : base(device) { this.resourceManager = resourceManager; this.myGame = myGame; this.sound = sound; texts = new TextureString[3]; rects = new RectangleComponent[3]; spheres = new PictureObject[3]; var sprite = new SpriteObject(device, texts[0] = new TextureString(device, Utility.Language["Master"], 18, PPDColors.White), texts[1] = new TextureString(device, Utility.Language["Movie"], 18, PPDColors.White) { Position = new SharpDX.Vector2(0, 25) }, texts[2] = new TextureString(device, Utility.Language["SE"], 18, PPDColors.White) { Position = new SharpDX.Vector2(0, 50) }, rects[0] = new RectangleComponent(device, resourceManager, PPDColors.White) { Position = new SharpDX.Vector2(RectStartX, 10), RectangleHeight = 2, RectangleWidth = RectWidth }, rects[1] = new RectangleComponent(device, resourceManager, PPDColors.White) { Position = new SharpDX.Vector2(RectStartX, 35), RectangleHeight = 2, RectangleWidth = RectWidth }, rects[2] = new RectangleComponent(device, resourceManager, PPDColors.White) { Position = new SharpDX.Vector2(RectStartX, 60), RectangleHeight = 2, RectangleWidth = RectWidth }, spheres[0] = new PictureObject(device, resourceManager, Utility.Path.Combine("sphere.png"), true) { Position = new SharpDX.Vector2(RectStartX, 10) }, spheres[1] = new PictureObject(device, resourceManager, Utility.Path.Combine("sphere.png"), true) { Position = new SharpDX.Vector2(RectStartX, 35) }, spheres[2] = new PictureObject(device, resourceManager, Utility.Path.Combine("sphere.png"), true) { Position = new SharpDX.Vector2(RectStartX, 60) }, select = new PictureObject(device, resourceManager, Utility.Path.Combine("right.png"), true) { Position = new SharpDX.Vector2(30, 0), Scale = new SharpDX.Vector2(0.5f, 0.5f) } ) { Position = new SharpDX.Vector2(160, 225 - 75 / 2f) }; modified = true; this.AddChild(sprite); AdjustPosition(); Inputed += ChangeVolumeSprite_Inputed; LostFocused += ChangeVolumeSprite_LostFocused; }
public void Load(ContentManager content) { ComponentManager cm = ComponentManager.GetInstance(); foreach (var(id, rect) in cm.GetComponentsOfType <RectangleComponent>()) { if (rect.Parent != null) { RectangleComponent rectParent = cm.GetComponentForEntity <RectangleComponent>((int)rect.Parent); rectParent.Children.Add(id); } SetupVertices(rect); SetupIndices(rect); rect.vertexBuffer = new VertexBuffer(rect.graphicsDevice, typeof(VertexPositionNormalTexture), rect.vertices.Length, BufferUsage.WriteOnly); rect.vertexBuffer.SetData(rect.vertices); rect.indexBuffers = new IndexBuffer(rect.graphicsDevice, typeof(short), rect.indices.Length, BufferUsage.WriteOnly); rect.indexBuffers.SetData(rect.indices); foreach (string tp in rect.TexturePaths) { rect.Textures.Add(content.Load <Texture2D>(tp)); } } }
public GraphDrawer(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager) : base(device) { this.AddChild(name = new TextureString(device, "", 16, PPDColors.White)); this.AddChild(xname = new TextureString(device, Utility.Language["Latest"], 12, PPDColors.White)); ynames = new TextureString[5]; for (int i = 0; i < ynames.Length; i++) { this.AddChild(ynames[i] = new TextureString(device, "", 12, PPDColors.White)); } this.AddChild(yAxis = new RectangleComponent(device, resourceManager, PPDColors.White) { RectangleWidth = 2 }); this.AddChild(xAxis = new RectangleComponent(device, resourceManager, PPDColors.White) { RectangleHeight = 2 }); this.AddChild(line = new LineComponent(device, resourceManager, lineColor) { LineWidth = 2 }); poses = new List <Vector2>(); Formatter = FloatToIntFormatter.Formatter; }
public MenuBackground() : base(new Vector2f(0, 0), new Vector2f(1000, 1000)) { BackgroundRectangle = new RectangleComponent(Position, Size, new Color(128, 128, 128, 170)); RenderLayer = RenderLayer.MenuBack; RenderView = RenderView.Menu; }
public MultiSelectableText(PPDDevice device, IGameHost gameHost, PPDFramework.Resource.ResourceManager resourceManager, string startText, string[] menuTexts, int fontHeight) : base(device) { this.gameHost = gameHost; this.resourceManager = resourceManager; this.fontHeight = fontHeight; this.AddChild(startTextString = new TextureString(device, startText, fontHeight, PPDColors.White)); var menus = new List <TextureString>(); foreach (var menuText in menuTexts) { var obj = new TextureString(device, menuText, fontHeight, PPDColors.White) { Alpha = 0 }; this.AddChild(obj); menus.Add(obj); } menuTextStrings = menus.ToArray(); this.AddChild(rectangle = new RectangleComponent(device, resourceManager, PPDColors.Active) { Position = new Vector2(0, -fontHeight / 2), RectangleHeight = fontHeight + fontHeight, RectangleWidth = 0, Alpha = 0.75f }); GotFocused += MultiSelectableText_GotFocused; LostFocused += MultiSelectableText_LostFocused; Inputed += MultiSelectableText_Inputed; }
public DxTextBox(PPDDevice device, IGameHost host, PPDFramework.Resource.ResourceManager resourceManager) : base(device) { this.host = host; back = new RectangleComponent(device, resourceManager, PPDColors.White); selection = new RectangleComponent(device, resourceManager, PPDColors.Active); border = new LineRectangleComponent(device, resourceManager, PPDColors.Selection); caret = new RectangleComponent(device, resourceManager, PPDColors.Black); caret.CanDraw += (o, c, d, ci) => { return(count >= 30 && Focused); }; stringObj = new TextureString(device, "", 14, PPDColors.Black); TextBoxWidth = 150; MaxTextLength = int.MaxValue; MaxWidth = int.MaxValue; DrawMode = DrawingMode.DrawAll; DrawOnlyFocus = true; GotFocused += DxTextBox_GotFocused; LostFocused += DxTextBox_LostFocused; Inputed += DxTextBox_Inputed; host.IMEStarted += host_IMEStarted; host.TextBoxEnabledChanged += host_TextBoxEnabledChanged; this.AddChild(border); this.AddChild(caret); this.AddChild(stringObj); this.AddChild(selection); this.AddChild(back); }
public UserComponent(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager, User user) : base(device) { this.resourceManager = resourceManager; User = user; this.AddChild((userIcon = new PictureObject(device, resourceManager, PathObject.Absolute(currentUserIconPath), true) { Position = new Vector2(21, 21) })); this.AddChild((userNameString = new TextureString(device, "", 18, 160, PPDColors.White) { Position = new Vector2(42, 12) })); this.AddChild(rectangle = new RectangleComponent(device, resourceManager, PPDColors.White) { Hidden = true, Position = new Vector2(5, 5), RectangleHeight = 30 }); AddBinding(new Binding(user, "Name", this, "UserName")); AddBinding(new Binding(user, "ImagePath", this, "UserImagePath")); ChangeUserIconScale(); }
public void AddComponent(RectangleComponent component) { component.Parent = this; this.Childs.Add(component); ContentValue += component.Hieght; }
private Score(Point position, Snake snake, IWorldContext ctx) : base(position, ctx) { snake.FoodEaten += delegate { var effect = new RectangleComponent(snake.Head.Transform.Position, ctx) { Pixel = '+'.DarkRed() }; effect .Transform .MoveTo(Transform.Position, 1f, Easing.OutCubic) .Do(() => { ctx.RemoveComponent(effect); }) .Once(); this .To(points, points + 10, 1f, Easing.InOutQuint, v => points = (int)v) .Once(); }; Transform.CentralizePivot(); }
public MovieVolumeSprite(PPDDevice device, MyGame myGame) : base(device) { this.myGame = myGame; resourceManager = new PPDFramework.Resource.ResourceManager(); var color = PPDColors.Green; this.AddChild(new TextureString(device, Utility.Language["Video"], 30, color) { Position = new Vector2(800, 0), Alignment = Alignment.Right }); this.AddChild(volumeText = new TextureString(device, "100", 30, color) { Position = new Vector2(70, 400), Alignment = Alignment.Right }); rects = new RectangleComponent[50]; for (int i = 0; i < rects.Length; i++) { rects[i] = new RectangleComponent(device, resourceManager, color) { Position = new Vector2(80 + i * (RectWidth + RectMargin), 400), RectangleHeight = RectHeight, RectangleWidth = RectWidth }; this.AddChild(rects[i]); } Hidden = true; }
public UpdateScoreControl(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager, ISound sound) : base(device) { this.resourceManager = resourceManager; this.sound = sound; mainSprite = new SpriteObject(device) { Position = new Vector2(40, 80) }; this.AddChild(scrollBar = new RectangleComponent(device, resourceManager, PPDColors.White) { Position = new Vector2(755, 80), RectangleHeight = 330, RectangleWidth = 5 }); this.AddChild(mainSprite); this.AddChild(back = new PictureObject(device, resourceManager, Utility.Path.Combine("dialog_back.png"))); this.AddChild(new RectangleComponent(device, resourceManager, PPDColors.Black) { RectangleHeight = 450, RectangleWidth = 800, Alpha = 0.65f }); back.AddChild(new TextureString(device, Utility.Language["UpdateScore"], 30, PPDColors.White) { Position = new Vector2(35, 30) }); GotFocused += UpdateScoreControl_GotFocused; Inputed += UpdateScoreControl_Inputed; }
protected Button(Vector2f position, Vector2f size) : base(position, size) { BoundingBox = new RectangleComponent(Position, Size); RegisterClickable(); RenderLayer = RenderLayer.MenuFront; RenderView = RenderView.Menu; }
public OpenBrowserDialog(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager, ISound sound) : base(device) { this.sound = sound; confirm = new EffectObject(device, resourceManager, Utility.Path.Combine("tweetconfirm.etd")) { Position = new Vector2(400, 225) }; black = new RectangleComponent(device, resourceManager, PPDColors.Black) { RectangleHeight = 450, RectangleWidth = 800, Alpha = 0.5f }; sprite = new SpriteObject(device); text = new TextureString(device, Utility.Language["NotHaveScoreDownload"], 16, 300, 200, true, PPDColors.White) { Position = new Vector2(240, 120) }; buttons = new Button[2]; for (int i = 0; i < buttons.Length; i++) { string str = ""; switch (i) { case 0: str = Utility.Language["OK"]; break; case 1: str = Utility.Language["Cancel"]; break; } buttons[i] = new Button(device, resourceManager, Utility.Path, str) { Position = new Vector2(300 + i * 200, 315) }; buttons[i].Selected = false; this.AddChild(buttons[i]); } buttons[0].Selected = true; this.AddChild(sprite); sprite.AddChild(text); sprite.AddChild(buttons[0]); sprite.AddChild(buttons[1]); this.AddChild(confirm); this.AddChild(black); confirm.PlayType = Effect2D.EffectManager.PlayType.Once; confirm.Play(); confirm.Seek(EffectObject.SeekPosition.End); Inputed += OpenBrowserDialog_Inputed; }
public LifeGage(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager) : base(device) { this.AddChild(rectangle = new RectangleComponent(device, resourceManager, PPDColors.LifeGage) { RectangleHeight = 3, RectangleWidth = MaxWidth }); gageWidth = MaxWidth; }
// Fill rectangle vertex list private void SetupVertices(RectangleComponent r) { List <VertexPositionNormalTexture> vertexList = new List <VertexPositionNormalTexture>(36); // Front face vertexList.Add(new VertexPositionNormalTexture(r.FRONT_TOP_LEFT, r.FORWARD, new Vector2(0, 1))); vertexList.Add(new VertexPositionNormalTexture(r.FRONT_BOTTOM_RIGHT, r.FORWARD, new Vector2(1, 0))); vertexList.Add(new VertexPositionNormalTexture(r.FRONT_BOTTOM_LEFT, r.FORWARD, new Vector2(0, 0))); vertexList.Add(new VertexPositionNormalTexture(r.FRONT_TOP_LEFT, r.FORWARD, new Vector2(0, 1))); vertexList.Add(new VertexPositionNormalTexture(r.FRONT_TOP_RIGHT, r.FORWARD, new Vector2(1, 1))); vertexList.Add(new VertexPositionNormalTexture(r.FRONT_BOTTOM_RIGHT, r.FORWARD, new Vector2(1, 0))); // Top face vertexList.Add(new VertexPositionNormalTexture(r.BACK_TOP_LEFT, r.UP, new Vector2(0, 1))); vertexList.Add(new VertexPositionNormalTexture(r.FRONT_TOP_RIGHT, r.UP, new Vector2(1, 0))); vertexList.Add(new VertexPositionNormalTexture(r.FRONT_TOP_LEFT, r.UP, new Vector2(0, 0))); vertexList.Add(new VertexPositionNormalTexture(r.BACK_TOP_LEFT, r.UP, new Vector2(0, 1))); vertexList.Add(new VertexPositionNormalTexture(r.BACK_TOP_RIGHT, r.UP, new Vector2(1, 1))); vertexList.Add(new VertexPositionNormalTexture(r.FRONT_TOP_RIGHT, r.UP, new Vector2(1, 0))); // Right face vertexList.Add(new VertexPositionNormalTexture(r.FRONT_TOP_RIGHT, r.RIGHT, new Vector2(0, 1))); vertexList.Add(new VertexPositionNormalTexture(r.BACK_BOTTOM_RIGHT, r.RIGHT, new Vector2(1, 0))); vertexList.Add(new VertexPositionNormalTexture(r.FRONT_BOTTOM_RIGHT, r.RIGHT, new Vector2(0, 0))); vertexList.Add(new VertexPositionNormalTexture(r.FRONT_TOP_RIGHT, r.RIGHT, new Vector2(0, 1))); vertexList.Add(new VertexPositionNormalTexture(r.BACK_TOP_RIGHT, r.RIGHT, new Vector2(1, 1))); vertexList.Add(new VertexPositionNormalTexture(r.BACK_BOTTOM_RIGHT, r.RIGHT, new Vector2(1, 0))); // Bottom face vertexList.Add(new VertexPositionNormalTexture(r.FRONT_BOTTOM_LEFT, r.DOWN, new Vector2(0, 1))); vertexList.Add(new VertexPositionNormalTexture(r.BACK_BOTTOM_RIGHT, r.DOWN, new Vector2(1, 0))); vertexList.Add(new VertexPositionNormalTexture(r.BACK_BOTTOM_LEFT, r.DOWN, new Vector2(0, 0))); vertexList.Add(new VertexPositionNormalTexture(r.FRONT_BOTTOM_LEFT, r.DOWN, new Vector2(0, 1))); vertexList.Add(new VertexPositionNormalTexture(r.FRONT_BOTTOM_RIGHT, r.DOWN, new Vector2(1, 1))); vertexList.Add(new VertexPositionNormalTexture(r.BACK_BOTTOM_RIGHT, r.DOWN, new Vector2(1, 0))); // Left face vertexList.Add(new VertexPositionNormalTexture(r.BACK_TOP_LEFT, r.LEFT, new Vector2(0, 1))); vertexList.Add(new VertexPositionNormalTexture(r.FRONT_BOTTOM_LEFT, r.LEFT, new Vector2(1, 0))); vertexList.Add(new VertexPositionNormalTexture(r.BACK_BOTTOM_LEFT, r.LEFT, new Vector2(0, 0))); vertexList.Add(new VertexPositionNormalTexture(r.BACK_TOP_LEFT, r.LEFT, new Vector2(0, 1))); vertexList.Add(new VertexPositionNormalTexture(r.FRONT_TOP_LEFT, r.LEFT, new Vector2(1, 1))); vertexList.Add(new VertexPositionNormalTexture(r.FRONT_BOTTOM_LEFT, r.LEFT, new Vector2(1, 0))); // Back face vertexList.Add(new VertexPositionNormalTexture(r.BACK_TOP_RIGHT, r.BACKWARD, new Vector2(0, 1))); vertexList.Add(new VertexPositionNormalTexture(r.BACK_BOTTOM_LEFT, r.BACKWARD, new Vector2(1, 0))); vertexList.Add(new VertexPositionNormalTexture(r.BACK_BOTTOM_RIGHT, r.BACKWARD, new Vector2(0, 0))); vertexList.Add(new VertexPositionNormalTexture(r.BACK_TOP_RIGHT, r.BACKWARD, new Vector2(0, 1))); vertexList.Add(new VertexPositionNormalTexture(r.BACK_TOP_LEFT, r.BACKWARD, new Vector2(1, 1))); vertexList.Add(new VertexPositionNormalTexture(r.BACK_BOTTOM_LEFT, r.BACKWARD, new Vector2(1, 0))); r.vertices = vertexList.ToArray(); }
// Fills a rectangles index list private void SetupIndices(RectangleComponent r) { List <short> indexList = new List <short>(36); for (short i = 0; i < 36; ++i) { indexList.Add(i); } r.indices = indexList.ToArray(); }
public void Constructor_XYAndScale_Properties() { var ctx = Substitute.For <IWorldContext>(); var target = new RectangleComponent(1, 2, 3, ctx); Assert.AreEqual(new Point(1, 2), target.Transform.Position); Assert.AreEqual(3, target.Transform.Scale.X); Assert.AreEqual(3, target.Transform.Scale.Y); Assert.AreEqual(ctx, target.Context); }
public TextInput(Vector2f position, Vector2f size, string placeholderText, uint fontSize, TextPosition horizontalPosition = TextPosition.Middle, TextPosition verticalPosition = TextPosition.Middle) : base(position, size) { Focused = false; InputText = new AlignedTextComponent(position, size, new Vector2f(0, 0), fontSize, horizontalPosition, verticalPosition, "", new Color(255, 255, 255, 255)); InputPlaceholderText = new AlignedTextComponent(position, size, new Vector2f(0, 0), fontSize, horizontalPosition, verticalPosition, placeholderText, new Color(200, 200, 200, 255)); BoundingBox = new RectangleComponent(position, size, new Color(32, 32, 32, 255), new Color(128, 128, 128, 255), 2); MessageBus.Instance.Register(MessageType.CancelInputs, OnCancelInputs); MessageBus.Instance.Register(MessageType.TextInput, OnKeyPressed); }
public void FillRectangle(Color color, float x, float y, float width, float height) { var rect = new RectangleComponent(Drawer.Device, Drawer.ResourceManager, new SharpDX.Color4(color.R / 255f, color.G / 255f, color.B / 255f, color.A / 255f)) { Position = new SharpDX.Vector2(x, y), RectangleWidth = width, RectangleHeight = height }; Drawer.DrawTarget.InsertChild(rect, 0); }
public Portal(Point position, IWorldContext ctx) : base(new Point((int)position.X, (int)position.Y), ctx) { Transform.Scale = DefaultScale; teleportEffect = new RectangleComponent(Transform.Position, 3, ctx) { Pixel = '.'.Blue(), Enabled = false }; teleportEffect.Transform.CentralizePivotX(); }
public SongInfoComponent(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager) : base(device) { folder = new PictureObject(device, resourceManager, Utility.Path.Combine("scoremanager", "folder.png")); score = new PictureObject(device, resourceManager, Utility.Path.Combine("scoremanager", "score.png")); selection = new RectangleComponent(device, resourceManager, PPDColors.White) { Hidden = true }; this.AddChild(folder); this.AddChild(score); this.AddChild(selection); }
public void InitializeTest() { sinceSceneStart = 0; ctx = Substitute.For <IWorldContext>(); ctx.LogSystem.Returns(Substitute.For <ILogSystem>()); var time = Substitute.For <ITime>(); time.SinceSceneStart.Returns(c => sinceSceneStart); ctx.Time.Returns(time); owner = new RectangleComponent(5, 10, ctx); owner.Transform.Scale = new Point(20, 70); }
public BezierDrawer(Control control) : base(PPDExecuteArg.Empty, control) { InitializeDirectX(control.Width, control.Height, control.Width, control.Height, 1); Initialize(); ResourceManager = new ResourceManager(); spriteObject = new SpriteObject(device); spriteObject.AddChild(DrawTarget = new SpriteObject(device)); spriteObject.AddChild(Background = new SpriteObject(device)); spriteObject.AddChild(back = new RectangleComponent(device, ResourceManager, PPDColors.White) { RectangleHeight = control.Height, RectangleWidth = control.Width }); }
public void Draw_Context_CircleDrawn() { var ctx = Substitute.For <IWorldContext>(); var drawCtx = Substitute.For <IDrawContext>(); var canvas = Substitute.For <ICanvas>(); drawCtx.Canvas.Returns(canvas); var target = new RectangleComponent(new Point(10, 20), ctx); target.Draw(drawCtx); canvas.Received().Draw(target.Transform.BoundingBox, true, '#'.White()); }
private void ApplyRectangle(Canvas canvas, RectangleComponent rectComponent, Card card) { var metadataValue = rectComponent.Color.ResolveValue(card); var rectButton = new Rectangle { Fill = new SolidColorBrush(ColorResolver(metadataValue.Name)), Height = rectComponent.Height, Width = rectComponent.Width }; Canvas.SetTop(rectButton, rectComponent.PosY); Canvas.SetLeft(rectButton, rectComponent.PosX); canvas.Children.Add(rectButton); }
public void Constructor_OtherRectangleComponent_CopyProperties() { var ctx = Substitute.For <IWorldContext>(); var drawCtx = Substitute.For <IDrawContext>(); var canvas = Substitute.For <ICanvas>(); drawCtx.Canvas.Returns(canvas); var other = new RectangleComponent(new Point(10, 20), ctx); var target = new RectangleComponent(other); Assert.AreEqual(other.Transform.Position, target.Transform.Position); Assert.AreEqual(other.Transform.Scale, target.Transform.Scale); Assert.AreEqual(other.Context, target.Context); }
public HealthDisplay() : base(new Vector2f((1000 - (64 * 11 + 16)) / 2, 10), new Vector2f(64 * 11 + 16, 64)) { MessageBus.Instance.Register(MessageType.PlayerHealthChanged, OnPlayerHealthChanged); Heart = new SpriteComponent(Position, new Vector2f(64, 64), TextureManager.Instance.GetTexture("hp", "hp"), new Color(255, 255, 255, 255)); Outline = new RectangleComponent(Position + new Vector2f(48, -16), new Vector2f(64 * 10, 32), new Color(32, 0, 0, 255), new Color(64, 64, 64, 255), 2); Inside = new RectangleComponent(Position + new Vector2f(48, -16), new Vector2f(64 * 10, 32), new Color(192, 0, 0, 255)); RenderComponents = new HashSet <IRenderComponent> { Heart, Outline, Inside }; RenderLayer = RenderLayer.HUDFront; RenderView = RenderView.HUD; }
public void Start() { // Create ConcreteComponent and two Decorators RectangleComponent c = new RectangleComponent(); RedBorderDecorator d1 = new RedBorderDecorator(); BlueColorDecorator d2 = new BlueColorDecorator(); // Link decorators d1.SetComponent(c); d2.SetComponent(d1); d2.Operation(); System.Console.WriteLine(); }