public MainPage() { InitializeComponent(); Loaded += MainPage_Loaded; MasterViewModel = new ViewModel(); var sharedSettings = new ValueSet(); GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) => { var gazePointer = GazeInput.GetGazePointer(this); gazePointer.LoadSettings(sharedSettings); }); ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen; SetPageMode(PageMode.Run); _speechSynthesizer = new SpeechSynthesizer(); _mediaElement = new MediaElement(); _backgroundBrush = new SolidColorBrush(Colors.Gray); _foregroundBrush = new SolidColorBrush(Colors.Blue); _transparentBrush = new SolidColorBrush(Colors.Transparent); _dwellProgressBrush = (SolidColorBrush)GazeInput.DwellFeedbackProgressBrush; gazePointer = GazeInput.GetGazePointer(null); Window.Current.CoreWindow.KeyDown += CoreWindow_KeyDown; }
public MainPage() { this.InitializeComponent(); _numRows = MIN_ROWS; _mazeRunner = new Image { Source = new BitmapImage(new Uri(this.BaseUri, "/Assets/luna.png")), VerticalAlignment = VerticalAlignment.Center }; _mazeEnd = new Image { Source = new BitmapImage(new Uri(this.BaseUri, "/Assets/doghouse.png")), VerticalAlignment = VerticalAlignment.Center }; _mazeComplete = new Image { Source = new BitmapImage(new Uri(this.BaseUri, "/Assets/dogInHouse.png")), VerticalAlignment = VerticalAlignment.Center }; _newSolidBorderThickness = new Thickness(_borderThickness); _newButtonStyle = (Style)this.Resources["MazeCellStyle"]; _mazeCreator = Creator.GetCreator(); _solutionTimer = new DispatcherTimer(); _solutionTimer.Interval = TimeSpan.FromSeconds(0.1); _solutionTimer.Tick += OnSolutionTimerTick; _cellCreationTimer = new DispatcherTimer(); _cellCreationTimer.Interval = TimeSpan.FromMilliseconds(50); _cellCreationTimer.Tick += OnCellCreationTimer_Tick; _openCellTimer = new DispatcherTimer(); _openCellTimer.Interval = TimeSpan.FromMilliseconds(50); _openCellTimer.Tick += OnOpenCellTimer_Tick; _mazeCells = new List <Point>(); _breadCrumbs = new List <Point>(); Loaded += MainPage_Loaded; CoreWindow.GetForCurrentThread().KeyDown += new Windows.Foundation.TypedEventHandler <CoreWindow, KeyEventArgs>(delegate(CoreWindow sender, KeyEventArgs args) { GazeInput.GetGazePointer(this).Click(); }); var sharedSettings = new ValueSet(); GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) => { GazeInput.LoadSettings(sharedSettings); }); }
public GamePage() { InitializeComponent(); var sharedSettings = new ValueSet(); GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) => { var gazePointer = GazeInput.GetGazePointer(this); gazePointer.LoadSettings(sharedSettings); }); Loaded += GamePage_Loaded; }
public MainPage() { InitializeComponent(); CoreWindow.GetForCurrentThread().KeyDown += new Windows.Foundation.TypedEventHandler <CoreWindow, KeyEventArgs>(delegate(CoreWindow sender, KeyEventArgs args) { GazeInput.GetGazePointer(this).Click(); }); var sharedSettings = new ValueSet(); GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) => { GazeInput.LoadSettings(sharedSettings); }); }
public StartPage() { this.InitializeComponent(); App.ScreenWidth = Window.Current.Bounds.Width; App.ScreenHeight = Window.Current.Bounds.Height; Windows.UI.Core.CoreWindow.GetForCurrentThread().KeyDown += new Windows.Foundation.TypedEventHandler <Windows.UI.Core.CoreWindow, Windows.UI.Core.KeyEventArgs>(delegate(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args) { GazeInput.GetGazePointer(this).Click(); }); var sharedSettings = new ValueSet(); GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) => { GazeInput.LoadSettings(sharedSettings); }); }
public MainPage() { InitializeComponent(); ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen; VersionTextBlock.Text = GetAppVersion(); CoreWindow.GetForCurrentThread().KeyDown += new Windows.Foundation.TypedEventHandler<CoreWindow, KeyEventArgs>(delegate (CoreWindow sender, KeyEventArgs args) { GazeInput.GetGazePointer(this).Click(); }); var sharedSettings = new ValueSet(); GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) => { GazeInput.LoadSettings(sharedSettings); }); }
public GamePage() { InitializeComponent(); _rnd = new Random(); _flashTimer = new DispatcherTimer(); _flashTimer.Interval = new TimeSpan(0, 0, 2); _flashTimer.Tick += OnFlashTimerTick; _usePictures = false; Loaded += MainPage_Loaded; var sharedSettings = new ValueSet(); GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) => { var gazePointer = GazeInput.GetGazePointer(this); gazePointer.LoadSettings(sharedSettings); }); }
public GamePage() { InitializeComponent(); _solidTileBrush = (SolidColorBrush)this.Resources["TileBackground"]; _toolButtonBrush = (SolidColorBrush)this.Resources["ToolBarButtonBackground"]; WaitForCompositionTimer = new DispatcherTimer(); WaitForCompositionTimer.Tick += WaitForCompositionTimer_Tick; WaitForCompositionTimer.Interval = TimeSpan.FromMilliseconds(50); var sharedSettings = new ValueSet(); GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) => { var gazePointer = GazeInput.GetGazePointer(this); gazePointer.LoadSettings(sharedSettings); }); Loaded += GamePage_Loaded; }
public GamePage() { this.InitializeComponent(); Windows.UI.Core.CoreWindow.GetForCurrentThread().KeyDown += new Windows.Foundation.TypedEventHandler <Windows.UI.Core.CoreWindow, Windows.UI.Core.KeyEventArgs>(delegate(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args) { GazeInput.GetGazePointer(this).Click(); }); var sharedSettings = new ValueSet(); GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) => { GazeInput.LoadSettings(sharedSettings); }); Loaded += (sender, args) => { timer.Tick += OnTick; fireDamageTimer.Tick += OnFireDamage; disasterTimer.Tick += OnDisasterTick; timer.Interval = new TimeSpan(600000); fireDamageTimer.Interval = new TimeSpan(28800000); disasterTimer.Interval = new TimeSpan(14400000); timer.Start(); fireDamageTimer.Start(); disasterTimer.Start(); }; /* * BaseEntity staticFire = new Fire(); * staticFire.sprite.Margin = new Thickness(256, 256, 0, 0); * Canvas.SetZIndex(staticFire.sprite, 7); * GameSpace.Children.Add(staticFire.sprite); //ADDING THE ENTITY'S XAML ELEMENT TO THE SCREEN * // int index = GameSpace.Children.IndexOf(staticFire.sprite); * entityManager.Add(staticFire); */ CompositionTarget.Rendering += GameLoop; }
public MainPage() { InitializeComponent(); ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen; _solidTileBrush = (SolidColorBrush)this.Resources["TileBackground"]; VersionTextBlock.Text = GetAppVersion(); CoreWindow.GetForCurrentThread().KeyDown += new Windows.Foundation.TypedEventHandler <CoreWindow, KeyEventArgs>(delegate(CoreWindow sender, KeyEventArgs args) { GazeInput.GetGazePointer(this).Click(); }); var sharedSettings = new ValueSet(); GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) => { GazeInput.LoadSettings(sharedSettings); }); GazeInput.DwellFeedbackProgressBrush = new SolidColorBrush(Colors.White); GazeInput.DwellFeedbackCompleteBrush = new SolidColorBrush(Colors.Transparent); }
public GamePage() { InitializeComponent(); _solidTileBrush = (SolidColorBrush)this.Resources["TileBackground"]; _toolButtonBrush = (SolidColorBrush)this.Resources["ToolBarButtonBackground"]; GazeInput.DwellFeedbackCompleteBrush = new SolidColorBrush(Colors.Transparent); _rnd = new Random(); _flashTimer = new DispatcherTimer(); _flashTimer.Interval = new TimeSpan(0, 0, 1); _flashTimer.Tick += OnFlashTimerTick; _usePictures = false; Loaded += MainPage_Loaded; var sharedSettings = new ValueSet(); GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) => { var gazePointer = GazeInput.GetGazePointer(this); gazePointer.LoadSettings(sharedSettings); }); }
public GamePage() { this.InitializeComponent(); // Set up Gaze interaction Windows.UI.Core.CoreWindow.GetForCurrentThread().KeyDown += new Windows.Foundation.TypedEventHandler <Windows.UI.Core.CoreWindow, Windows.UI.Core.KeyEventArgs>(delegate(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args) { GazeInput.GetGazePointer(this).Click(); }); var sharedSettings = new ValueSet(); GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) => { GazeInput.LoadSettings(sharedSettings); }); Game1.myGamePage = this; // Create the game. var launchArguments = string.Empty; _game = MonoGame.Framework.XamlGame <Game1> .Create(launchArguments, Window.Current.CoreWindow, swapChainPanel); swapChainPanel.Height = Game1.screenHeight; GameSpace.Height = Game1.screenHeight; swapChainPanel.Width = Game1.screenWidth; GameSpace.Width = Game1.screenWidth; swapChainPanel.Margin = new Thickness(0, 0, 0, 0); GameSpace.Margin = new Thickness(0, 0, 0, 0); Canvas.SetZIndex(GameSpace, 7); // Create the pause button Button pauseButton = new Button(); pauseButton.Content = "Pause Game"; pauseButton.FontFamily = new FontFamily("Old English Text MT"); pauseButton.FontSize = 48; double buttonWidthFactor = 0.2; double buttonHeightFactor = 0.2; pauseButton.Height = (int)(buttonHeightFactor * (double)Game1.screenHeight); pauseButton.Width = (int)(buttonWidthFactor * (double)Game1.screenWidth); Thickness buttonMargin = new Thickness(); buttonMargin.Top = Game1.screenHeight - pauseButton.Height; buttonMargin.Left = (Game1.screenWidth * .5) - (pauseButton.Width * .5); pauseButton.Margin = buttonMargin; pauseButton.Click += PauseButton_Click; GameSpace.Children.Add(pauseButton); //Define the village button Village.Height = 256; Village.Width = 256; Thickness villageMargin = new Thickness(); villageMargin.Top = Game1.screenHeight / 2 - Village.Height / 2; villageMargin.Left = Game1.screenWidth / 2 - Village.Width / 2; Village.Margin = villageMargin; //Create the health box healthblock.Height = 80; healthblock.Width = 142; healthblock.FontSize = 72; healthblock.FontFamily = new FontFamily("Old English Text MT"); healthblock.FontWeight = Windows.UI.Text.FontWeights.Bold; healthblock.Visibility = Visibility.Collapsed; //get the village entity var villageEntity = Game1._world.GetEntity(Game1.VillageID); var villageHealth = villageEntity.Get <HealthComponent>(); var villageLocation = villageEntity.Get <PositionComponent>(); //set the text of healthblock to villageHealth healthblock.Text = villageHealth.Health.ToString(); //set the position of the health block to above the village Thickness healthMargin = new Thickness(); healthMargin.Top = Game1.screenHeight / 2 - Village.Height * .80; healthMargin.Left = Game1.screenWidth / 2 - Village.Width * .18; healthblock.Margin = healthMargin; healthblock.HorizontalAlignment = HorizontalAlignment.Center; healthblock.VerticalAlignment = VerticalAlignment.Center; GameSpace.Children.Add(healthblock); // Calculate the portion of fireGrid occupied by the pause button here int buttonXPos = (int)buttonMargin.Left; int buttonYPos = (int)buttonMargin.Top; int buttonMaxXPos = buttonXPos + (int)pauseButton.Width; int buttonMaxYPos = buttonYPos + (int)pauseButton.Height; int fireGridX; int fireGridY; int spriteWidth = Game1.SpriteDict["fire"].texture.Width; int spriteHeight = Game1.SpriteDict["fire"].texture.Height; while (buttonXPos <= buttonMaxXPos) { while (buttonYPos <= buttonMaxYPos) { fireGridX = (buttonXPos - (buttonXPos % spriteWidth)) / spriteWidth; fireGridY = (buttonYPos - (buttonYPos % spriteHeight)) / spriteHeight; fireGridX -= 1; fireGridY -= 1; Game1.fireGrid[fireGridX, fireGridY] = 1; buttonYPos += Game1.SpriteDict["fire"].texture.Height; } buttonYPos = (int)buttonMargin.Top; buttonXPos += Game1.SpriteDict["fire"].texture.Width; } }
public MainPage() { this.InitializeComponent(); ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen; VersionTextBlock.Text = GetAppVersion(); GazeInput.DwellFeedbackCompleteBrush = new SolidColorBrush(Colors.Transparent); _compositor = ElementCompositionPreview.GetElementVisual(this).Compositor; LoadedImageSurface loadedSurface = LoadedImageSurface.StartLoadFromUri(new Uri("ms-appx:///Assets/BorderDot.png"), new Size(_cellSize, _cellSize)); _breadCrumbBrush = _compositor.CreateSurfaceBrush(); _breadCrumbBrush.Surface = loadedSurface; _numRows = MIN_ROWS; _mazeRunner = new Image { Source = new BitmapImage(new Uri(this.BaseUri, "/Assets/luna.png")), VerticalAlignment = VerticalAlignment.Center }; _mazeEnd = new Image { Source = new BitmapImage(new Uri(this.BaseUri, "/Assets/doghouse.png")), VerticalAlignment = VerticalAlignment.Center }; _mazeComplete = new Image { Source = new BitmapImage(new Uri(this.BaseUri, "/Assets/dogInHouse.png")), VerticalAlignment = VerticalAlignment.Center }; _newSolidBorderThickness = new Thickness(_borderThickness); _newButtonStyle = (Style)this.Resources["MazeCellStyle"]; _mazeCreator = Creator.GetCreator(); _solutionTimer = new DispatcherTimer(); _solutionTimer.Interval = TimeSpan.FromSeconds(0.1); _solutionTimer.Tick += OnSolutionTimerTick; _cellCreationTimer = new DispatcherTimer(); _cellCreationTimer.Interval = TimeSpan.FromMilliseconds(50); _cellCreationTimer.Tick += OnCellCreationTimer_Tick; _openCellTimer = new DispatcherTimer(); _openCellTimer.Interval = TimeSpan.FromMilliseconds(50); _openCellTimer.Tick += OnOpenCellTimer_Tick; _mazeCells = new List <Point>(); _breadCrumbs = new List <Point>(); Loaded += MainPage_Loaded; CoreWindow.GetForCurrentThread().KeyDown += new Windows.Foundation.TypedEventHandler <CoreWindow, KeyEventArgs>(delegate(CoreWindow sender, KeyEventArgs args) { GazeInput.GetGazePointer(this).Click(); }); var sharedSettings = new ValueSet(); GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) => { GazeInput.LoadSettings(sharedSettings); }); }
public GamePage() { this.InitializeComponent(); // Set up Gaze interaction Windows.UI.Core.CoreWindow.GetForCurrentThread().KeyDown += new Windows.Foundation.TypedEventHandler <Windows.UI.Core.CoreWindow, Windows.UI.Core.KeyEventArgs>(delegate(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args) { GazeInput.GetGazePointer(this).Click(); }); var sharedSettings = new ValueSet(); GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) => { GazeInput.LoadSettings(sharedSettings); }); Game1.myGamePage = this; // Create the game. var launchArguments = string.Empty; _game = MonoGame.Framework.XamlGame <Game1> .Create(launchArguments, Window.Current.CoreWindow, swapChainPanel); swapChainPanel.Height = ApplicationView.GetForCurrentView().VisibleBounds.Height; GameSpace.Height = ApplicationView.GetForCurrentView().VisibleBounds.Height; swapChainPanel.Width = ApplicationView.GetForCurrentView().VisibleBounds.Width; GameSpace.Width = ApplicationView.GetForCurrentView().VisibleBounds.Width; swapChainPanel.Margin = new Thickness(0, 0, 0, 0); GameSpace.Margin = new Thickness(0, 0, 0, 0); Canvas.SetZIndex(GameSpace, 7); // Create the pause button pauseButton.Content = "Pause Game"; pauseButton.FontFamily = new FontFamily("Castellar"); pauseButton.FontSize = 48 / display.RawPixelsPerViewPixel; double buttonWidthFactor = 0.2; double buttonHeightFactor = 0.15; pauseButton.Height = (int)(buttonHeightFactor * GameSpace.Height); pauseButton.Width = (int)(buttonWidthFactor * GameSpace.Width); Thickness buttonMargin = new Thickness(); buttonMargin.Top = GameSpace.Height - pauseButton.Height * 1.25; buttonMargin.Left = (GameSpace.Width * .5) - (pauseButton.Width * .5); pauseButton.Margin = buttonMargin; pauseButton.Click += PauseButton_Click; // Define unpause and exit buttons resumeButton.Content = "Resume Game"; exitButton.Content = "Exit Game"; resumeButton.FontFamily = new FontFamily("Castellar"); exitButton.FontFamily = new FontFamily("Castellar"); resumeButton.FontSize = 45 / display.RawPixelsPerViewPixel; exitButton.FontSize = 45 / display.RawPixelsPerViewPixel; resumeButton.Height = (int)(buttonHeightFactor * GameSpace.Height); resumeButton.Width = (int)(buttonWidthFactor * GameSpace.Width); exitButton.Height = (int)(buttonHeightFactor * GameSpace.Height); exitButton.Width = (int)(buttonWidthFactor * GameSpace.Width); Thickness restartMargin = new Thickness(GameSpace.Width * .33 - (resumeButton.Width * .5), GameSpace.Height - resumeButton.Height * 1.25, 0, 0); Thickness exitMargin = new Thickness(GameSpace.Width * .66 - (exitButton.Width * .5), GameSpace.Height - exitButton.Height * 1.25, 0, 0); resumeButton.Margin = restartMargin; exitButton.Margin = exitMargin; resumeButton.Click += ResumeButton_Click; exitButton.Click += ExitButton_Click; resumeButton.Visibility = Visibility.Collapsed; exitButton.Visibility = Visibility.Collapsed; //Define the village button Village.Height = 256 / display.RawPixelsPerViewPixel; Village.Width = 256 / display.RawPixelsPerViewPixel; Thickness villageMargin = new Thickness(); villageMargin.Top = GameSpace.Height / 2 - Village.Height / 2; villageMargin.Left = GameSpace.Width / 2 - Village.Width / 2; Village.Margin = villageMargin; //Create the health box healthblock.Height = 50 / display.RawPixelsPerViewPixel; healthblock.Width = Village.Width; healthblock.Opacity = 80; healthblock.Visibility = Visibility.Collapsed; //get the village entity var villageEntity = Game1._world.GetEntity(Game1.VillageID); var villageHealth = villageEntity.Get <HealthComponent>(); var villageLocation = villageEntity.Get <PositionComponent>(); //set the text of healthblock to villageHealth healthblock.Value = villageHealth.Health; //set the position of the health block to above the village Thickness healthMargin = new Thickness(); healthMargin.Top = GameSpace.Height / 2 - Village.Height + (healthblock.Height * 2); healthMargin.Left = GameSpace.Width / 2 - Village.Width / 2; healthblock.Margin = healthMargin; healthblock.HorizontalAlignment = HorizontalAlignment.Center; healthblock.VerticalAlignment = VerticalAlignment.Center; // Calculate the portion of fireGrid occupied by the pause button here int buttonXPos = (int)buttonMargin.Left; int buttonYPos = (int)buttonMargin.Top; int buttonMaxXPos = buttonXPos + (int)pauseButton.Width; int buttonMaxYPos = buttonYPos + (int)pauseButton.Height; int fireGridX; int fireGridY; int spriteWidth = Game1.SpriteDict["fire_1"].texture.Width; int spriteHeight = Game1.SpriteDict["fire_1"].texture.Height; while (buttonXPos <= buttonMaxXPos) { while (buttonYPos <= buttonMaxYPos) { fireGridX = (buttonXPos - (buttonXPos % spriteWidth)) / spriteWidth; fireGridY = (buttonYPos - (buttonYPos % spriteHeight)) / spriteHeight; fireGridX -= 1; fireGridY -= 1; Game1.fireGrid[fireGridX, fireGridY] = 1; buttonYPos += Game1.SpriteDict["fire_1"].texture.Height; } buttonYPos = (int)buttonMargin.Top; buttonXPos += Game1.SpriteDict["fire_1"].texture.Width; } ApplicationView view = ApplicationView.GetForCurrentView(); view.TryEnterFullScreenMode(); }