-
Notifications
You must be signed in to change notification settings - Fork 0
/
Canvas.cs
649 lines (559 loc) · 30 KB
/
Canvas.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Newtonsoft.Json;
using PostSharp.Patterns.Contracts;
using SliceDataLibrary;
namespace Game1 {
public class Canvas {
public Rectangle RootBounds { get => Root.ElementBounds; }
public List<CanvasElement> Children { get => Root.Children; }
public RootElement Root { get; set; }
public Canvas(ref SliceReference canvasTexture, List<CanvasElement> hierarchy = null) {
Root = new RootElement(ref canvasTexture, hierarchy);
}
#region Hierarchy Management
public void AddChild<T>(T child) where T : CanvasElement => Root.AddChild(child);
public void PrependChild<T>(T child) where T : CanvasElement => Root.PrependChild(child);
public void RemoveChild<T>(T child) where T : CanvasElement => Root.RemoveChild(child);
public void RemoveChild(int index) => Root.RemoveChild(index);
#endregion
public void Draw(SpriteBatch spriteBatch) {
Root.Draw(spriteBatch);
}
public bool PerformClick(Point hit) {
return Root.PerformClick(hit);
}
public class CanvasElement {
public SliceReference CanvasTexture { get; protected set; }
public Rectangle ElementBounds { get => elementBounds; set => elementBounds = value; }
public Point Location { get => elementBounds.Location; set => elementBounds.Location = value; }
public Point Center { get => elementBounds.Center; }
public Point Size { get => elementBounds.Size; }
public int X { get => elementBounds.X; set => elementBounds.X = value; }
public int Y { get => elementBounds.Y; set => elementBounds.Y = value; }
public int Height { get => elementBounds.Height; set => elementBounds.Height = value; }
public int Width { get => elementBounds.Width; set => elementBounds.Width = value; }
public int Top { get => elementBounds.Top; }
public int Bottom { get => elementBounds.Bottom; }
public int Left { get => elementBounds.Left; }
public int Right { get => elementBounds.Right; }
public List<CanvasElement> Children { get; }
public CanvasElement ParentElement { get; protected set; }
internal Rectangle elementBounds;
#region Constructors
public CanvasElement([Required] ref SliceReference canvasTexture,
[NonEmpty] Rectangle elementBounds,
List<CanvasElement> nestedElements = null) {
this.CanvasTexture = canvasTexture;
this.elementBounds = elementBounds;
Children = nestedElements ?? new List<CanvasElement>();
}
public CanvasElement([Required] ref SliceReference canvasTexture,
Point origin,
[NonEmpty] Point size,
List<CanvasElement> nestedElements = null) {
this.CanvasTexture = canvasTexture;
elementBounds = new Rectangle(origin, size);
Children = nestedElements ?? new List<CanvasElement>();
}
public CanvasElement([Required] ref SliceReference canvasTexture,
Point origin,
List<CanvasElement> nestedElements = null) {
this.CanvasTexture = canvasTexture;
elementBounds = new Rectangle(origin, Point.Zero);
Children = nestedElements ?? new List<CanvasElement>();
}
public CanvasElement([Required] ref SliceReference canvasTexture,
List<CanvasElement> nestedElements = null) {
this.CanvasTexture = canvasTexture;
elementBounds = new Rectangle(Point.Zero, Point.Zero);
Children = nestedElements ?? new List<CanvasElement>();
}
public CanvasElement(CanvasElement parentElement) {
ParentElement = parentElement;
}
public CanvasElement(CanvasElement parentElement,
[Required] ref SliceReference canvasTexture,
[NonEmpty] Rectangle elementBounds,
List<CanvasElement> nestedElements = null) {
CanvasTexture = canvasTexture;
this.elementBounds = elementBounds;
ParentElement = parentElement;
Children = nestedElements ?? new List<CanvasElement>();
}
public CanvasElement(CanvasElement parentElement,
[Required] ref SliceReference canvasTexture,
Point origin,
[NonEmpty] Point size,
List<CanvasElement> nestedElements = null) {
CanvasTexture = canvasTexture;
elementBounds = new Rectangle(origin, size);
ParentElement = parentElement;
Children = nestedElements ?? new List<CanvasElement>();
}
public CanvasElement(CanvasElement parentElement,
[Required] ref SliceReference canvasTexture,
[NonEmpty] Point origin,
List<CanvasElement> nestedElements = null) {
CanvasTexture = canvasTexture;
elementBounds = new Rectangle(origin, Point.Zero);
ParentElement = parentElement;
Children = nestedElements ?? new List<CanvasElement>();
}
public CanvasElement(CanvasElement parentElement,
[Required] ref SliceReference canvasTexture,
List<CanvasElement> nestedElements = null) {
CanvasTexture = canvasTexture;
elementBounds = new Rectangle(Point.Zero, Point.Zero);
ParentElement = parentElement;
Children = nestedElements ?? new List<CanvasElement>();
}
#endregion Constructors
#region Hierarchy Management
public void AddChild<T>([Required] T child) where T : CanvasElement {
Children.Add(child);
child.ParentElement = this;
Point relativeLocation = child.ElementBounds.Location;
child.elementBounds.Location = Location;
child.Offset(relativeLocation);
}
public void PrependChild<T>([Required] T child) where T : CanvasElement {
Children.Insert(0, child);
child.ParentElement = this;
Point relativeLocation = child.ElementBounds.Location;
child.elementBounds.Location = Location;
child.Offset(relativeLocation);
}
#region RemoveChild()
public void RemoveChild<T>([Required] T child) where T : CanvasElement {
Children.Remove(child);
}
public void RemoveChild(int index) {
Children.RemoveAt(index);
}
#endregion RemoveChild()
#endregion Hierarchy Management
#region Positioning
#region Inflate()
public void Inflate(float x = 0, float y = 0) {
ElementBounds.Inflate(x, y);
}
public void Inflate(int x = 0, int y = 0) {
ElementBounds.Inflate(x, y);
}
#endregion Inflate()
#region Offset()
public void Offset(Point amount) {
ElementBounds.Offset(amount);
}
public void Offset(Vector2 amount) {
ElementBounds.Offset(amount);
}
public void Offset(int x = 0, int y = 0) {
ElementBounds.Offset(x, y);
}
public void Offset(float x = 0, float y = 0) {
ElementBounds.Offset(x, y);
}
#endregion Offset()
public void Reposition(Point position) {
Point offset = position - Location;
Location = position;
foreach (CanvasElement element in Children) {
element.Reposition(position + offset);
}
}
public virtual void Centralize() {
if (ParentElement != null) {
X = ParentElement.Center.X - Center.X;
Y = ParentElement.Center.Y - Center.Y;
}
else {
Offset(Point.Zero);
}
}
#endregion Positioning
public virtual void Initialize(ref SliceReference canvasTexture,
[NonEmpty] Rectangle elementBounds) {
this.CanvasTexture = canvasTexture;
ElementBounds = elementBounds;
}
public virtual void Draw(SpriteBatch spriteBatch) {
if (Children?.Count > 0) {
foreach (CanvasElement nestedElement in Children) {
nestedElement.Draw(spriteBatch);
}
}
}
public virtual bool PerformClick(Point hit) {
if (ElementBounds.Contains(hit) && Children != null) {
foreach (CanvasElement nestedElement in Children) {
nestedElement.PerformClick(hit);
}
}
return false;
}
}
public class RootElement : CanvasElement {
#region Constructors
public RootElement([Required] ref SliceReference canvasTexture, List<CanvasElement> hierarchy = null)
: base(General.nullCanvasElement, ref canvasTexture, Point.Zero,
new Point(MainGame.virtualWidth, MainGame.virtualHeight), hierarchy) { }
#endregion Constructors
public List<CanvasElement> Hierarchy { get => Children; }
}
public class EmptyElement : CanvasElement {
#region Constructors
public EmptyElement(ref SliceReference canvasTexture,
Rectangle elementBounds,
List<CanvasElement> hierarchy = null)
: base(ref canvasTexture, elementBounds, hierarchy) { }
public EmptyElement(ref SliceReference canvasTexture,
Point origin,
Point size,
List<CanvasElement> hierarchy = null)
: base(ref canvasTexture, origin, size, hierarchy) { }
#endregion Constructors
}
public class RectangleElement : CanvasElement {
internal Rectangle sourceRectangle;
#region Constructors
public RectangleElement([Required] RectangleElement previous)
: base(previous.ParentElement) {
CanvasTexture = previous.CanvasTexture;
ElementBounds = previous.elementBounds;
sourceRectangle = previous.sourceRectangle;
}
public RectangleElement([Required] ref SliceReference canvasTexture,
[Required] string rectangleSlice,
List<CanvasElement> hierarchy = null)
: base(ref canvasTexture, hierarchy) {
sourceRectangle = canvasTexture.SliceData.Slices[rectangleSlice];
elementBounds.Width = sourceRectangle.Width;
elementBounds.Height = sourceRectangle.Height;
}
public RectangleElement([Required] ref SliceReference canvasTexture,
Point origin,
[Required] string rectangleSlice,
List<CanvasElement> hierarchy = null)
: base(ref canvasTexture, origin, hierarchy) {
sourceRectangle = canvasTexture.SliceData.Slices[rectangleSlice];
elementBounds.Width = sourceRectangle.Width;
elementBounds.Height = sourceRectangle.Height;
}
public RectangleElement(CanvasElement parentElement,
[Required] ref SliceReference canvasTexture,
[Required] string rectangleSlice,
List<CanvasElement> hierarchy = null)
: base(parentElement, ref canvasTexture, hierarchy) {
sourceRectangle = canvasTexture.SliceData.Slices[rectangleSlice];
elementBounds.Width = sourceRectangle.Width;
elementBounds.Height = sourceRectangle.Height;
}
public RectangleElement(CanvasElement parentElement,
[Required] ref SliceReference canvasTexture,
Point origin,
[Required] string rectangleSlice,
List<CanvasElement> hierarchy = null)
: base(parentElement, ref canvasTexture, origin, hierarchy) {
sourceRectangle = canvasTexture.SliceData.Slices[rectangleSlice];
elementBounds.Width = sourceRectangle.Width;
elementBounds.Height = sourceRectangle.Height;
}
#endregion Constructors
public override void Draw(SpriteBatch spriteBatch) {
spriteBatch.Draw(CanvasTexture.Sprite, ElementBounds, sourceRectangle, Color.White);
base.Draw(spriteBatch);
}
public void Draw(SpriteBatch spriteBatch, Point origin) {
spriteBatch.Draw(CanvasTexture.Sprite, origin.ToVector2(), sourceRectangle: sourceRectangle, Color.White);
base.Draw(spriteBatch);
}
}
public class LineElement : CanvasElement {
private readonly bool isVertical;
private readonly RectangleElement line;
private readonly RectangleElement lineEnd;
private readonly RectangleElement lineStart;
#region Constructors
public LineElement([Required] ref SliceReference canvasTexture,
bool isVertical,
[Required] RectangleElement line,
RectangleElement lineStart = null,
RectangleElement lineEnd = null,
List<CanvasElement> hierarchy = null)
: base(ref canvasTexture, hierarchy) {
this.isVertical = isVertical;
this.line = line;
this.lineStart = lineStart;
this.lineEnd = lineEnd;
}
public LineElement([Required] ref SliceReference canvasTexture,
Point origin,
bool isVertical,
[Required] RectangleElement line,
RectangleElement lineStart = null,
RectangleElement lineEnd = null,
List<CanvasElement> hierarchy = null)
: base(ref canvasTexture, origin, hierarchy) {
this.isVertical = isVertical;
this.line = line;
this.lineStart = lineStart;
this.lineEnd = lineEnd;
}
public LineElement([Required] ref SliceReference canvasTexture,
Point origin,
[NonEmpty] Point size,
bool isVertical,
[Required] RectangleElement line,
RectangleElement lineStart = null,
RectangleElement lineEnd = null,
List<CanvasElement> hierarchy = null)
: base(ref canvasTexture, origin, size, hierarchy) {
this.isVertical = isVertical;
this.line = line;
this.lineStart = lineStart;
this.lineEnd = lineEnd;
}
public LineElement(CanvasElement parentElement,
[Required] ref SliceReference canvasTexture,
bool isVertical,
[Required] RectangleElement line,
RectangleElement lineStart = null,
RectangleElement lineEnd = null,
List<CanvasElement> hierarchy = null)
: base(parentElement, ref canvasTexture, hierarchy) {
this.isVertical = isVertical;
this.line = line;
this.lineStart = lineStart;
this.lineEnd = lineEnd;
}
public LineElement(CanvasElement parentElement,
[Required] ref SliceReference canvasTexture,
Point origin,
bool isVertical,
[Required] RectangleElement line,
RectangleElement lineStart = null,
RectangleElement lineEnd = null,
List<CanvasElement> hierarchy = null)
: base(parentElement, ref canvasTexture, origin, hierarchy) {
this.isVertical = isVertical;
this.line = line;
this.lineStart = lineStart;
this.lineEnd = lineEnd;
}
public LineElement(CanvasElement parentElement,
[Required] ref SliceReference canvasTexture,
Point origin,
[NonEmpty] Point size,
bool isVertical,
[Required] RectangleElement line,
RectangleElement lineStart = null,
RectangleElement lineEnd = null,
List<CanvasElement> hierarchy = null)
: base(parentElement, ref canvasTexture, origin, size, hierarchy) {
this.isVertical = isVertical;
this.line = line;
this.lineStart = lineStart;
this.lineEnd = lineEnd;
}
#endregion Constructors
public override void Draw(SpriteBatch spriteBatch) {
int end = isVertical ? Bottom : Right;
Point drawOrigin = Location;
int offset;
do {
offset = isVertical ? drawOrigin.Y : drawOrigin.X;
if (lineEnd != null && offset >= end - (isVertical ? lineEnd.Height : lineEnd.Width)) {
DrawAndOffset(lineEnd, ref drawOrigin);
}
else if (lineStart != null && offset == (isVertical ? Y : X)) {
DrawAndOffset(lineStart, ref drawOrigin);
}
else {
DrawAndOffset(line, ref drawOrigin);
}
} while (offset < end);
base.Draw(spriteBatch);
void DrawAndOffset(RectangleElement element, ref Point origin) {
element.Draw(spriteBatch, origin);
if (isVertical) {
origin.Y += element.Height;
}
else {
origin.X += element.Width;
}
}
}
}
public class BoxElement : CanvasElement {
private readonly RectangleElement bottomLeftCorner;
private readonly RectangleElement bottomRightCorner;
private readonly RectangleElement genericCorner;
private readonly LineElement horizontalLine;
private readonly RectangleElement topLeftCorner;
private readonly RectangleElement topRightCorner;
private readonly LineElement verticalLine;
private Rectangle horizontalTopRectangle;
private Rectangle horizontalBottomRectangle;
private Rectangle verticalLeftRectangle;
private Rectangle verticalRightRectangle;
public BoxElement([Required] BoxElement previous)
: base(previous.ParentElement) {
CanvasTexture = previous.CanvasTexture;
ElementBounds = previous.ElementBounds;
bottomLeftCorner = previous.bottomLeftCorner;
bottomRightCorner = previous.bottomRightCorner;
genericCorner = previous.genericCorner;
horizontalLine = previous.horizontalLine;
topLeftCorner = previous.topLeftCorner;
topRightCorner = previous.topRightCorner;
verticalLine = previous.verticalLine;
horizontalTopRectangle = previous.horizontalTopRectangle;
horizontalBottomRectangle = previous.horizontalBottomRectangle;
verticalLeftRectangle = previous.verticalLeftRectangle;
verticalRightRectangle = previous.verticalRightRectangle;
}
#region Constructors
public BoxElement([Required] ref SliceReference canvasTexture,
[NonEmpty] Rectangle rootBounds,
[Required] LineElement mHorizontalLine,
[Required] LineElement mVerticalLine,
[Required] RectangleElement mGenericCorner,
RectangleElement mTopLeftCorner = null,
RectangleElement mTopRightCorner = null,
RectangleElement mBottomLeftCorner = null,
RectangleElement mBottomRightCorner = null,
List<CanvasElement> hierarchy = null)
: base(ref canvasTexture, rootBounds, hierarchy) {
horizontalLine = mHorizontalLine;
verticalLine = mVerticalLine;
genericCorner = mGenericCorner;
topLeftCorner = mTopLeftCorner ?? new RectangleElement(mGenericCorner);
topRightCorner = mTopRightCorner ?? new RectangleElement(mGenericCorner);
bottomLeftCorner = mBottomLeftCorner ?? new RectangleElement(mGenericCorner);
bottomRightCorner = mBottomRightCorner ?? new RectangleElement(mGenericCorner);
SetDrawBounds();
}
public BoxElement([Required] ref SliceReference canvasTexture,
[NonEmpty] Point origin,
[NonEmpty] Point size,
[Required] LineElement mHorizontalLine,
[Required] LineElement mVerticalLine,
[Required] RectangleElement mGenericCorner,
RectangleElement mTopLeftCorner = null,
RectangleElement mTopRightCorner = null,
RectangleElement mBottomLeftCorner = null,
RectangleElement mBottomRightCorner = null,
List<CanvasElement> hierarchy = null)
: base(ref canvasTexture, origin, size, hierarchy) {
horizontalLine = mHorizontalLine;
verticalLine = mVerticalLine;
genericCorner = mGenericCorner;
topLeftCorner = mTopLeftCorner ?? new RectangleElement(mGenericCorner);
topRightCorner = mTopRightCorner ?? new RectangleElement(mGenericCorner);
bottomLeftCorner = mBottomLeftCorner ?? new RectangleElement(mGenericCorner);
bottomRightCorner = mBottomRightCorner ?? new RectangleElement(mGenericCorner);
SetDrawBounds();
}
public BoxElement(CanvasElement parentElement,
[Required] ref SliceReference canvasTexture,
[Required][NonEmpty] Rectangle rootBounds,
[Required] LineElement mHorizontalLine,
[Required] LineElement mVerticalLine,
[Required] RectangleElement mGenericCorner,
RectangleElement mTopLeftCorner = null,
RectangleElement mTopRightCorner = null,
RectangleElement mBottomLeftCorner = null,
RectangleElement mBottomRightCorner = null,
List<CanvasElement> hierarchy = null)
: base(parentElement, ref canvasTexture, rootBounds, hierarchy) {
horizontalLine = mHorizontalLine;
verticalLine = mVerticalLine;
genericCorner = mGenericCorner;
topLeftCorner = mTopLeftCorner ?? new RectangleElement(mGenericCorner);
topRightCorner = mTopRightCorner ?? new RectangleElement(mGenericCorner);
bottomLeftCorner = mBottomLeftCorner ?? new RectangleElement(mGenericCorner);
bottomRightCorner = mBottomRightCorner ?? new RectangleElement(mGenericCorner);
SetDrawBounds();
}
public BoxElement(CanvasElement parentElement,
[Required] ref SliceReference canvasTexture,
[NonEmpty] Point origin,
[NonEmpty] Point size,
[Required] LineElement mHorizontalLine,
[Required] LineElement mVerticalLine,
[Required] RectangleElement mGenericCorner,
RectangleElement mTopLeftCorner = null,
RectangleElement mTopRightCorner = null,
RectangleElement mBottomLeftCorner = null,
RectangleElement mBottomRightCorner = null,
List<CanvasElement> hierarchy = null)
: base(parentElement, ref canvasTexture, origin, size, hierarchy) {
horizontalLine = mHorizontalLine;
verticalLine = mVerticalLine;
genericCorner = mGenericCorner;
topLeftCorner = mTopLeftCorner ?? new RectangleElement(mGenericCorner);
topRightCorner = mTopRightCorner ?? new RectangleElement(mGenericCorner);
bottomLeftCorner = mBottomLeftCorner ?? new RectangleElement(mGenericCorner);
bottomRightCorner = mBottomRightCorner ?? new RectangleElement(mGenericCorner);
SetDrawBounds();
}
#endregion Constructors
private void SetDrawBounds() {
topLeftCorner.Location = Location;
topRightCorner.Location = Location;
bottomLeftCorner.Location = Location;
bottomRightCorner.Location = Location;
horizontalTopRectangle.Location = Location;
horizontalBottomRectangle.Location = Location;
verticalLeftRectangle.Location = Location;
verticalRightRectangle.Location = Location;
topRightCorner.X = Right - topRightCorner.Width;
topRightCorner.Y = Top;
bottomLeftCorner.X = Left;
bottomLeftCorner.Y = Bottom - bottomLeftCorner.Height;
bottomRightCorner.Location = new Point(Right, Bottom)
- bottomRightCorner.Size;
horizontalTopRectangle.X += topLeftCorner.Width;
horizontalTopRectangle.Width = Width - topLeftCorner.Width
- topRightCorner.Width;
horizontalBottomRectangle.X += bottomLeftCorner.Width;
horizontalBottomRectangle.Width = Width - bottomLeftCorner.Width
- bottomRightCorner.Width;
horizontalBottomRectangle.Y = Bottom
- (bottomLeftCorner.Height < bottomRightCorner.Height
? bottomLeftCorner.Height : bottomRightCorner.Height);
verticalLeftRectangle.Y += topLeftCorner.Height;
verticalLeftRectangle.Height = Height - topLeftCorner.Height
- bottomLeftCorner.Height;
verticalRightRectangle.Y += topRightCorner.Height;
verticalRightRectangle.Height = Height - topRightCorner.Height
- bottomRightCorner.Height;
verticalRightRectangle.X = Right
- (topRightCorner.Width < bottomRightCorner.Width
? topRightCorner.Width : bottomRightCorner.Width);
}
public override void Centralize() {
base.Centralize();
SetDrawBounds();
}
public override void Draw(SpriteBatch spriteBatch) {
horizontalLine.ElementBounds = horizontalTopRectangle;
horizontalLine.Draw(spriteBatch);
horizontalLine.ElementBounds = horizontalBottomRectangle;
horizontalLine.Draw(spriteBatch);
verticalLine.ElementBounds = verticalLeftRectangle;
verticalLine.Draw(spriteBatch);
verticalLine.ElementBounds = verticalRightRectangle;
verticalLine.Draw(spriteBatch);
topLeftCorner.Draw(spriteBatch);
topRightCorner.Draw(spriteBatch);
bottomLeftCorner.Draw(spriteBatch);
bottomRightCorner.Draw(spriteBatch);
base.Draw(spriteBatch);
}
}
}
}