Ejemplo n.º 1
0
 public ScriptKeyboard(KeyboardPlugin plugin, ref int[] scan, ref SharpDX.DirectInput.KeyboardState keystate)
 {
     this.plugin   = plugin;
     this.scan     = scan;
     dico          = new Dictionary <int, bool>();
     this.keystate = keystate;
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            _lockObject = new object();
            _queue      = new ConcurrentQueue <IScriptInput>();
            _event      = new AutoResetEvent(false);

            _queue.Enqueue(new ScriptInput(new ControlEvent[0]));

            using (_keyboardPlugin = new KeyboardPlugin())
                using (_ps3Plugin = new Ps3Plugin())
                    using (_vJoyPlugin = new VJoyPlugin())
                        using (_xInputPlugin = new XInputPlugin())
                        {
                            _keyboardPlugin.ControlEvent  += OnControlEvent;
                            _keyboardPlugin.ControlEvents += OnControlEvents;

                            _ps3Plugin.ControlEvent  += OnControlEvent;
                            _ps3Plugin.ControlEvents += OnControlEvents;

                            _xInputPlugin.ControlEvent  += OnControlEvent;
                            _xInputPlugin.ControlEvents += OnControlEvents;

                            var serviceProvider = new DefaultJsPieServiceProvider();
                            serviceProvider.Register <IScriptConsole>(() => new ScriptConsole(ScriptSeverity.Info));
                            var settings = new ScriptEngineSettings(args.Length > 0 ? args[0] : "D:\\Development\\JsPie\\test.js");
                            serviceProvider.Register(() => settings);
                            var directory = new ControllerDirectory(
                                new IInputPlugin[] { _keyboardPlugin, _ps3Plugin, _xInputPlugin }.SelectMany(p => p.GetControllers()),
                                new IOutputPlugin[] { _keyboardPlugin, _vJoyPlugin }.SelectMany(p => p.GetControllers()));
                            serviceProvider.Register(() => directory);
                            _serviceProvider = serviceProvider;
                            _scriptTask      = Task.Factory.StartNew(Run);

                            Application.Run();
                        }
        }