Beispiel #1
0
		public Desktop()
		{
			windowToBody = new Dictionary<Window, Body>();
			contactJoints = new Dictionary<int, FixedHingeJoint>();
			engine = new PhysicsEngine();
			engine.BroadPhase = new SweepAndPruneDetector();
			engine.Solver = new SequentialImpulsesSolver();
			timer = new PhysicsTimer(PhysicsTimerCallback, 0.01);
			timer.IsRunning = true;

			injectorClass = new DWMInjectorClass();
			if (!injectorClass.IsInjected)
				injectorClass.Inject();
			injectorClass.GetDWMExObject(out dwm);
			Debug.Assert(dwm != null, "DWM is NULL");

			windowManager = new WindowManager();
			windowManager.WindowCreated += windowManager_WindowCreated;
			windowManager.WindowDestroyed += windowManager_WindowDestroyed;
			windowManager.Register(MessageEvents.Handle);

			ThreadPool.QueueUserWorkItem(delegate
										 {
											 hook = new LowLevelMouseHook(MouseHook);
											 hook.StartHook();
											 Application.Run();
										 });
		}
Beispiel #2
0
        public Desktop()
        {
            windowToBody      = new Dictionary <Window, Body>();
            contactJoints     = new Dictionary <int, FixedHingeJoint>();
            engine            = new PhysicsEngine();
            engine.BroadPhase = new SweepAndPruneDetector();
            engine.Solver     = new SequentialImpulsesSolver();
            timer             = new PhysicsTimer(PhysicsTimerCallback, 0.01);
            timer.IsRunning   = true;

            injectorClass = new DWMInjectorClass();
            if (!injectorClass.IsInjected)
            {
                injectorClass.Inject();
            }
            injectorClass.GetDWMExObject(out dwm);
            Debug.Assert(dwm != null, "DWM is NULL");

            windowManager = new WindowManager();
            windowManager.WindowCreated   += windowManager_WindowCreated;
            windowManager.WindowDestroyed += windowManager_WindowDestroyed;
            windowManager.Register(MessageEvents.Handle);

            ThreadPool.QueueUserWorkItem(delegate
            {
                hook = new LowLevelMouseHook(MouseHook);
                hook.StartHook();
                Application.Run();
            });
        }