/// <summary>
        /// Game initialization.
        /// </summary>
        void InitGame()
        {
            player1 = new Player(new Orientation(2), new Vector2(10f, 119f), new Vector2(11f, 119f));
            player2 = new Player(new Orientation(0), new Vector2(228f, 119f), new Vector2(227f, 119f));

            for (int i = 0; i < field_dim; ++i)
            {
                field[0, i] = (byte)FieldVals.border;
                field[field_dim - 1, i] = (byte)FieldVals.border;
                field[i, 0] = (byte)FieldVals.border;
                field[i, field_dim - 1] = (byte)FieldVals.border;
            }
        }
 void UpdatePlayerPosition(Player pla)
 {
     if (pla.playerDirection.X >= 0 && pla.playerDirection.X < 240 && pla.playerDirection.Y >= 0 &&
             pla.playerDirection.Y < 240)
     {
         pla.playerPosition.X = pla.playerDirection.X;
         pla.playerPosition.Y = pla.playerDirection.Y;
     }
     byte num = 1;
     if (pla == player1)
     {
         num = 1;
     }
     else if (pla == player2)
     {
         num = 2;
     }
     field[(int)pla.playerPosition.X, (int)pla.playerPosition.Y] = num;
 }
 bool ChangePlayerOrientation(Player player)
 {
     if (player.playerDirection.X < 0 || player.playerDirection.X >= field_dim ||
         player.playerDirection.Y < 0 || player.playerDirection.Y >= field_dim)
     {
         return true;
     }
     switch (player.Orientation.GetOrientation())
     {
         // Note that pixel position counts from upper left corner of the screen
         case 0: player.playerDirection.X--; break;
         case 1: player.playerDirection.Y--; break;
         case 2: player.playerDirection.X++; break;
         case 3: player.playerDirection.Y++; break;
     }
     return false;
 }