示例#1
0
文件: Game.cs 项目: jairov4/WingZero
		/// <summary>
		/// Allows the game to perform any initialization it needs to before starting to run.
		/// This is where it can query for any required services and load any non-graphic
		/// related content.  Calling base.Initialize will enumerate through any components
		/// and initialize them as well.
		/// </summary>
		protected override void Initialize()
		{			
			// Setup main world matrix
			world = Matrix.CreateRotationX(-MathHelper.PiOver2);

			// Setup camera
			Camera = new Camera();
			Camera.Position = new Vector3(0.0f, 15.0f, 100.0f);
			Camera.Forward = new Vector3(0, 0, -1);

			// Setup Robot
			robot = new Robot();			

			// Setup TrajectoryController
			InverseKinematicsSolver iks = new InverseKinematicsSolver(robot, new Vector3()) { MaxBruteForceIterations = 0, MaxIterations = 200 };
			InverseKinematicsSolver hardiks = new InverseKinematicsSolver(robot, new Vector3()) { MaxBruteForceIterations = 10, MaxIterations = 100 };

			trajectory = new TrajectoryController(this, robot, iks);
			trajectory.Enabled = false;
			Components.Add(trajectory);

			// TODO Test if jostick is present to try enable
			//joystick = new JoystickController(this, robot, iks, hardiks);
			//joystick.Enabled = true;
			//Components.Add(joystick);

			hardware = new HardwareInterfaceController(this, robot);			
			Components.Add(hardware);

			// Creates the UI
			MainForm mainfrm = new MainForm();
			mainfrm.SetRobotEdit(robot, Content);
			mainfrm.SetTrajectoryController(trajectory);
			mainfrm.SetJoystickController(joystick);
			mainfrm.SetHardwareInterfaceController(hardware);
			mainfrm.Show();

			base.Initialize();
		}
示例#2
0
		public void SetTrajectoryController(TrajectoryController trajc)
		{
			trajCtl = trajc;
			trajectoryEdit1.SelectedTrajectoryController = trajc;
		}