Exemplo n.º 1
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);
        }