コード例 #1
0
        internal GUIListBox AddListBox(Vector2 location, string name, List <GUIListBoxItem> items)
        {
            GUIListBox lb = new GUIListBox(Game, location, name, items);

            lb.Initialize();
            components.Add(lb);
            return(lb);
        }
コード例 #2
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 = true;
            base.Initialize();
            GUILabel label = new GUILabel(Game, new Vector2(10, 10), "texturename", "Texture : " + Art.Name);

            label.Initialize();
            AddComponent(label);

            GUILabel depthlabel = new GUILabel(Game, new Vector2(10, 30), "depth", "Depth : ");

            depthlabel.Initialize();
            AddComponent(depthlabel);

            //GUIEditBox depthEdit = new GUIEditBox(Game, new Vector2(70, 30), "depth_edit", 3, Art.ScreenDepth.ToString());
            //depthEdit.Initialize();
            //AddComponent(depthEdit);

            // Depth Options
            List <GUIListBoxItem> depthItems = new List <GUIListBoxItem>();

            depthItems.Add(new GUIListBoxItem(Game, "0", "Static Background"));
            depthItems.Add(new GUIListBoxItem(Game, "0.1", "Far Background"));
            depthItems.Add(new GUIListBoxItem(Game, "0.449", "Background"));
            depthItems.Add(new GUIListBoxItem(Game, "0.5", "Midground"));
            depthItems.Add(new GUIListBoxItem(Game, "0.501", "Foreground"));
            depthItems.Add(new GUIListBoxItem(Game, "0.9", "Far Foreground"));
            depthItems.Add(new GUIListBoxItem(Game, "1", "Static Foreground"));

            GUIListBox depthEdit = new GUIListBox(Game, new Vector2(80, 30), "depth_edit", depthItems);

            depthEdit.Initialize();

            // Setting current item
            string currentDepth = Art.ScreenDepth.ToString();

            depthEdit.SetItem(currentDepth);

            AddComponent(depthEdit);

            //GUIEditBox edit = new GUIEditBox(Game, new Vector2(100, 10), "edtOpen", 300, "");
            //edit.Initialize();
            //AddComponent(edit);
            GUIButton ok = new GUIButton(Game, new Vector2(100, 400), "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(150, 400), "cancelbutton", "Cancel");

            cancel.Initialize();
            cancel.OnMouseClick += new GUIButton.MouseClickHandler(CancelMouseClick);
            cancel.Location.X   -= cancel.Bounds.Width / 2;
            AddComponent(cancel);
        }
コード例 #3
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()
        {
            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);
        }
コード例 #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);
        }