예제 #1
0
        public GuiScrollableCollection(string text, Vector2 size, Vector2 position, int viewableItems, float itemHeight, float itemWidth)
            : base(text, size, position)
        {
            _collection    = new List <GuiDrawable>();
            _viewableItems = viewableItems;

            ItemSize = new Vector2(
                itemWidth,
                itemHeight
                );

            _scrollable = new GuiScrollable(
                new Vector2(
                    SCROLL_WIDTH,
                    _viewableItems * (itemHeight + MARGIN)
                    ),
                new Vector2(
                    Rectangle.Right,
                    Rectangle.Top
                    ),
                1
                );

            _currentPage   = 0;
            _pageBeginning = _viewableItems * _currentPage;
            _pageEnding    = _pageBeginning + _viewableItems;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="viewableArea"></param>
        public GuiScrollableCollection(string text, Vector2 size, Vector2 position, int viewableItems, float itemHeight, float itemWidth)
            : base(text, size, position)
        {
            _collection = new List<GuiDrawable>();
            _viewableItems = viewableItems;

            ItemSize = new Vector2(
                itemWidth,
                itemHeight
            );

            _scrollable = new GuiScrollable(
                new Vector2(
                    SCROLL_WIDTH,
                    _viewableItems * (itemHeight + MARGIN)
                ),
                new Vector2(
                    Rectangle.Right,
                    Rectangle.Top
                ),
                1
            );

            _currentPage = 0;
            _pageBeginning = _viewableItems * _currentPage;
            _pageEnding = _pageBeginning + _viewableItems;
        }
예제 #3
0
        /// <summary>
        /// Initialize a new instance of the ExerciseScreen class.
        /// </summary>
        /// <param name="game">The related game object.</param>
        /// <param name="viewableArea">The desired canvas size to draw on.</param>
        /// <param name="startingState">The desired starting Screen State</param>
        public SensorTileEditScreen(Game game, Rectangle viewableArea, ScreenState startingState)
            : base(game)
        {
            _timeStamp    = double.MinValue;
            ScreenState   = startingState;
            _viewableArea = viewableArea;

            Title = "Sensor Setup";

            _colorStream = new ColorStreamRenderer(game);

            #region Laying out the positions
            Vector2 modalSize = new Vector2(512, 384);

            _inputBoxDestination = new Rectangle(
                (_viewableArea.Width / 2) - ((int)modalSize.X / 2),
                (_viewableArea.Height / 2) - ((int)modalSize.Y / 2),
                (int)modalSize.X,
                (int)modalSize.Y
                );

            Vector2 buttonSize   = new Vector2(121f, 60f);
            Vector2 buttonBottom = new Vector2(
                _inputBoxDestination.Right - buttonSize.X - MARGIN,
                _inputBoxDestination.Bottom - buttonSize.Y);

            List <GuiDrawable> _buttonList = new List <GuiDrawable>();
            _buttonList.Add(
                new GuiButton("Submit",
                              buttonSize,
                              buttonBottom
                              ));

            _colorStreamSize = new Vector2(
                (float)((modalSize.X / 2) - (2 * MARGIN)),
                (float)((modalSize.Y / 2))
                );

            _colorStreamPosition = new Vector2(
                (float)(_inputBoxDestination.Left + MARGIN),
                (float)(_inputBoxDestination.Bottom - _colorStreamSize.Y - MARGIN - buttonSize.Y)
                );

            _scrollable = new GuiScrollable(
                new Vector2(
                    SCROLL_WIDTH,
                    _colorStreamSize.Y
                    ),
                new Vector2(
                    _inputBoxDestination.Right - SCROLL_WIDTH - (2 * MARGIN),
                    _colorStreamPosition.Y
                    ),
                @"UI\Slider"
                );

            #endregion

            _guiDrawable = _buttonList.ToArray();

            _isInitialized = false;
        }
        /// <summary>
        /// Initialize a new instance of the ExerciseScreen class.
        /// </summary>
        /// <param name="game">The related game object.</param>
        /// <param name="viewableArea">The desired canvas size to draw on.</param>
        /// <param name="startingState">The desired starting Screen State</param>
        public SensorTileEditScreen(Game game, Rectangle viewableArea, ScreenState startingState)
            : base(game)
        {
            _timeStamp = double.MinValue;
            ScreenState = startingState;
            _viewableArea = viewableArea;

            Title = "Sensor Setup";

            colorStream = new ColorStreamRenderer(game);

            #region Laying out the positions
            Vector2 modalSize = new Vector2(512, 384);

            _inputBoxDestination = new Rectangle(
                (_viewableArea.Width / 2) - ((int)modalSize.X / 2),
                (_viewableArea.Height / 2) - ((int)modalSize.Y / 2),
                (int)modalSize.X,
                (int)modalSize.Y
            );

            Vector2 buttonSize = new Vector2(121f, 60f);
            Vector2 buttonBottom = new Vector2(
                _inputBoxDestination.Right - buttonSize.X - MARGIN,
                _inputBoxDestination.Bottom - buttonSize.Y);

            List<GuiDrawable> _buttonList = new List<GuiDrawable>();
            _buttonList.Add(
                new GuiButton("Submit",
                    buttonSize,
                    buttonBottom
                ));

            colorStreamSize = new Vector2(
                    (float)((modalSize.X / 2) - (2 * MARGIN)),
                    (float)((modalSize.Y / 2))
                );

            colorStreamPosition = new Vector2(
                    (float)(_inputBoxDestination.Left + MARGIN),
                    (float)(_inputBoxDestination.Bottom - colorStreamSize.Y - MARGIN - buttonSize.Y)
                );

            _scrollable = new GuiScrollable(
                new Vector2(
                    SCROLL_WIDTH,
                    colorStreamSize.Y
                ),
                new Vector2(
                    _inputBoxDestination.Right - SCROLL_WIDTH - (2 * MARGIN),
                    colorStreamPosition.Y
                ),
                @"UI\Slider"
            );

            #endregion

            _guiDrawable = _buttonList.ToArray();

            _isInitialized = false;
        }