Ejemplo 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;

            //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;
        }
Ejemplo n.º 2
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);
        }