Example #1
0
		private void UpdateRotationCenterIfDrawAreaHasChanged(string drawAreaText, 
			TextBox rotationCenterControl)
		{
			var drawArea = (Rectangle)GetComponentFromString(typeof(Rectangle), drawAreaText);
			if (Entity.DrawArea != drawArea)
				rotationCenterControl.Text = drawArea.Center.ToString();
		}
Example #2
0
 public void CheckRightKeys()
 {
     var textBox = new TextBox(Rectangle.One, "test");
     textBox.IsEnabled = true;
     textBox.State.HasFocus = true;
     new Command(() => textBox.Text = keyboard.HandleInput(textBox.Text)).Add(
         new KeyTrigger(Key.None, State.Released));
 }
Example #3
0
		private void AddFloatTextBoxToScene(float value)
		{
			var label = new Label(GetNextLabelDrawArea(), "Rotation");
			var textbox = new TextBox(GetNextControlDrawArea(), value.ToInvariantString());
			componentControls.Add(typeof(float), new List<Control> { label, textbox });
			scene.Add(label);
			scene.Add(textbox);
		}
Example #4
0
		private void UpdateComponentFromTextBox(Type componentType, TextBox textbox)
		{
			if (textbox.Text != textbox.PreviousText)
				if (componentType == typeof(float))
					UpdateFloatIfValueHasChanged(textbox.Text);
				else
					UpdateComponentIfValueHasChanged(componentType, textbox);
		}
Example #5
0
		public void SetUp()
		{
			topTextBox = new TextBox(Top, "Hello") { RenderLayer = 2 };
			bottomTextBox = new TextBox(Bottom, "World");
			InitializeKeyboardAndMouse();
		}
Example #6
0
 private void UpdateComponentIfValueHasChanged(Type componentType, TextBox textbox)
 {
     object newComponent = GetComponentFromString(componentType, textbox.Text);
     List<object> oldComponents = Entity.GetComponentsForEditing();
     foreach (var oldComponent in oldComponents)
         if (oldComponent.GetType() == componentType &&
             oldComponent.ToString() != newComponent.ToString())
             Entity.Set(newComponent);
 }
Example #7
0
 public void SetUp()
 {
     ellipse = new Ellipse(Vector2D.Half, 0.2f, 0.1f, Color.Blue);
     ellipse.Add(new Name("name"));
     writer = new EntityWriter(ellipse);
     drawAreaBox = writer.scene.Controls[1] as TextBox;
     colorRSlider = writer.scene.Controls[3] as Slider;
     colorGSlider = writer.scene.Controls[5] as Slider;
     colorBSlider = writer.scene.Controls[7] as Slider;
     colorASlider = writer.scene.Controls[9] as Slider;
     nameBox = writer.scene.Controls[11] as TextBox;
     rotationBox = writer.scene.Controls[13] as TextBox;
     rotationCenterBox = writer.scene.Controls[15] as TextBox;
 }
Example #8
0
 private void AddGenericComponentToScene(object component)
 {
     var label = new Label(GetNextLabelDrawArea(), GetName(component));
     var textbox = new TextBox(GetNextControlDrawArea(), component.ToString());
     var controls = new List<Control> { label, textbox };
     componentControls.Add(component.GetType(), controls);
     scene.Add(controls);
 }