protected override void LoadContent() { this.colorStream = new ColorStreamRenderer(Game, new Vector2(GraphicsDevice.Viewport.Width - 5 - 160, 5), new Vector2(160, 100)); this.currentModel = Game.Content.Load <Model>("MODELS/ninja2/ninja/ninja2"); if (null == this.currentModel) { throw new InvalidOperationException("Cannot load 3D avatar model"); } effect = new SkinnedEffect(GraphicsDevice); effect.Texture = Game.Content.Load <Texture2D>("MODELS/ninja2/ninja/texture"); foreach (ModelMesh mesh in currentModel.Meshes) { foreach (ModelMeshPart part in mesh.MeshParts) { part.Effect = effect; } } this.animator.AvatarModel = this.currentModel; this.animator.AvatarHipCenterHeight = this.avatarHipCenterDrawHeight; this.BuildJointHierarchy(); base.LoadContent(); }
public Screen(Fonts fonts, ColorStreamRenderer stream) { cloud = new Services(); colorStream = stream; firstEntrance = true; this.fonts = fonts; gameMode = Mode.Start; time = 0; timer = new Time(2, 00); airApple = new List <Apple>(); sounds = new SoundVault(new List <AvailableSounds>() { AvailableSounds.END_GAME, AvailableSounds.TICK, AvailableSounds.CARTOON_HOP, }, 1); }
/// <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; }
public void OpenColorStream() { ColorStream = new ColorStreamRenderer(Game as NeatGame); }
//------------------------------------------- public LearnAndPlayGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; //----------------------------------------// // PIERWSZY EKRAN // //----------------------------------------// if (Settings.PROJECT_STATE == Settings.Environment.DEVELOPMENT) { activeScreen = Settings.STARTING_SCREEN; } else { activeScreen = GameType.LoadingScreen; } //----------------------------------------// //Kursor widoczny na ekranie pointer = new Pointer(); //Czcionki dostepne w aplikacji fonts = new Fonts(); //InfoBox wyswietlany w trakcie gry infoBox = new InfoBox(fonts); infoBox.Disable(); infoBox.Invisible(); //Sledzony szkielet trackedSkeleton = new TrackedSkeleton(); //Chmura cloud = new Cloud.Services(); //---------------------------------------------------------------------------------------------------------------------- // USTAWIENIA OKNA //---------------------------------------------------------------------------------------------------------------------- //Ustawienie nazwy okna this.Window.Title = "Ucz siê i baw z Kinectem!"; this.graphics.PreferredBackBufferWidth = Settings.WINDOW_WIDTH; this.graphics.PreferredBackBufferHeight = Settings.WINDOW_HEIGHT; this.graphics.PreparingDeviceSettings += this.GraphicsDevicePreparingDeviceSettings; this.graphics.SynchronizeWithVerticalRetrace = true; //---------------------------------------------------------------------------------------------------------------------- // INICJALIZACJA KINECTA I USTAWIENIA //---------------------------------------------------------------------------------------------------------------------- this.viewPortRectangle = new Rectangle((int)infoBox.getPosition().X, (int)infoBox.getPosition().Y, 130, 130); // Sensor bedzie uzywal rozdzielczosci 640x480 dla obu strumieni this.chooser = new KinectChooser(this, ColorImageFormat.RgbResolution640x480Fps30, DepthImageFormat.Resolution640x480Fps30); this.Services.AddService(typeof(KinectChooser), this.chooser); // ColorStream - pozycja i rozmiar this.colorStream = new ColorStreamRenderer(this); this.colorStream.Size = new Vector2(this.viewPortRectangle.Width, this.viewPortRectangle.Height); this.colorStream.Position = new Vector2(infoBox.getPosition().X + 160, infoBox.getPosition().Y + 10); // DepthStream - pozycja i rozmiar this.depthStream = new DepthStreamRenderer(this); this.depthStream.Size = new Vector2(this.viewPortRectangle.Width, this.viewPortRectangle.Height); this.depthStream.Position = new Vector2(infoBox.getPosition().X + 150, infoBox.getPosition().Y); this.Components.Add(this.chooser); //Licznik klatek if (Settings.PROJECT_STATE == Settings.Environment.DEVELOPMENT) { this.Components.Add(new FrameRateCounter(this)); } speech = new KinectSpeech(chooser.Sensor); //---------------------------------------------------------------------------------------------------------------------- }
/// <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; }
protected override void LoadContent() { this.colorStream = new ColorStreamRenderer(Game, new Vector2(GraphicsDevice.Viewport.Width - 5 - 160, 5), new Vector2(160, 100)); this.currentModel = Game.Content.Load<Model>("MODELS/ninja2/ninja/ninja2"); if (null == this.currentModel) { throw new InvalidOperationException("Cannot load 3D avatar model"); } effect = new SkinnedEffect(GraphicsDevice); effect.Texture = Game.Content.Load<Texture2D>("MODELS/ninja2/ninja/texture"); foreach (ModelMesh mesh in currentModel.Meshes) { foreach (ModelMeshPart part in mesh.MeshParts) { part.Effect = effect; } } this.animator.AvatarModel = this.currentModel; this.animator.AvatarHipCenterHeight = this.avatarHipCenterDrawHeight; this.BuildJointHierarchy(); base.LoadContent(); }
/// <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, 2, //115f, 230f, 650f ) ); _catalogLocation = guiDrawable.Count - 1; #endregion _guiDrawable = guiDrawable.ToArray(); _guiDrawableReplay = guiDrawableReplay.ToArray(); _guiDrawableSelect = guiDrawableSelect.ToArray(); _isInitialized = false; _isReplaying = false; }