예제 #1
0
        /// <summary>
        /// Initializes a new instance of the XnaBasics class.
        /// </summary>
        public XnaBasics()
        {
            this.IsFixedTimeStep = false;
            this.IsMouseVisible  = true;
            this.Window.Title    = "Xna Basics";

            // This sets the width to the desired width
            // It also forces a 4:3 ratio for height
            // Adds 110 for header/footer
            this.graphics = new GraphicsDeviceManager(this);
            this.graphics.PreferredBackBufferWidth       = Width;
            this.graphics.PreferredBackBufferHeight      = ((Width / 4) * 3) + 110;
            this.graphics.PreparingDeviceSettings       += this.GraphicsDevicePreparingDeviceSettings;
            this.graphics.SynchronizeWithVerticalRetrace = true;
            this.viewPortRectangle = new Rectangle(10, 80, Width - 20, ((Width - 2) / 4) * 3);

            Content.RootDirectory = "Content";

            // The Kinect sensor will use 640x480 for both streams
            // To make your app handle multiple Kinects and other scenarios,
            // it is recommended to use KinectSensorChooser provided in Microsoft.Kinect.Toolkit
            this.chooser = new KinectChooser(this, ColorImageFormat.RgbResolution640x480Fps30, DepthImageFormat.Resolution640x480Fps30);
            this.Services.AddService(typeof(KinectChooser), this.chooser);

            // Default size is the full viewport
            this.colorStream = new ColorStreamRenderer(this);

            // Calculate the minimized size and location
            this.depthStream          = new DepthStreamRenderer(this);
            this.depthStream.Size     = new Vector2(this.viewPortRectangle.Width / 4, this.viewPortRectangle.Height / 4);
            this.depthStream.Position = new Vector2(Width - this.depthStream.Size.X - 15, 85);

            // Store the values so we can animate them later
            this.minSize            = this.depthStream.Size;
            this.depthSmallPosition = this.depthStream.Position;
            this.colorSmallPosition = new Vector2(15, 85);

            this.Components.Add(this.chooser);

            this.previousKeyboard = Keyboard.GetState();
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the XnaBasics class.
        /// </summary>
        public XnaBasics()
        {
            this.IsFixedTimeStep = false;
            this.IsMouseVisible = true;
            this.Window.Title = "Xna Basics";
            this.Window.AllowUserResizing = true;
            Width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
            Height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;
            // This sets the width to the desired width
            // It also forces a 4:3 ratio for height
            // Adds 110 for header/footer
            this.graphics = new GraphicsDeviceManager(this);
            this.graphics.PreferredBackBufferWidth = Width;
            //this.graphics.PreferredBackBufferHeight = ((Width / 4) * 3) + 110;
            this.graphics.PreferredBackBufferHeight = Height;
            this.graphics.PreparingDeviceSettings += this.GraphicsDevicePreparingDeviceSettings;
            this.graphics.SynchronizeWithVerticalRetrace = true;
            //this.viewPortRectangle = new Rectangle(10, 80, Width - 20, ((Width - 2) / 4) * 3);
            this.viewPortRectangle = new Rectangle(0, 0, Width, Height);
            this.graphics.IsFullScreen = false;
            this.IsMouseVisible = false;

            physicSystem = new PhysicsSystem();
            camera = new JiggleGame.Camera(this);

            Content.RootDirectory = "Content";

            // The Kinect sensor will use 640x480 for both streams
            // To make your app handle multiple Kinects and other scenarios,
            // it is recommended to use KinectSensorChooser provided in Microsoft.Kinect.Toolkit
            this.chooser = new KinectChooser(this, ColorImageFormat.RgbResolution640x480Fps30, DepthImageFormat.Resolution640x480Fps30);
            this.Services.AddService(typeof(KinectChooser), this.chooser);

            // Default size is the full viewport
            this.colorStream = new ColorStreamRenderer(this);

            // Calculate the minimized size and location
            this.depthStream = new DepthStreamRenderer(this);
            this.depthStream.Size = new Vector2(this.viewPortRectangle.Width / 4, this.viewPortRectangle.Height / 4);
            this.depthStream.Position = new Vector2(Width - this.depthStream.Size.X - 15, 10);

            // Store the values so we can animate them later
            this.minSize = this.depthStream.Size;
            this.depthSmallPosition = this.depthStream.Position;
            this.colorSmallPosition = new Vector2(15, 10);

            this.Components.Add(this.chooser);

            LeftHand = new Vector2();
            RightHand = new Vector2();

            this.clothRender = new ClothRender(this);
            this.Components.Add(this.clothRender);
        }
        /// <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;
        }
예제 #4
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 SummaryScreen(Game game, Rectangle viewableArea, ScreenState startingState)
            : base(game)
        {
            ScreenState = startingState;
            _viewableArea = viewableArea;
            _colorStream = new ColorStreamRenderer(game);

            Title = "Summary";

            _replayTiles = new ReplayTile[0];

            #region Laying out positions
            _colorStreamPosition = new Vector2(
                    (float)(_viewableArea.X),
                    (float)(_viewableArea.Y)
                );

            _colorStreamMaxSize = new Vector2(
                    (float)(0.7 * _viewableArea.Width),
                    (float)(0.7 * _viewableArea.Height)
                );

            _colorStreamSize = Vector2.Zero;

            Vector2 buttonSize = new Vector2(240f, 60f);
            Vector2 buttonBottom = new Vector2(
                _viewableArea.Right - buttonSize.X + MARGIN,
                _viewableArea.Bottom - buttonSize.Y);

            Vector2 catalogPosition = new Vector2(
                _viewableArea.Left + MARGIN,
                _viewableArea.Top + buttonSize.Y
            );

            Vector2 catalogSize = new Vector2(
                _viewableArea.Width - buttonSize.X - MARGIN,
                _viewableArea.Height - buttonSize.Y
            );

            List<GuiDrawable> guiDrawableSelect = new List<GuiDrawable>();
            guiDrawableSelect.Add(
                new GuiButton(
                    "Finished",
                    buttonSize,
                    buttonBottom
                    - new Vector2(0f, MARGIN)
                    - new Vector2(0f, buttonSize.Y)
            ));

            guiDrawableSelect.Add(
                new GuiButton(
                    "ExitProgram",
                    buttonSize,
                    buttonBottom)
            );

            List<GuiDrawable> guiDrawableReplay = new List<GuiDrawable>();
            guiDrawableReplay.Add(
                new GuiButton(
                    "Replay",
                    buttonSize,
                    buttonBottom
                    - (new Vector2(0f, 3 * MARGIN))
                    - (new Vector2(0f, 3 * buttonSize.Y))
            ));
            guiDrawableReplay.Add(
                new GuiButton(
                    "Change",
                    buttonSize,
                    buttonBottom
                    - new Vector2(0f, 2 * MARGIN)
                    - new Vector2(0f, 2 * buttonSize.Y)
                ));
            guiDrawableReplay.Add(
                new GuiButton(
                    "Finished",
                    buttonSize,
                    buttonBottom
                    - new Vector2(0f, MARGIN)
                    - new Vector2(0f, buttonSize.Y)
                ));
            guiDrawableReplay.Add(
                new GuiButton(
                    "ExitProgram",
                    buttonSize,
                    buttonBottom
                )
            );

            List<GuiDrawable> guiDrawable = new List<GuiDrawable>();

            guiDrawable.Add(
                new GuiSensorStatus(
                    "SensorStatus",
                    new Vector2(99f, 32f),
                    new Vector2(
                        (_viewableArea.Right / 2) - (99f / 2),
                        _viewableArea.Bottom - 32f
                    ),
                    game
                )
            );

            guiDrawable.Add(
                new GuiHeader("KinectTherapy",
                    new Vector2(326f, 52f),
                    new Vector2(
                        _viewableArea.Left,
                        _viewableArea.Top - MARGIN - 52f
                    )
                )
            );

            guiDrawable.Add(
                new GuiScrollableCollection(
                    "Catalog",
                    catalogSize,
                    catalogPosition,
                    4,
                    115f,
                    600f
                )
            );

            _catalogLocation = guiDrawable.Count - 1;

            #endregion
            _guiDrawable = guiDrawable.ToArray();
            _guiDrawableReplay = guiDrawableReplay.ToArray();
            _guiDrawableSelect = guiDrawableSelect.ToArray();

            _isInitialized = false;
            _isReplaying = false;
        }
예제 #5
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 ExerciseScreen(Game game, Rectangle viewableArea, ScreenState startingState)
            : base(game)
        {
            ScreenState = startingState;
            _viewableArea = viewableArea;
            _colorStream = new ColorStreamRenderer(game);

            Title = "Exercise";

            _exerciseTiles = new ExerciseTile[0];

            #region Laying out the positions
            _colorStreamPosition = new Vector2(
                    (float)(viewableArea.X),
                    (float)(viewableArea.Y)
                );

            _colorStreamSize = new Vector2(
                    (float)(0.7 * viewableArea.Width),
                    (float)(0.7 * viewableArea.Height)
                );

            _tileSize = new Vector2(250f, 250f);
            _tilePosition = new Vector2(
                (float)(_colorStreamPosition.X + _colorStreamSize.X + (MARGIN * 2)),
                (float)(_colorStreamPosition.Y)
            );

            _tileTextPosition = new Vector2(
                _tilePosition.X,
                _tilePosition.Y + _tileSize.Y
            );

            Vector2 buttonSize = new Vector2(240f, 60f);
            Vector2 buttonBottom = new Vector2(
                _viewableArea.Right - buttonSize.X + MARGIN,
                _viewableArea.Bottom - buttonSize.Y);

            Dictionary<string, GuiDrawable> guiDrawables = new Dictionary<string, GuiDrawable>();
            guiDrawables.Add("Menu",
                new GuiButton("Menu",
                    buttonSize,
                    buttonBottom
                    - (new Vector2(0f, 2 * MARGIN))
                    - (new Vector2(0f, 2 * buttonSize.Y))
            ));
            guiDrawables.Add("Skip",
                new GuiButton("Skip",
                    buttonSize,
                    buttonBottom
                    - new Vector2(0f , MARGIN)
                    - new Vector2(0f, buttonSize.Y)
            ));
            guiDrawables.Add("EndQueue",
                new GuiButton("EndQueue",
                    buttonSize,
                    buttonBottom)
            );

            guiDrawables.Add("SensorStatus",
                new GuiSensorStatus(
                    "SensorStatus",
                    new Vector2(99f, 32f),
                    new Vector2(
                        (_viewableArea.Right / 2) - (99f / 2),
                        _viewableArea.Bottom - 32f
                    ),
                    game
                )
            );

            guiDrawables.Add("KinectTherapy", new GuiHeader("KinectTherapy",
                new Vector2(326f, 52f),
                new Vector2(
                _viewableArea.Left,
                _viewableArea.Top - MARGIN - 52f
            )));

            #endregion

            _guiDrawable = new GuiDrawable[guiDrawables.Count];

            guiDrawables.Values.CopyTo(_guiDrawable, 0);

            _isInitialized = false;
        }