Exemplo n.º 1
0
        /// <summary>
        /// Initialize the item form.
        /// </summary>
        /// <param name="gui">The GUI that this form will be a part of.</param>
        /// <param name="position">The position of this form.</param>
        /// <param name="height">The height of this form.</param>
        /// <param name="width">The width of this form.</param>
        protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
        {
            //The inherited method.
            base.Initialize(gui, position, width, height);

            //Intialize some variables.
            _Item = null;
            Expander expGeneral = new Expander(GUI, Position + new Vector2(5, 5), Width - 10, 15);
            fldWidth = new Field(GUI, Width - 10, 15);
            fldHeight = new Field(GUI, Width - 10, 15);
            Expander expander2 = new Expander(GUI, Position + new Vector2(5, 65), Width - 10, 15);
            Textbox textbox2 = new Textbox(GUI, Position + new Vector2(5, 85), Width - 10, 15);
            Label label2 = new Label(GUI, Position + new Vector2(5, 105), Width - 10, 15);

            //Set up the components.
            SetUpComponents();

            //Add controls to the expander.
            expGeneral.AddItem(fldWidth);
            expGeneral.AddItem(fldHeight);
            expander2.AddItem(textbox2);
            expander2.AddItem(label2);

            //Add the controls.
            AddItem(expGeneral);
            AddItem(expander2);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initialize the load animation dialog.
        /// </summary>
        /// <param name="gui">The GUI that this dialog will be a part of.</param>
        /// <param name="position">The position of this dialog.</param>
        /// <param name="height">The height of this dialog.</param>
        /// <param name="width">The width of this dialog.</param>
        protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
        {
            //The inherited method.
            base.Initialize(gui, position, width, height);

            //Intialize some variables.
            _Layout.IsEnabled = false;
            _Border = 5;
            _Textbox = new Textbox(GUI, new Vector2((position.X + _Border), (position.Y + _Border)), (Width - (2 * _Border)), 15);
            _Button = new Button(GUI, new Vector2((position.X + ((Width / 2) - 25)), (position.Y + (Height - 30 - _Border))), 50, 30);

            //Add the controls.
            AddItem(_Textbox);
            AddItem(_Button);

            //Hook up some events.
            _Button.MouseClick += OnDoneButtonClick;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Create an edit bone dialog.
 /// </summary>
 /// <param name="gui">The GUI that this bone dialog will be a part of.</param>
 /// <param name="position">The position of this bone dialog.</param>
 /// <param name="height">The height of this bone dialog.</param>
 /// <param name="width">The width of this bone dialog.</param>
 public EditBoneDialog(GraphicalUserInterface gui, Vector2 position, float width, float height)
     : base(gui, position, width, height)
 {
 }
Exemplo n.º 4
0
        /// <summary>
        /// Initialize the bone dialog.
        /// </summary>
        /// <param name="gui">The GUI that this dialog will be a part of.</param>
        /// <param name="position">The position of this dialog.</param>
        /// <param name="height">The height of this dialog.</param>
        /// <param name="width">The width of this dialog.</param>
        protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
        {
            //The inherited method.
            base.Initialize(gui, position, width, height);

            //Intialize some variables.
            _Layout.IsEnabled = false;
            _Bone = new Bone();
            _BoneSprite = null;
            _Border = 5;
            _Ratio = .4f;
            _StartPosition = Vector2.Zero;
            _EndPosition = Vector2.Zero;

            //Create the necessary components.
            _Picturebox = new Picturebox(GUI, new Vector2((position.X + _Border + (Width * _Ratio)), (position.Y + _Border)),
                ((Width * (1 - _Ratio)) - (2 * _Border) - 15), (Height - 35 - (2 * _Border)));
            _Slider = new Slider(GUI, new Vector2((position.X + Width - _Border - 10), (position.Y + (Height - 85 - _Border))), SliderType.Vertical, 50);
            _NameLabel = new Label(GUI, Vector2.Add(Position, new Vector2(_Border, _Border)), 50, 15);
            _NameTextbox = new Textbox(GUI, Vector2.Add(_NameLabel.Position, new Vector2(_NameLabel.Width, 0)),
                ((Width * _Ratio) - (2 * _Border) - _NameLabel.Width), 15);
            _ParentLabel = new Label(GUI, Vector2.Add(_NameLabel.Position, new Vector2(0, 15)), 50, 15);
            _ParentTextbox = new Textbox(GUI, Vector2.Add(_ParentLabel.Position, new Vector2(_ParentLabel.Width, 0)),
                ((Width * _Ratio) - (2 * _Border) - _ParentLabel.Width), 15);
            _AddSpriteButton = new Button(GUI, Vector2.Add(_NameLabel.Position, new Vector2(10, 40)), 75, 30);
            _CloseButton = new Button(GUI, new Vector2((Position.X + ((Width / 2) - 25)), (Position.Y + (Height - 30 - _Border))), 50, 30);

            //Modify the components.
            _Picturebox.Origin = new Vector2((_Picturebox.Width / 2), (_Picturebox.Height / 2));
            _NameLabel.Text = "Name:";
            _ParentLabel.Text = "Parent ID:";
            _AddSpriteButton.Text = "Sprite";
            _Slider.Value = 1;
            _Slider.Maximum = 3;
            _CloseButton.Text = "Done";

            //Add the controls.
            AddItem(_Picturebox);
            AddItem(_Slider);
            AddItem(_NameLabel);
            AddItem(_NameTextbox);
            AddItem(_ParentLabel);
            AddItem(_ParentTextbox);
            AddItem(_AddSpriteButton);
            AddItem(_CloseButton);

            //Hook up to some events.
            _AddSpriteButton.MouseClick += OnAddSpriteButtonClick;
            _CloseButton.MouseClick += OnCloseButtonClick;
            _Picturebox.MouseClick += OnPictureboxClick;
            _Slider.ValueChange += OnSliderChange;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Create a layout grid.
 /// </summary>
 /// <param name="gui">The GUI that this layout will be a part of.</param>
 /// <param name="position">The position of this layout.</param>
 /// <param name="height">The height of this field.</param>
 /// <param name="width">The width of this field.</param>
 public Layout(GraphicalUserInterface gui, Vector2 position, float width, float height)
 {
     Initialize(gui, position, width, height);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Initialize the layout grid.
 /// </summary>
 /// <param name="gui">The GUI that this layout will be a part of.</param>
 /// <param name="position">The position of this layout.</param>
 /// <param name="height">The height of this layout.</param>
 /// <param name="width">The width of this layout.</param>
 private void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
 {
     //Initialize some variables.
     _GUI = gui;
     _IsEnabled = true;
     _Position = position;
     _Width = width;
     _Height = height;
     _MaxColumns = 3;
     _MaxRows = 12;
     _Padding = 5;
     _Margin = 5;
     _Grid = new LayoutCell[_MaxColumns, _MaxRows];
     _SizeStyle = LayoutSizeStyle.Evenly;
     _LayoutFlow = LayoutFlowStyle.Vertically;
     _VerticalAlignment = LayoutVerticalAlignment.TopDown;
     _HorizontalAlignment = LayoutHorizontalAlignment.LeftToRight;
     _IsDirty = false;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Initialize the item chooser.
        /// </summary>
        /// <param name="gui">The GUI that this chooser will be a part of.</param>
        /// <param name="position">The position of this chooser.</param>
        /// <param name="height">The height of this chooser.</param>
        /// <param name="width">The width of this chooser.</param>
        protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
        {
            //The inherited method.
            base.Initialize(gui, position, width, height);

            //Intialize some variables.
            _Layout.IsEnabled = false;
            _Border = 5;
            _Ratio = .4f;
            _Type = ItemType.Item;
            _PctbDisplay = new Picturebox(GUI, new Vector2(position.X + _Border + (Width * _Ratio), position.Y + _Border), (Width * (1 - _Ratio)) - (2 * _Border) - 15,
                Height - 35 - (2 * _Border));
            _PctbDisplay.Origin = new Vector2(_PctbDisplay.Width / 2, _PctbDisplay.Height / 2);
            _TrvItems = new TreeView(GUI, new Vector2(position.X + _Border, position.Y + _Border), (Width * _Ratio) - _Border, Height - (2 * _Border));
            _SldScale = new Slider(GUI, new Vector2(position.X + Width - _Border - 10, position.Y + (Height - 85 - _Border)), SliderType.Vertical, 50);
            _SldScale.Value = 1;
            _SldScale.Maximum = 3;
            _BtnFinish = new Button(GUI, new Vector2(position.X + (2 * (Width / 3) - 25), position.Y + (Height - 30 - _Border)), 50, 30);

            //Add the controls.
            AddItem(_PctbDisplay);
            AddItem(_TrvItems);
            AddItem(_SldScale);
            AddItem(_BtnFinish);

            //Hook up some events.
            _BtnFinish.MouseClick += OnDoneButtonClick;
            //_TrvItems.ItemSelect += OnListSelect;
            _SldScale.ValueChange += OnSliderChange;
        }
Exemplo n.º 8
0
        /// <summary>
        /// Initialize the load animation dialog.
        /// </summary>
        /// <param name="gui">The GUI that this dialog will be a part of.</param>
        /// <param name="position">The position of this dialog.</param>
        /// <param name="height">The height of this dialog.</param>
        /// <param name="width">The width of this dialog.</param>
        protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
        {
            //The inherited method.
            base.Initialize(gui, position, width, height);

            //Intialize some variables.
            _Layout.IsEnabled = false;
            _Border = 5;
            _SelectedIndex = -1;
            _Animations = new List<string>();
            _List = new List(GUI, new Vector2((position.X + _Border), (position.Y + _Border)), (Width - (2 * _Border)), (Height - 35 - (2 * _Border)));
            _Button = new Button(GUI, new Vector2((position.X + ((Width / 2) - 25)), (position.Y + (Height - 30 - _Border))), 50, 30);

            //Add the controls.
            AddItem(_List);
            AddItem(_Button);

            //Hook up some events.
            _Button.MouseClick += OnDoneButtonClick;
            _List.ItemSelect += OnListSelect;
        }
Exemplo n.º 9
0
        /// <summary>
        /// Initialize the item form.
        /// </summary>
        /// <param name="gui">The GUI that this form will be a part of.</param>
        /// <param name="position">The position of this form.</param>
        /// <param name="height">The height of this form.</param>
        /// <param name="width">The width of this form.</param>
        protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
        {
            //The inherited method.
            base.Initialize(gui, position, width, height);

            //Intialize some variables.
            _Item = null;

            //Create the tab controller.
            _TabControl = new TabControl(gui, position, width, height);

            //Create the general tab.
            _FrmGeneral = new Form(gui, position + new Vector2(0, 25), width, height);
            _PtbThumbnail = new Picturebox(gui, position, width - 10, 150);
            _ExpBase = new Expander(gui, position, width - 10, 15);
            _FldWidth = new Field(gui, width - 10, 15);
            _FldHeight = new Field(gui, width - 10, 15);
            _ExpWorld = new Expander(gui, position, width - 10, 15);
            _FldPosX = new Field(gui, width - 10, 15);
            _FldPosY = new Field(gui, width - 10, 15);
            _FldRotation = new Field(gui, width - 10, 15);
            _ExpLocal = new Expander(gui, position, width - 10, 15);
            _FldScaleX = new Field(gui, width - 10, 15);
            _FldScaleY = new Field(gui, width - 10, 15);
            _FldOriginX = new Field(gui, width - 10, 15);
            _FldOriginY = new Field(gui, width - 10, 15);

            //Create the physics tab.
            _FrmPhysics = new Form(gui, position + new Vector2(0, 25), width, height);
            _FldMass = new Field(gui, width - 10, 15);
            _FldFriction = new Field(gui, width - 10, 15);
            _FldRestitution = new Field(gui, width - 10, 15);
            _CkbIsStatic = new Checkbox(gui, position, width - 10, 15);
            _CkbIgnoreGravity = new Checkbox(gui, position, width - 10, 15);

            //Set up the components.
            SetUpComponents();

            //Add controls to the expanders.
            _ExpBase.AddItem(_FldWidth);
            _ExpBase.AddItem(_FldHeight);
            _ExpWorld.AddItem(_FldPosX);
            _ExpWorld.AddItem(_FldPosY);
            _ExpWorld.AddItem(_FldRotation);
            _ExpLocal.AddItem(_FldScaleX);
            _ExpLocal.AddItem(_FldScaleY);
            _ExpLocal.AddItem(_FldOriginX);
            _ExpLocal.AddItem(_FldOriginY);

            //Add the controls to the forms.
            _FrmGeneral.AddItem(_PtbThumbnail);
            _FrmGeneral.AddItem(_ExpBase);
            _FrmGeneral.AddItem(_ExpWorld);
            _FrmGeneral.AddItem(_ExpLocal);
            _FrmPhysics.AddItem(_FldMass);
            _FrmPhysics.AddItem(_FldFriction);
            _FrmPhysics.AddItem(_FldRestitution);
            _FrmPhysics.AddItem(_CkbIsStatic);
            _FrmPhysics.AddItem(_CkbIgnoreGravity);

            //Add the controls to their respective tabs.
            _TabControl.AddTab(_FrmGeneral, "General");
            _TabControl.AddTab(_FrmPhysics, "Physics");

            //Add the tab control to this modifier.
            Add(_TabControl);

            //Subscribe to the component's events.
            _FldPosX.Textbox.FocusChange += OnUserModify;
            _FldPosY.Textbox.FocusChange += OnUserModify;
            _FldRotation.Textbox.FocusChange += OnUserModify;
            _FldScaleX.Textbox.FocusChange += OnUserModify;
            _FldScaleY.Textbox.FocusChange += OnUserModify;
            _FldOriginX.Textbox.FocusChange += OnUserModify;
            _FldOriginY.Textbox.FocusChange += OnUserModify;
            _FldMass.Textbox.FocusChange += OnUserModify;
            _FldFriction.Textbox.FocusChange += OnUserModify;
            _FldRestitution.Textbox.FocusChange += OnUserModify;
            _CkbIsStatic.CheckboxTick += OnUserModify;
            _CkbIgnoreGravity.CheckboxTick += OnUserModify;
        }
Exemplo n.º 10
0
 /// <summary>
 /// Create a save skeleton dialog.
 /// </summary>
 /// <param name="gui">The GUI that this dialog will be a part of.</param>
 /// <param name="position">The position of this dialog.</param>
 /// <param name="height">The height of this dialog.</param>
 /// <param name="width">The width of this dialog.</param>
 public SaveSkeletonDialog(GraphicalUserInterface gui, Vector2 position, float width, float height)
     : base(gui, position, width, height)
 {
 }
Exemplo n.º 11
0
        /// <summary>
        /// Initialize the bone dialog.
        /// </summary>
        /// <param name="gui">The GUI that this dialog will be a part of.</param>
        /// <param name="position">The position of this dialog.</param>
        /// <param name="height">The height of this dialog.</param>
        /// <param name="width">The width of this dialog.</param>
        protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
        {
            //The inherited method.
            base.Initialize(gui, position, width, height);

            //Intialize some variables.
            _Bone = new Bone();
            _Border = 5;
            _SpriteName = null;
            _SpriteOrigin = Vector2.Zero;
            _SpriteRotationOffset = 0;
            _NameLabel = new Label(GUI, Vector2.Add(Position, new Vector2(_Border, _Border)), 50, 15);
            _NameLabel.Text = "Name:";
            _NameTextbox = new Textbox(GUI, Vector2.Add(_NameLabel.Position, new Vector2(_NameLabel.Width, 0)), (Width - (2 * _Border) - _NameLabel.Width), 15);
            _AddSpriteButton = new Button(GUI, Vector2.Add(_NameLabel.Position, new Vector2(10, 40)), 75, 30);
            _AddSpriteButton.Text = "Sprite";
            _CloseButton = new Button(GUI, new Vector2((Position.X + ((Width / 2) - 25)), (Position.Y + (Height - 30 - _Border))), 50, 30);
            _CloseButton.Text = "Done";

            //Add the controls.
            AddItem(_NameLabel);
            AddItem(_NameTextbox);
            AddItem(_AddSpriteButton);
            AddItem(_CloseButton);

            //Hook up to some events.
            _AddSpriteButton.MouseClick += OnAddSpriteButtonClick;
            _CloseButton.MouseClick += OnCloseButtonClick;
        }
Exemplo n.º 12
0
        /// <summary>
        /// Initialize the level editor.
        /// </summary>
        /// <param name="viewport">The window's viewport.</param>
        public void Initialize(Rectangle viewport)
        {
            //Initialize some variables.
            _State = EditorState.Idle;
            _GUI = new GraphicalUserInterface();
            _SelectedItem = null;
            _SelectedLayer = null;
            _Camera = new Camera2D(viewport, new Rectangle(0, 0, 10000, 5000));
            _Level = new Level("Level 1", _Camera);
            _DebugSystem = new DebugSystem(_Level.World);

            //Enable the debug view from start.
            _DebugSystem.Debug(true);

            //Hook up to some of the level's events.
            _Level.LayerChanged += OnLayerChanged;

            //Create the GUI items.
            _TreeView = new TreeView(_GUI, new Vector2(0, 50), 275, 450);
            _PropertyList = new List(_GUI, new Vector2(0, 505), 275, 200);
            _ItemModifier = new ItemModifier(_GUI, new Vector2(viewport.Width - 300, 50), 300, 500);
            _Menu = new Menu(_GUI, new Vector2(0, 0), 500, 30);

            //Add items to the GUI.
            _GUI.AddItem(_TreeView);
            _GUI.AddItem(_PropertyList);
            _GUI.AddItem(_ItemModifier);
            _GUI.AddItem(_Menu);

            //Brushes.
            _SelectionBrush = new LineBrush(1, Color.Gainsboro);

            #region Menu
            //Play with the menu.
            _Menu.AddMenuItem();
            _Menu.AddMenuItem();
            _Menu.AddMenuItem();
            _Menu.AddMenuItem();
            _Menu.MenuItems[0].AddListItem();
            _Menu.MenuItems[0].AddListItem();
            _Menu.MenuItems[0].AddListItem();
            _Menu.MenuItems[1].AddListItem();
            _Menu.MenuItems[1].AddListItem();
            _Menu.MenuItems[1].AddListItem();
            _Menu.MenuItems[2].AddListItem();
            _Menu.MenuItems[2].AddListItem();
            _Menu.MenuItems[2].AddListItem();
            _Menu.MenuItems[3].AddListItem();
            _Menu.MenuItems[3].AddListItem();
            _Menu.MenuItems[3].AddListItem();
            _Menu.MenuItems[0].IsScrollable = false;
            _Menu.MenuItems[1].IsScrollable = false;
            _Menu.MenuItems[2].IsScrollable = false;
            _Menu.MenuItems[3].IsScrollable = false;
            _Menu.MenuItems[0].IsFixed = false;
            _Menu.MenuItems[1].IsFixed = false;
            _Menu.MenuItems[2].IsFixed = false;
            _Menu.MenuItems[3].IsFixed = false;
            _Menu.MenuItems[0].Text = "File";
            _Menu.MenuItems[1].Text = "Edit";
            _Menu.MenuItems[2].Text = "View";
            _Menu.MenuItems[3].Text = "Physics";
            _Menu.MenuItems[0][0].Label.Text = "New Level";
            _Menu.MenuItems[0][1].Label.Text = "Open Level";
            _Menu.MenuItems[0][2].Label.Text = "Save Level";
            _Menu.MenuItems[1][0].Label.Text = "Add Item";
            _Menu.MenuItems[1][1].Label.Text = "Add Layer";
            _Menu.MenuItems[1][2].Label.Text = "Delete Layer";
            _Menu.MenuItems[2][0].Label.Text = "Zoom";
            _Menu.MenuItems[2][1].Label.Text = "Scroll";
            _Menu.MenuItems[2][2].Label.Text = "Windows";
            _Menu.MenuItems[3][0].Label.Text = "Play";
            _Menu.MenuItems[3][1].Label.Text = "Pause";
            _Menu.MenuItems[3][2].Label.Text = "Stop";
            #endregion

            //Hook up some events.
            _GUI.ItemClicked += OnGUIClicked;
            _TreeView.Ticked += OnTreeViewNodeTicked;
            _Menu.MenuOptionSelect += OnMenuOptionSelected;

            #region Test
            //Add layers.
            Layer layer1 = AddLayer("Layer 1", new Vector2(.6f, .6f));
            Layer layer2 = AddLayer("Layer 2", new Vector2(.5f, .5f));
            Layer layer3 = AddLayer("Layer 3", new Vector2(.7f, .7f));
            Layer layer4 = AddLayer("Layer 4", new Vector2(.63f, .63f));
            Layer layer5 = AddLayer("Layer 5", Vector2.One);
            Layer layer6 = AddLayer("Layer 6", new Vector2(.99f, 0.99f));
            Layer layer7 = AddLayer("Layer 7", new Vector2(1.5f, 1));

            //Add items.
            AddTextureItem(layer1, @"General/Textures/Hazy_Field[1]", "Background Hazy", new Vector2(0, 50), 0, Vector2.One);
            AddTextureItem(layer1, @"General/Textures/Hazy_Field[2]", "Background Hazy", new Vector2(0, 1000), 0, Vector2.One);
            AddTextureItem(layer1, @"General/Textures/Ruins[1]", "Background Ruins", new Vector2(2000, 50), 0, Vector2.One);
            AddTextureItem(layer2, @"General/Textures/FrozenMetalGroundV1[1]", "Ground", new Vector2(0, 700), 0, Vector2.One);
            AddTextureItem(layer2, @"General/Textures/Backdrop_Guy[1]", "Backdrop Guy", new Vector2(1900, 200), 0, Vector2.One);
            AddTextureItem(layer3, @"General/Textures/Hazy_Field_Tree[1]", "Hazy Field Tree", new Vector2(0, 1200), 0, Vector2.One);
            AddTextureItem(layer4, @"General/Textures/Hazy_Field_Pillar[1]", "Hazy Field Pillar", new Vector2(1200, 1500), 0, Vector2.One);
            AddTextureItem(layer5, @"General/Textures/Fern", "Fern 1", new Vector2(500, 500), 0, Vector2.One);
            AddTextureItem(layer5, @"General/Textures/Rock[1]", "Rock 1", new Vector2(400, 500), 0, Vector2.One);
            AddTextureItem(layer6, @"General/Textures/Fern", "Fern 2", new Vector2(515, 515), 0, Vector2.One);
            AddTextureItem(layer7, @"General/Textures/Pine_Tree", "Pine Tree", new Vector2(600, 0), 0, Vector2.One);
            AddTextureItem(layer7, @"General/Textures/Rock[2]", "Rock 2", new Vector2(300, 550), 0, Vector2.One);

            Box box1 = Factory.Instance.AddBox(layer5, "Ground", @"General/Textures/FrozenMetalGroundV1[1]", new Vector2(800, 700), 937, 32);
            box1.Limbs[0].Body.BodyType = FarseerPhysics.Dynamics.BodyType.Static;

            for (int i = 0; i <= 5; i++)
            {
                Box box2 = Factory.Instance.AddBox(layer5, "Box", @"General/Textures/BlueBoxV1[1]", new Vector2(500 + 50 * i, 50), 26, 27);
                box2.Limbs[0].Body.Restitution = .1f * i;
                //box2.Parts[0].Body.Mass = 1 + 1 * i;
            }
            #endregion
        }
Exemplo n.º 13
0
 /// <summary>
 /// Constructor for an item chooser.
 /// </summary>
 /// <param name="gui">The GUI that this chooser will be a part of.</param>
 /// <param name="position">The position of this chooser.</param>
 /// <param name="height">The height of this chooser.</param>
 /// <param name="width">The width of this chooser.</param>
 public ItemChooser(GraphicalUserInterface gui, Vector2 position, float width, float height)
     : base(gui, position, width, height)
 {
 }
Exemplo n.º 14
0
        /// <summary>
        /// Initialize the item form.
        /// </summary>
        /// <param name="gui">The GUI that this form will be a part of.</param>
        /// <param name="position">The position of this form.</param>
        /// <param name="height">The height of this form.</param>
        /// <param name="width">The width of this form.</param>
        protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
        {
            //The inherited method.
            base.Initialize(gui, position, width, height);

            //Intialize some variables.
            _Item = null;
            _ItemTypeCombobox = new Combobox(GUI, Position, Width - 10, 15);
            _ItemCombobox = new Combobox(GUI, Position, Width - 10, 15);
            Textbox textbox = new Textbox(GUI, Position, Width - 10, 15);

            //Initialize the item type combobox.
            foreach (ItemType item in Enum.GetValues(typeof(ItemType)))
            {
                //Add a item to the combobox.
                _ItemTypeCombobox.List.AddItem();
                //Get the added item and change its text.
                (_ItemTypeCombobox.List.Items[_ItemTypeCombobox.List.Items.Count - 1] as LabelListItem).Label.Tag = item;
                (_ItemTypeCombobox.List.Items[_ItemTypeCombobox.List.Items.Count - 1] as LabelListItem).Label.Text = item.ToString();
            }

            //Add the controls.
            AddItem(_ItemTypeCombobox);
            AddItem(_ItemCombobox);
            AddItem(textbox);

            //Hook up to some events.
            _ItemTypeCombobox.ItemSelect += OnItemTypeSelect;
        }
Exemplo n.º 15
0
 /// <summary>
 /// Create an item form.
 /// </summary>
 /// <param name="gui">The GUI that this form will be a part of.</param>
 /// <param name="position">The position of this form.</param>
 /// <param name="height">The height of this form.</param>
 /// <param name="width">The width of this form.</param>
 public ItemModifier(GraphicalUserInterface gui, Vector2 position, float width, float height)
 {
     Initialize(gui, position, width, height);
 }
Exemplo n.º 16
0
 /// <summary>
 /// Create an item form.
 /// </summary>
 /// <param name="gui">The GUI that this form will be a part of.</param>
 /// <param name="position">The position of this form.</param>
 /// <param name="height">The height of this form.</param>
 /// <param name="width">The width of this form.</param>
 public ModifyItemFormOld(GraphicalUserInterface gui, Vector2 position, float width, float height)
     : base(gui, position, width, height)
 {
 }
Exemplo n.º 17
0
        /// <summary>
        /// Initialize the animation controller.
        /// </summary>
        public void Initialize(AnimationEditorScreen screen, Character character)
        {
            //Initialize some variables.
            _Screen = screen;
            _Character = character;
            _SelectedAnimation = ((_Character != null) && (_Character.Skeleton.Animations.Count != 0)) ? GetAnimation(0) : null;
            _AnimationBars = new List<AnimationBar>();
            _SelectedBoneIndex = 0;
            _ModifiedBone = new List<bool>();
            _GUI = new GraphicalUserInterface();
            _IsGUIClicked = false;

            //Create the character.
            _Character = new Character(new Level("redundant", null), "deafult", new Vector2(600, 250), 0, Vector2.One, 0, 0);
            _Character.Skeleton.Initialize(screen.ScreenManager.GraphicsDevice);
            _Character.AddAnimation();
            _Character.Skeleton.Animations[0].Name = "default pose";
            _Character.Skeleton.AddKeyframe(0, 0);
            _Character.Skeleton.AddKeyframe(0, 3);
            _Character.Skeleton.AddKeyframe(0, 8);
            _Character.Skeleton.AddKeyframe(0, 12);
            _Character.Skeleton.AddKeyframe(0, 15);
            _Character.Skeleton.AddKeyframe(0, 19);

            //Initialize the list of modified bones.
            ResetModifiedBones();

            //Add items to the GUI.
            _InformationList = new List(_GUI, new Vector2(950, 155), 300, 300);
            _AnimationList = new Checkboxlist(_GUI, new Vector2(950, 50), 300, 100);
            _Menu = new Menu(_GUI, new Vector2(0, 0), 500, 30);

            //Save some components closer to home.
            _GUI.AddItem(_InformationList);
            _GUI.AddItem(_AnimationList);
            _GUI.AddItem(_Menu);

            //Create the animation bars and update the animation lists.
            UpdateAnimationLists();
            UpdateInformationList(true);

            //Tinker with the animation.
            _SelectedAnimation.ResetKeyframe(0);

            //Hook up some events.
            _GUI.ItemClicked += OnGUIClicked;
            _InformationList.ItemSelect += OnInformationSelected;
            _AnimationList.ItemSelect += OnAnimationSelected;

            #region Menu
            //Play with the menu.
            _Menu.AddMenuItem();
            _Menu.AddMenuItem();
            _Menu.AddMenuItem();

            _Menu.MenuItems[0].AddListItem();
            _Menu.MenuItems[0].AddListItem();
            _Menu.MenuItems[0].AddListItem();
            _Menu.MenuItems[0].AddListItem();
            _Menu.MenuItems[0].AddListItem();
            _Menu.MenuItems[0].AddListItem();

            _Menu.MenuItems[1].AddListItem();
            _Menu.MenuItems[1].AddListItem();
            _Menu.MenuItems[1].AddListItem();
            _Menu.MenuItems[1].AddListItem();
            _Menu.MenuItems[1].AddListItem();

            _Menu.MenuItems[2].AddListItem();
            _Menu.MenuItems[2].AddListItem();
            _Menu.MenuItems[2].AddListItem();

            _Menu.MenuItems[0].IsScrollable = false;
            _Menu.MenuItems[1].IsScrollable = false;
            _Menu.MenuItems[2].IsScrollable = false;
            _Menu.MenuItems[0].IsFixed = false;
            _Menu.MenuItems[1].IsFixed = false;
            _Menu.MenuItems[2].IsFixed = false;

            _Menu.MenuItems[0].Text = "File";
            _Menu.MenuItems[1].Text = "Edit";
            _Menu.MenuItems[2].Text = "View";

            _Menu.MenuItems[0][0].Label.Text = "New Animation";
            _Menu.MenuItems[0][1].Label.Text = "New Skeleton";
            _Menu.MenuItems[0][2].Label.Text = "Open Animation";
            _Menu.MenuItems[0][3].Label.Text = "Open Skeleton";
            _Menu.MenuItems[0][4].Label.Text = "Save Animation";
            _Menu.MenuItems[0][5].Label.Text = "Save Skeleton";

            _Menu.MenuItems[1][0].Label.Text = "Create Bone";
            _Menu.MenuItems[1][1].Label.Text = "Edit Bone";
            _Menu.MenuItems[1][2].Label.Text = "Create Keyframe";
            _Menu.MenuItems[1][3].Label.Text = "Delete Keyframe";
            _Menu.MenuItems[1][4].Label.Text = "Remove Animation";

            _Menu.MenuItems[2][0].Label.Text = "Zoom";
            _Menu.MenuItems[2][1].Label.Text = "Scroll";
            _Menu.MenuItems[2][2].Label.Text = "Windows";

            _Menu.MenuOptionSelect += OnMenuOptionSelected;
            #endregion
        }
Exemplo n.º 18
0
 /// <summary>
 /// Create a load animation dialog.
 /// </summary>
 /// <param name="gui">The GUI that this dialog will be a part of.</param>
 /// <param name="position">The position of this dialog.</param>
 /// <param name="height">The height of this dialog.</param>
 /// <param name="width">The width of this dialog.</param>
 public LoadAnimationDialog(GraphicalUserInterface gui, Vector2 position, float width, float height)
     : base(gui, position, width, height)
 {
 }
Exemplo n.º 19
0
        /// <summary>
        /// Initialize the sprite dialog.
        /// </summary>
        /// <param name="gui">The GUI that this sprite dialog will be a part of.</param>
        /// <param name="position">The position of this sprite dialog.</param>
        /// <param name="height">The height of this sprite dialog.</param>
        /// <param name="width">The width of this sprite dialog.</param>
        protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height)
        {
            //The inherited method.
            base.Initialize(gui, position, width, height);

            //Intialize some variables.
            _Layout.IsEnabled = false;
            _Border = 5;
            _Ratio = .4f;
            _Textures = new List<string>();
            _StartPosition = Vector2.Zero;
            _EndPosition = Vector2.Zero;
            _Picturebox = new Picturebox(GUI, new Vector2((position.X + _Border + (Width * _Ratio)), (position.Y + _Border)), ((Width * (1 - _Ratio)) - (2 * _Border) - 15),
                (Height - 35 - (2 * _Border)));
            _Picturebox.Origin = new Vector2((_Picturebox.Width / 2), (_Picturebox.Height / 2));
            _List = new List(GUI, new Vector2((position.X + _Border), (position.Y + _Border)), ((Width * _Ratio) - _Border), (Height - (2 * _Border)));
            _Slider = new Slider(GUI, new Vector2((position.X + Width - _Border - 10), (position.Y + (Height - 85 - _Border))), SliderType.Vertical, 50);
            _Slider.Value = 1;
            _Slider.Maximum = 3;
            _Button = new Button(GUI, new Vector2((position.X + (2 * (Width / 3) - 25)), (position.Y + (Height - 30 - _Border))), 50, 30);

            //Add the controls.
            AddItem(_Picturebox);
            AddItem(_List);
            AddItem(_Slider);
            AddItem(_Button);

            //Hook up some events.
            _Picturebox.MouseClick += OnPictureboxClick;
            _Button.MouseClick += OnDoneButtonClick;
            _List.ItemSelect += OnListSelect;
            _Slider.ValueChange += OnSliderChange;
        }