Beispiel #1
0
        public static void Main(string[] args)
        {
            GameManager.LoadConfig("GameManagerConfig.xml");

            foreach (GameInfo g in GameManager.ListGames())
            {
            }


            Kinect.App app = new Kinect.App();
            app.InitializeComponent();
            app.Run();
        }
Beispiel #2
0
        public MainWindow()
        {
            InitializeComponent();

            kinect = KinectSensor.GetDefault();
            kinect.Open();

            var games = GameManager.ListGames();

            Console.WriteLine(games.Count);

            SelectedTitle.FontSize       = 45;
            SelectedTitle.Text           = "Welcome!";
            SelectedDescription.FontSize = 30;
            SelectedDescription.Text     = "Raise both hands to start. Press on a game to find out more info. Grip to scroll.";
            HighScores.Text = "";

            buttonsList = new List <GameButton>();
            numLoop     = 1;

            int row = 0;
            int col = 0;

            GameButton  about = new GameButton("About", "Original Group: \nField Session 1: \nField Session 2: \nIndependent Study: David Alexander, Chris Copper, Krista Horn, Jason Santilli", "");
            Image       i     = new Image();
            BitmapImage src   = new BitmapImage();

            src.BeginInit();
            src.UriSource   = new Uri("aboutPic.jpg", UriKind.Relative);
            src.CacheOption = BitmapCacheOption.OnLoad;
            src.EndInit();
            i.Source      = src;
            about.Content = i;

            // add about button
            Grid.SetRow(about, row);
            Grid.SetColumn(about, col);
            about.Margin = new Thickness(10, 10, 10, 10);
            // about.Content = about.Title;
            about.Click += new RoutedEventHandler(Special_MouseClick);
            this.MainGrid.Children.Add(about);
            col++;
            buttonsList.Add(about);

            foreach (GameInfo g in games)
            {
                //TODO: add new column definition when moving to new column
                if (col > 1)
                {
                    col = 0;
                    row++;
                }

                GameButton button = new GameButton(g.Title, g.Description, g.Path);

                Image       img    = new Image();
                BitmapImage source = new BitmapImage();
                source.BeginInit();
                // src.UriSource = new Uri("GameDir\\" + g.Title + "\\pic.jpg", UriKind.Relative);
                source.UriSource   = new Uri("GameDir/" + g.ImagePath, UriKind.Relative);
                source.CacheOption = BitmapCacheOption.OnLoad;
                source.EndInit();
                img.Source     = source;
                button.Content = img;



                // button.MouseEnter += new MouseEventHandler(Button_MouseEnter);
                button.Click += new RoutedEventHandler(Button_MouseClick);
                // add padding
                button.Margin = new Thickness(10, 10, 10, 10);

                //set the buttons position in the grid
                Grid.SetRow(button, row);
                Grid.SetColumn(button, col);
                col++;

                //add the button
                this.MainGrid.Children.Add(button);
                buttonsList.Add(button);
            }

            callCount = buttonsList.Count;

            /*this.bodies = new Body[this.kinect.BodyFrameSource.BodyCount];
             * this.reader = this.kinect.BodyFrameSource.OpenReader();*/



            reader = this.kinect.OpenMultiSourceFrameReader(FrameSourceTypes.Body);
            reader.MultiSourceFrameArrived += reader_MultiSourceFrameArrived;



            // timer with 2 minute intervals
            focusTimer = new System.Timers.Timer(120000);

            //event associated with elapsed time
            focusTimer.Elapsed += OnTimedEvent;
            focusTimer.Enabled  = true;
        }