Last active
November 24, 2015 21:20
-
-
Save ertugrulozcan/d48b4a046fc17eafcfba to your computer and use it in GitHub Desktop.
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
using Snake.Components; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Runtime.InteropServices.WindowsRuntime; | |
using Windows.Foundation; | |
using Windows.Foundation.Collections; | |
using Windows.UI.Xaml; | |
using Windows.UI.Xaml.Controls; | |
using Windows.UI.Xaml.Controls.Primitives; | |
using Windows.UI.Xaml.Data; | |
using Windows.UI.Xaml.Input; | |
using Windows.UI.Xaml.Media; | |
using Windows.UI.Xaml.Navigation; | |
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=391641 | |
namespace Snake | |
{ | |
/// <summary> | |
/// An empty page that can be used on its own or navigated to within a Frame. | |
/// </summary> | |
public sealed partial class GamePage : Page | |
{ | |
/// <summary> | |
/// Satır - Sütun sayıları | |
/// </summary> | |
private readonly int ROW_COUNT = 40; | |
private readonly int COLUMN_COUNT = 24; | |
private Pixel[,] Pixels; | |
/// <summary> | |
/// Constructor | |
/// </summary> | |
public GamePage() | |
{ | |
this.InitializeComponent(); | |
this.NavigationCacheMode = NavigationCacheMode.Required; | |
} | |
/// <summary> | |
/// OnNavigatedTo Metodu | |
/// </summary> | |
protected override void OnNavigatedTo(NavigationEventArgs e) | |
{ | |
this.InitializePixels(); | |
} | |
private void InitializePixels() | |
{ | |
this.Pixels = new Pixel[ROW_COUNT, COLUMN_COUNT]; | |
for(int row = 0; row < ROW_COUNT; row++) | |
{ | |
for (int column = 0; column < COLUMN_COUNT; column++) | |
{ | |
this.Pixels[row, column] = new Pixel(); | |
this.MainGrid.Children.Add(this.Pixels[row, column]); | |
Grid.SetRow(this.Pixels[row, column], row); | |
Grid.SetColumn(this.Pixels[row, column], column); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment