Ejemplo n.º 1
0
        public Players(Game game, KinectTracker tracker)
            : base(game)
        {
            this.game = game;
            this.tracker = tracker;
            contentManager = new ContentManager(game.Services);

        }
Ejemplo n.º 2
0
        //private Rectangle Dest1, Dest2, Src1, Src2;


        public G2D_Bar(Game game, KinectTracker tracker, SpriteFont FontScore)
            : base(game)
        {
            // TODO: Construct any child components here
            this.game = game;
            this.tracker = tracker;
            this.FontScore = FontScore; 
        }
Ejemplo n.º 3
0
 public G2D_ScrollingBG(Game game, KinectTracker tracker, Texture2D my)
     : base(game)
 {
     // TODO: Construct any child components here
     this.game = game;
     this.my = my;
     this.tracker = tracker;
 }
        public G2D_Sprite_Explore2(Game game, KinectTracker tracker, Texture2D my, short col, short row)
            : base(game)
        {
            // TODO: Construct any child components here
            this.my = my;
            this.tracker = tracker;
            Point point = new Point();


            ICON_Size.X = my.Width / col;  // 每張小圖的寬
            ICON_Size.Y = my.Height / row;

            for (int i = 0; i < row; i++)  // i 往下走
                for (int j = 0; j < col; j++) // j 往右走
                {
                    point.X = j * ICON_Size.X;  // j 乘成上 小圖的寬
                    point.Y = i * ICON_Size.Y;  // i 乘成上 小圖的高
                    ICON_List.Add(point);
                }
            //Current_No = 0;  // 目前是第幾張小圖
        }
Ejemplo n.º 5
0
        public G2D_Sprite_Moving(Game game, KinectTracker tracker, MotionTracker motion, Texture2D my, short col, short row)
            : base(game)
        {
            // TODO: Construct any child components here
            this.game = game;
            this.my = my;
            this.tracker = tracker;
            this.motion = motion;

            Point point = new Point();

            ICON_Size.X = my.Width / col;  // 每張小圖的寬
            ICON_Size.Y = my.Height / row;

            for (int i = 0; i < row; i++)  // i 往下走
                for (int j = 0; j < col; j++) // j 往右走
                {
                    point.X = j * ICON_Size.X;  // j 乘成上 小圖的寬
                    point.Y = i * ICON_Size.Y;  // i 乘成上 小圖的高
                    ICON_List.Add(point);
                }
        }
Ejemplo n.º 6
0
 public Paddle(Game game, KinectTracker tracker)
     : base(game)
 {
     contentManager = new ContentManager(game.Services);
     this.tracker = tracker;
 }
Ejemplo n.º 7
0
        G2D_Bar bar2D; // 宣告一個長條圖物件

        //G2D_Sprite_Bullet bullet; // 宣告一個物件
        //Texture2D myBullet; // 宣告一個2D紋理圖
        //KeyboardState oldKey;
        //List<G2D_Sprite_Bullet> bulletList = new List<G2D_Sprite_Bullet>(); // 紀錄子彈的動態陣列

        //G2D_Sprite_Explore2 myExplore2;
        //end

        public GamePong()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            tracker = new KinectTracker();
            player = new Players(this, tracker);
            ball = new Ball(this, tracker);
            paddle = new Paddle(this, tracker);
            motion = new MotionTracker(this, tracker, player); //motion detect and draw


            Components.Add(ball);
            Components.Add(paddle);
            //Components.Add(player);
            //Components.Add(motion);

            ball.CollisionSquare = paddle;

            //box2d1 = new Drawbar(this);
            //box2d2 = new Drawbar(this);

            //Components.Add(box2d1);
            //Components.Add(box2d2);


            //Player


            this.IsMouseVisible = true;
            this.Window.AllowUserResizing = true;

            // Call Window_ClientSizeChanged when screen size is changed
            Window.AllowUserResizing = true;
            Window.ClientSizeChanged += new EventHandler<EventArgs>(Window_ClientSizeChanged);


            //Kinect
            tracker.GamingState = KinectTracker.GamingStates.KinectPaddleBall;
            if (!tracker.isKinectDeviceReady)
            {
                tracker.GamingState = KinectTracker.GamingStates.PaddleBall;
                //Show Error Dialog
                Button btnOK = new Button();
                btnOK.Text = "Please check Kinect!!";
                btnOK.Width = 100; btnOK.Height = 60;
                btnOK.Left = 50;  btnOK.Top=50;

                System.Windows.Forms.Form winForm = new System.Windows.Forms.Form();
                winForm.Text = "Kinect device error!";
                winForm.Controls.Add(btnOK);
                winForm.ShowDialog();
                //Environment.Exit(-1);
            }
        }