private void collisionOccured(TouchTarget.State state, String s)
		{
			if (state == TouchTarget.State.enter)
			{
				this.player.Play();
				this.input.enter(s);
			}
		}
		/// <summary>
		/// Initializes a new instance of the MainWindow class.
		/// </summary>
		public MainWindow()
		{
			InitializeComponent();

			this.timer = new Stopwatch();
			this.timer.Start();
			this.lastT = timer.ElapsedMilliseconds;
			this.deltaT = 0;

			/* //round layout
			this.bongoABC = new TouchTarget(20, 50, 80, 80, (ImageSource)FindResource("Bongo"), "ABC");
			this.bongoDEF = new TouchTarget(20, 150, 80, 80, (ImageSource)FindResource("Bongo"), "DEF");
			this.bongoGHI = new TouchTarget(50, 250, 80, 80, (ImageSource)FindResource("Bongo"), "GHI");
			this.bongoJKL = new TouchTarget(150, 300, 80, 80, (ImageSource)FindResource("Bongo"), "JKL");
			this.bongoMNO = new TouchTarget(250, 300, 80, 80, (ImageSource)FindResource("Bongo"), "MNO");
			this.bongoPQRS = new TouchTarget(350, 300, 80, 80, (ImageSource)FindResource("Bongo"), "PQRS");
			this.bongoTUV = new TouchTarget(450, 250, 80, 80, (ImageSource)FindResource("Bongo"), "TUV");
			this.bongoWXYZ = new TouchTarget(480, 150, 80, 80, (ImageSource)FindResource("Bongo"), "WXYZ");
			this.bongoSpace = new TouchTarget(480, 50, 80, 80, (ImageSource)FindResource("Bongo"), "_");
			this.bongoBackSpace = new TouchTarget(250, 0, 80, 80, (ImageSource)FindResource("Bongo"), "");
			*/
			
			// mostly straight
			/*
			this.bongoABC = new TouchTarget(0, 270, 80, 80, (ImageSource)FindResource("Bongo"), "ABC");
			this.bongoDEF = new TouchTarget(100, 335, 50, 50, (ImageSource)FindResource("Bongo"), "DEF");
			this.bongoGHI = new TouchTarget(180, 345, 50, 50, (ImageSource)FindResource("Bongo"), "GHI");
			this.bongoJKL = new TouchTarget(260, 350, 50, 50, (ImageSource)FindResource("Bongo"), "JKL");
			this.bongoMNO = new TouchTarget(340, 350, 50, 50, (ImageSource)FindResource("Bongo"), "MNO");
			this.bongoPQRS = new TouchTarget(420, 345, 50, 50, (ImageSource)FindResource("Bongo"), "PQRS");
			this.bongoTUV = new TouchTarget(500, 335, 50, 50, (ImageSource)FindResource("Bongo"), "TUV");
			this.bongoWXYZ = new TouchTarget(570, 270, 80, 80, (ImageSource)FindResource("Bongo"), "WXYZ");
			this.bongoSpace = new TouchTarget(200, -100, 250, 250, (ImageSource)FindResource("Bongo"), "_");
			this.bongoBackSpace = new TouchTarget(550, 50, 80, 80, (ImageSource)FindResource("Bongo"), "");
			 */

			this.bongoABC = new TouchTarget(0, 268, 94, 91, (ImageSource)FindResource("BongoABC"), "ABC", 70, -30);
			this.bongoDEF = new TouchTarget(65, 325, 90, 102, (ImageSource)FindResource("BongoDEF"), "DEF", 60, -50);
			this.bongoGHI = new TouchTarget(155, 352, 82, 98, (ImageSource)FindResource("BongoGHI"), "GHI", 35, -45);
			this.bongoJKL = new TouchTarget(242, 362, 76, 90, (ImageSource)FindResource("BongoJKL"), "JKL", 30, -50);
			this.bongoMNO = new TouchTarget(322, 359, 78, 93, (ImageSource)FindResource("BongoMNO"), "MNO", 27, -50);
			this.bongoPQRS = new TouchTarget(402, 349, 80, 95, (ImageSource)FindResource("BongoPQRS"), "PQRS", 25, -50);
			this.bongoTUV = new TouchTarget(478, 316, 92, 98, (ImageSource)FindResource("BongoTUV"), "TUV", 20, -50);
			this.bongoWXYZ = new TouchTarget(536, 259, 101, 95, (ImageSource)FindResource("BongoWXYZ"), "WXYZ", -15, -25);
			this.bongoSpace = new TouchTarget(4, 6, 129, 123, (ImageSource)FindResource("BongoSpace"), "_", 0, 0);
			this.bongoBackSpace = new TouchTarget(498, 7, 131, 117, (ImageSource)FindResource("BongoBackspace"), "", 0, 0);

			// offset hitboxes a little
			this.bongoABC.CX -= 3;
			this.bongoABC.CY -= 4;
			this.bongoDEF.CX += 5;
			this.bongoDEF.CY -= 6;
			this.bongoGHI.CX += 4;
			this.bongoGHI.CY -= 8;
			this.bongoJKL.CX += 1;
			this.bongoJKL.CY -= 10;
			this.bongoMNO.CX += 1;
			this.bongoMNO.CY -= 10;
			this.bongoPQRS.CX -= 1;
			this.bongoPQRS.CY -= 8;
			this.bongoTUV.CX -= 3;
			this.bongoTUV.CY -= 3;

			this.head = new Sprite((ImageSource)FindResource("Head"));
			this.monkey = new Sprite((ImageSource)FindResource("Monkey"));
			this.leftHand = new Sprite((ImageSource)TryFindResource("Fist"));
			this.rightHand = new Sprite((ImageSource)TryFindResource("Fist"));
			this.limb = new Sprite((ImageSource)TryFindResource("Limb"), 20, 100);
			this.limb.Width = 80;

			this.torso = new Sprite((ImageSource)TryFindResource("Limb"));
			this.torso.Width = 140;
		
			this.background = (ImageSource)TryFindResource("Background");


			this.targets = new List<TouchTarget>();
			targets.Add(this.bongoABC);
			targets.Add(this.bongoDEF);
			targets.Add(this.bongoGHI);
			targets.Add(this.bongoJKL);
			targets.Add(this.bongoMNO);
			targets.Add(this.bongoPQRS);
			targets.Add(this.bongoTUV);
			targets.Add(this.bongoWXYZ);
			targets.Add(this.bongoSpace);
			targets.Add(this.bongoBackSpace);
			
			foreach (TouchTarget target in this.targets)
			{
				target.registerCollisionCallback(this.collisionOccured);
			}

			this.input = new InputMachine();
			this.input.registerAddCharacterCallback(this.addCharacter);
			this.input.registerDeleteCallback(this.deleteCharacter);
			this.input.registerSelectionCallback(this.selectionChanged);

			this.player = new SoundPlayer();
			this.player.Stream = Properties.Resources.boing;

		}