Esempio n. 1
0
        internal GUIEditBox AddEditBox(Vector2 location, string name, int length, string startingText)
        {
            GUIEditBox e = new GUIEditBox(Game, location, name, length, startingText);

            e.Initialize();
            components.Add(e);
            return(e);
        }
Esempio n. 2
0
        private void useSizeForObject()
        {
            GUILabel s_label = new GUILabel(Game, new Vector2(10, 100), "s_label", "Dimensions : ");

            s_label.Initialize();
            AddComponent(s_label);

            GUIEditBox s_width = new GUIEditBox(Game, new Vector2(100, 100), "s_width", 50, Dimensions.X.ToString());

            s_width.Initialize();
            AddComponent(s_width);

            GUIEditBox s_height = new GUIEditBox(Game, new Vector2(160, 100), "s_height", 50, Dimensions.Y.ToString());

            s_height.Initialize();
            AddComponent(s_height);
        }
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();
            GUILabel label = new GUILabel(Game, new Vector2(10, 10), "lblOpen", "Filename:");

            label.Initialize();
            AddComponent(label);
            //GUIEditBox edit = new GUIEditBox(Game, new Vector2(100, 10), "edtOpen", 300, "");
            //edit.Initialize();
            //AddComponent(edit);
            GUIButton ok = new GUIButton(Game, new Vector2(480, 50), "okbutton", "Ok");

            ok.Initialize();
            ok.OnMouseClick += new GUIButton.MouseClickHandler(OkMouseClick);
            AddComponent(ok);
            GUIButton cancel = new GUIButton(Game, new Vector2(520, 50), "cancelbutton", "Cancel");

            cancel.Initialize();
            cancel.OnMouseClick += new GUIButton.MouseClickHandler(CancelMouseClick);
            AddComponent(cancel);

            GUICheckbox isphys = new GUICheckbox(Game, new Vector2(100, 50), "isphys", "Generate Collision Mesh");

            isphys.Initialize();
            AddComponent(isphys);

            GUILabel bouncylbl = new GUILabel(Game, new Vector2(10, 90), "lblBounce", "Bounciness");

            bouncylbl.Initialize();
            AddComponent(bouncylbl);

            GUIEditBox bouncy = new GUIEditBox(Game, new Vector2(100, 90), "edtBouncy", 50, "500");

            bouncy.Initialize();
            AddComponent(bouncy);

            GUILabel frictionlbl = new GUILabel(Game, new Vector2(10, 120), "lblFriction", "Friction");

            frictionlbl.Initialize();
            AddComponent(frictionlbl);

            GUIEditBox friction = new GUIEditBox(Game, new Vector2(100, 120), "edtFriction", 50, "500");

            friction.Initialize();
            AddComponent(friction);


            // Add List Box
            List <GUIListBoxItem> guiListItems = new List <GUIListBoxItem>();

            string[] filenames = Directory.GetFiles("Content\\LevelArt");

            for (int i = 0; i < filenames.Length; i++)
            {
                string shortName = (string)filenames[i].Substring(17);
                guiListItems.Add(new GUIListBoxItem(Game, filenames[i], shortName));
            }

            fileList = new GUIListBox(Game, new Vector2(100, 10), "list box", guiListItems);
            fileList.Initialize();
            AddComponent(fileList);
        }
Esempio n. 4
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            this.minimised = false;
            base.Initialize();
            GUILabel label = new GUILabel(Game, new Vector2(10, 10), "physobjname", "Texture:");

            label.Initialize();
            AddComponent(label);

            // Use Texture
            List <GUIListBoxItem> guiListItems = new List <GUIListBoxItem>();

            string[] filenames = Directory.GetFiles("Content\\LevelArt");

            for (int i = 0; i < filenames.Length; i++)
            {
                string shortName = (string)filenames[i].Substring(17);
                guiListItems.Add(new GUIListBoxItem(Game, filenames[i], shortName));
            }

            fileList = new GUIListBox(Game, new Vector2(10, 30), "list box", guiListItems);
            fileList.Initialize();


            GUILabel weightlbl = new GUILabel(Game, new Vector2(10, 60), "lblMass", "Mass");

            weightlbl.Initialize();
            AddComponent(weightlbl);

            GUIEditBox weight = new GUIEditBox(Game, new Vector2(100, 60), "edtMass", 50, "10");

            weight.Initialize();
            AddComponent(weight);

            GUILabel bouncylbl = new GUILabel(Game, new Vector2(10, 90), "lblBounce", "Bounciness");

            bouncylbl.Initialize();
            AddComponent(bouncylbl);

            GUIEditBox bouncy = new GUIEditBox(Game, new Vector2(100, 90), "edtBouncy", 50, "500");

            bouncy.Initialize();
            AddComponent(bouncy);

            GUILabel frictionlbl = new GUILabel(Game, new Vector2(10, 120), "lblFriction", "Friction");

            frictionlbl.Initialize();
            AddComponent(frictionlbl);

            GUIEditBox friction = new GUIEditBox(Game, new Vector2(100, 120), "edtFriction", 50, "500");

            friction.Initialize();
            AddComponent(friction);

            GUIButton ok = new GUIButton(Game, new Vector2(150, 375), "okbutton", "Apply");

            ok.Initialize();
            ok.OnMouseClick += new GUIButton.MouseClickHandler(OkMouseClick);
            ok.Location.X   -= ok.Bounds.Width / 2;
            AddComponent(ok);
            GUIButton cancel = new GUIButton(Game, new Vector2(200, 375), "cancelbutton", "Cancel");

            cancel.Initialize();
            cancel.OnMouseClick += new GUIButton.MouseClickHandler(CancelMouseClick);
            cancel.Location.X   -= cancel.Bounds.Width / 2;
            AddComponent(cancel);

            AddComponent(fileList);
        }