Skip to content

Commit 9bd6e3c

Browse files
committed
Remove using statement. Dock enum needs to be explicit
1 parent e483d9a commit 9bd6e3c

File tree

1 file changed

+11
-12
lines changed
  • articles/tutorials/building_2d_games/21_customizing_gum_ui/snippets

1 file changed

+11
-12
lines changed

articles/tutorials/building_2d_games/21_customizing_gum_ui/snippets/optionsslider.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using Gum.DataTypes;
33
using Gum.DataTypes.Variables;
44
using Gum.Managers;
5-
using Gum.Wireframe;
65
using Microsoft.Xna.Framework;
76
using MonoGameGum.Forms.Controls;
87
using MonoGameGum.GueDeriving;
@@ -51,7 +50,7 @@ public OptionsSlider(TextureAtlas atlas)
5150
background.TextureLeft = backgroundRegion.SourceRectangle.Left;
5251
background.TextureTop = backgroundRegion.SourceRectangle.Top;
5352
background.TextureWidth = backgroundRegion.Width;
54-
background.Dock(Dock.Fill);
53+
background.Dock(Gum.Wireframe.Dock.Fill);
5554
topLevelContainer.AddChild(background);
5655

5756
// Create the title text element
@@ -77,7 +76,7 @@ public OptionsSlider(TextureAtlas atlas)
7776

7877
// Create the "OFF" side of the slider (left end)
7978
NineSliceRuntime offBackground = new NineSliceRuntime();
80-
offBackground.Dock(Dock.Left);
79+
offBackground.Dock(Gum.Wireframe.Dock.Left);
8180
offBackground.Texture = atlas.Texture;
8281
offBackground.TextureAddress = TextureAddress.Custom;
8382
offBackground.TextureHeight = offBackgroundRegion.Height;
@@ -86,14 +85,14 @@ public OptionsSlider(TextureAtlas atlas)
8685
offBackground.TextureWidth = offBackgroundRegion.Width;
8786
offBackground.Width = 28f;
8887
offBackground.WidthUnits = DimensionUnitType.Absolute;
89-
offBackground.Dock(Dock.Left);
88+
offBackground.Dock(Gum.Wireframe.Dock.Left);
9089
innerContainer.AddChild(offBackground);
9190

9291
TextureRegion middleBackgroundRegion = atlas.GetRegion("slider-middle-background");
9392

9493
// Create the middle track portion of the slider
9594
NineSliceRuntime middleBackground = new NineSliceRuntime();
96-
middleBackground.Dock(Dock.FillVertically);
95+
middleBackground.Dock(Gum.Wireframe.Dock.FillVertically);
9796
middleBackground.Texture = middleBackgroundRegion.Texture;
9897
middleBackground.TextureAddress = TextureAddress.Custom;
9998
middleBackground.TextureHeight = middleBackgroundRegion.Height;
@@ -102,7 +101,7 @@ public OptionsSlider(TextureAtlas atlas)
102101
middleBackground.TextureWidth = middleBackgroundRegion.Width;
103102
middleBackground.Width = 179f;
104103
middleBackground.WidthUnits = DimensionUnitType.Absolute;
105-
middleBackground.Dock(Dock.Left);
104+
middleBackground.Dock(Gum.Wireframe.Dock.Left);
106105
middleBackground.X = 27f;
107106
innerContainer.AddChild(middleBackground);
108107

@@ -118,21 +117,21 @@ public OptionsSlider(TextureAtlas atlas)
118117
maxBackground.TextureWidth = maxBackgroundRegion.Width;
119118
maxBackground.Width = 36f;
120119
maxBackground.WidthUnits = DimensionUnitType.Absolute;
121-
maxBackground.Dock(Dock.Right);
120+
maxBackground.Dock(Gum.Wireframe.Dock.Right);
122121
innerContainer.AddChild(maxBackground);
123122

124123
// Create the interactive track that responds to clicks
125124
// The special name "TrackInstance" is required for Slider functionality
126125
ContainerRuntime trackInstance = new ContainerRuntime();
127126
trackInstance.Name = "TrackInstance";
128-
trackInstance.Dock(Dock.Fill);
127+
trackInstance.Dock(Gum.Wireframe.Dock.Fill);
129128
trackInstance.Height = -2f;
130129
trackInstance.Width = -2f;
131130
middleBackground.AddChild(trackInstance);
132131

133132
// Create the fill rectangle that visually displays the current value
134133
_fillRectangle = new ColoredRectangleRuntime();
135-
_fillRectangle.Dock(Dock.Left);
134+
_fillRectangle.Dock(Gum.Wireframe.Dock.Left);
136135
_fillRectangle.Width = 90f; // Default to 90% - will be updated by value changes
137136
_fillRectangle.WidthUnits = DimensionUnitType.PercentageOfParent;
138137
trackInstance.AddChild(_fillRectangle);
@@ -146,7 +145,7 @@ public OptionsSlider(TextureAtlas atlas)
146145
offText.FontScale = 0.25f;
147146
offText.UseCustomFont = true;
148147
offText.Text = "OFF";
149-
offText.Anchor(Anchor.Center);
148+
offText.Anchor(Gum.Wireframe.Anchor.Center);
150149
offBackground.AddChild(offText);
151150

152151
// Add "MAX" text to the right end
@@ -158,7 +157,7 @@ public OptionsSlider(TextureAtlas atlas)
158157
maxText.FontScale = 0.25f;
159158
maxText.UseCustomFont = true;
160159
maxText.Text = "MAX";
161-
maxText.Anchor(Anchor.Center);
160+
maxText.Anchor(Gum.Wireframe.Anchor.Center);
162161
maxBackground.AddChild(maxText);
163162

164163
// Define colors for focused and unfocused states
@@ -251,4 +250,4 @@ private void HandleValueChanged(object sender, EventArgs e)
251250
// _fillRectangle uses percentage width units, so we multiply by 100
252251
_fillRectangle.Width = 100 * (float)ratio;
253252
}
254-
}
253+
}

0 commit comments

Comments
 (0)