コード例 #1
0
        public void LoadContent(ContentManager content)
        {
            for (int i = 0; i < slideButtons.Length; i++)
            {
                slideButtons[i] = new ImageButton();
                slideButtons[i].LoadContent(content, "slideImage" + i.ToString());
                slideButtons[i].position = ArrayPositionToDrawingPosition(i);
            }

            clock.LoadContent(content, new Vector2(400, 400));
        }
コード例 #2
0
        /// <summary>
        /// Create a text box to store a given string in its area, splitting it into separate lines if necessary.
        /// </summary>
        /// <param name="topLeftCorner">The top left corner of the area this box will constrain text to.</param>
        /// <param name="bottomRightCorner">The bottom right corner of the area this box will constrain text to.</param>
        /// <param name="heldText">The full text to store in the box, which may or may not fit in its starting area by default.</param>
        /// <param name="startingOffset">How much the text should be scrolled initially.</param>
        //IMPORTANT: startingOffset will be changed later into a fractional double, as currently, anyone calling the constructor
        //must know how large the string will be in the given area and font.
        public TextBox(Vector2 topLeftCorner, Vector2 bottomRightCorner, string heldText, Color textColor, int startingOffset)
        {
            area = new Rectangle((int)topLeftCorner.X, (int)topLeftCorner.Y,
                (int)(bottomRightCorner.X - topLeftCorner.X), (int)(bottomRightCorner.Y - topLeftCorner.Y));

            text = new List<string>();
            fullText = heldText;
            color = textColor;
            scrollOffset = startingOffset;

            upButton = new ImageButton();
            downButton = new ImageButton();
            upButton.position = new Vector2(bottomRightCorner.X, topLeftCorner.Y);
            downButton.position = new Vector2(bottomRightCorner.X, bottomRightCorner.Y);
        }
コード例 #3
0
        protected override void Initialize()
        {
            backgroundColor = Color.CornflowerBlue;
            this.IsMouseVisible = true;

            //Initialize classes and set their positions.
            //For niceities, I may add a constructor either for Sprites or buttons to set their positions by default.
            //button1 = new ImageButton();
            //button1.position = new Vector2(50, 50);

            //button2 = new ImageButton();
            //button2.position = new Vector2(50, 150);

            //slider1 = new SliderButton(0, 100, 50);
            //slider1.position = new Vector2(150, 300);
            //slider1.backgroundImage.position = new Vector2(150, 300);

            ////Make a textbox that contains text that will definitely be condensed.
            //textBox = new TextBox(new Vector2(50, 350), new Vector2(150, 400),
            //    "Testssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss",
            //    Color.Black, 0);

            button1 = new ImageButton();
            button1.position = new Vector2(50, 50);
            button2 = new ImageButton();
            button2.position = new Vector2(50, 150);
            button3 = new ImageButton();
            button3.position = new Vector2(50, 250);

            base.Initialize();
        }