This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AppEvent | |
{ | |
public long Id { get; set; } | |
public string Name { get; set; } | |
public DateTime CreationDate { get; set; } | |
public string Data { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Game1 : Game | |
{ | |
GraphicsDeviceManager graphics; | |
SpriteBatch spriteBatch; | |
public Game1() | |
{ | |
graphics = new GraphicsDeviceManager(this); | |
Content.RootDirectory = "Content"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void LoadContent() | |
{ | |
// Create a new SpriteBatch, which can be used to draw textures. | |
_spriteBatch = new SpriteBatch(GraphicsDevice); | |
// TODO: use this.Content to load your game content here | |
_pixeltexture = Content.Load<Texture2D>("pixel.png"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void Update(GameTime gameTime) | |
{ | |
_player1.Update(gameTime); | |
_player2.Update(gameTime); | |
base.Update(gameTime); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void Draw(GameTime gameTime) | |
{ | |
GraphicsDevice.Clear(Color.CornflowerBlue); | |
_spriteBatch.Begin(); | |
_player1.Draw(_spriteBatch); | |
_player2.Draw(_spriteBatch); | |
_spriteBatch.End(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ScoreViewModel : BaseViewModel, IScoreViewModel | |
{ | |
#region Properties | |
private static IScoreViewModel _instance; | |
public static IScoreViewModel Instance { get { return _instance ?? (_instance = new ScoreViewModel()); } } | |
private float _distanceMax; | |
public float DistanceMax | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public GamePage(LaunchActivatedEventArgs args) | |
{ | |
InitializeComponent(); | |
// Add the data context | |
DataContext = ScoreViewModel.Instance; | |
// Create the game. | |
_game = XamlGame<Game1>.Create(args, Window.Current.CoreWindow, this); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Grid> | |
<StackPanel Margin="30 30 0 0"> | |
<TextBlock FontSize="42"> | |
<Run Text="Max distance :" /> | |
<Run Text="{Binding Path=DistanceMax, Converter={StaticResource StringToIntegerConverter}}"/> | |
</TextBlock> | |
<TextBlock FontSize="42"> | |
<Run Text="Dodging point :" /> | |
<Run Text="{Binding Path=BallPoints, Converter={StaticResource StringToIntegerConverter}}"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void Update(GameTime gameTime) | |
{ | |
// add points if a projectile is out of screen | |
foreach (var activeProjectile in activeProjectiles) | |
{ | |
if (activeProjectile.Position.Y > ScreenHeight) | |
{ | |
ScoreViewModel.Instance.BallPoints++; | |
activeProjectile.Deactivate(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Grid> | |
<Grid.RowDefinitions> | |
<RowDefinition Height="60"/> | |
<RowDefinition Height="Auto" /> | |
<RowDefinition Height="30"/> | |
<RowDefinition Height="*"/> | |
</Grid.RowDefinitions> | |
<!-- the title block --> | |
<Grid Background="#FF5E58C7"> |
OlderNewer