コード例 #1
0
        IEnumerator AutomateHandler(string address, KeyCallback keyCallback)
        {
            // Check pending blocks for this account
            List <PendingBlock> pendingBlocks = null;

            yield return(PendingBlocks(address, (pendingBlocksResponse) =>
            {
                pendingBlocks = pendingBlocksResponse;
            }));

            if (pendingBlocks != null && pendingBlocks.Count > 0)
            {
                var    pendingBlock = pendingBlocks[0];
                string hash         = null;
                yield return(ReceiveWaitConf(address, pendingBlock, keyCallback.privateKey, (error, hashResponse) =>
                {
                    hash = hashResponse;
                }));

                if (hash != null)
                {
                    yield return(rpc.BlockInfo(hash, (response) =>
                    {
                        var block = JsonUtility.FromJson <BlockInfoResponse>(response).contents;
                        keyCallback.callback(block);
                    }));
                }
            }
        }
コード例 #2
0
ファイル: Glfw.cs プロジェクト: Chamberlain91/Heirloom
        public static KeyCallback SetKeyCallback(WindowHandle window, KeyCallback callback)
        {
            var old = glfwSetKeyCallback(window, callback);

            CheckError(nameof(SetKeyCallback));
            return(old);
        }
コード例 #3
0
        //Input

        public static void SetKeyCallback(IntPtr window, KeyCallback callback)
        {
            lock (Lock) {
                CallbackCache[nameof(SetKeyCallback)] = callback;
            }

            SetKeyCallback(window, callback == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(callback));
        }
コード例 #4
0
ファイル: GLFW.cs プロジェクト: PlumpMath/CSharpGameLibrary
        public static KeyCallback SetKeyCallback(WindowPtr window, KeyCallback callback)
        {
            var callbacks = GetCallbacks(window);
            var old       = callbacks.key;

            callbacks.key = callback;
            glfwSetKeyCallback(window, callback);
            CheckError();
            return(old);
        }
コード例 #5
0
ファイル: Inputhandler.cs プロジェクト: reelgood/dcsg
 public static bool BindKey(Keybindmode kbm, Keys key, KeyCallback callback, bool forceOverride = false)
 {
     bool containK = false;
     if (key_ht.ContainsKey(key))
     {
         containK = true;
         if (((Hashtable)key_ht[key]).ContainsKey(kbm)) {
             if (!forceOverride) { return false; }
         }
     }
     if (!containK) { key_ht.Add(key, new Hashtable()); }
     ((Hashtable)key_ht[key])[kbm] = callback;
     return true;
 }
コード例 #6
0
ファイル: PlayerInput.cs プロジェクト: jueane/UnityInput
 // bumper left
 public static void ListenBumperLeft(KeyCallback cb, EKeyAction eAct)
 {
     if ((eAct & EKeyAction.keyDown) == EKeyAction.keyDown)
     {
         instance.bumperLeft_Listener_Down += cb;
     }
     if ((eAct & EKeyAction.keyPressing) == EKeyAction.keyPressing)
     {
         instance.bumperLeft_Listener_Pressing += cb;
     }
     if ((eAct & EKeyAction.keyUp) == EKeyAction.keyUp)
     {
         instance.bumperLeft_Listener_Down += cb;
     }
 }
コード例 #7
0
ファイル: PlayerInput.cs プロジェクト: jueane/UnityInput
 public static void ListenKeyMouseRight(KeyCallback cb, EKeyAction eAct)
 {
     if ((eAct & EKeyAction.keyDown) == EKeyAction.keyDown)
     {
         instance.keyMouseRight_Listener_Down += cb;
     }
     if ((eAct & EKeyAction.keyPressing) == EKeyAction.keyPressing)
     {
         instance.keyMouseRight_Listener_Pressing += cb;
     }
     if ((eAct & EKeyAction.keyUp) == EKeyAction.keyUp)
     {
         instance.keyMouseRight_Listener_Up += cb;
     }
 }
コード例 #8
0
ファイル: KeyboardHandler.cs プロジェクト: 0Alic/Demo
        /// <summary>
        ///     Substitute the whole key event set with a single callback. To restore
        ///     the old set of callback use the method RestoreCallback(). This is
        ///     useful when you want to radically change the keyboard handler for few
        ///     time.
        /// </summary>
        /// <example>
        ///     KeyboardHandler.SetCallback(Map.KEY_DOWN, KeyCode.Space, MyCallback);
        ///     ....
        ///     ....
        ///     ....
        ///     KeyboardHandler.RestoreCallbacks(Map.KEY_DOWN, KeyCode.Space);
        /// </example>
        /// <param name="type">The type of the event.</param>
        /// <param name="key">The key focused by the event.</param>
        /// <param name="callback">The callback for that event.</param>
        static public void SetCallback(Map type, KeyCode key, KeyCallback callback)
        {
            Dictionary <KeyCode, HashSet <KeyCallback> > currDic = keyMap[(int)type];

            // Save the set in the backup array.
            if (currDic.ContainsKey(key))
            {
                mapBackup[(int)type][key] = currDic[key];
            }

            // Set the passed callback as the only one.
            HashSet <KeyCallback> hs = new HashSet <KeyCallback>();

            hs.Add(callback);
            currDic[key] = hs;
        }
コード例 #9
0
ファイル: KeyboardHandler.cs プロジェクト: 0Alic/Demo
        /// <summary>
        ///     Add a callback to the list of the callbacks for a given key event.
        /// </summary>
        /// <param name="type">The type of the event.</param>
        /// <param name="key">The key focused by the event.</param>
        /// <param name="callback">The callback to add.</param>
        static public void AddCallback(Map type, KeyCode key, KeyCallback callback)
        {
            HashSet <KeyCallback> hs;

            Dictionary <KeyCode, HashSet <KeyCallback> > currDic = keyMap[(int)type];

            // If set does not exist, create it.
            if (!currDic.TryGetValue(key, out hs))
            {
                hs = new HashSet <KeyCallback>();
                currDic.Add(key, hs);
            }

            // Add callback.
            hs.Add(callback);
        }
コード例 #10
0
ファイル: KeyboardHandler.cs プロジェクト: 0Alic/Demo
        /// <summary>
        ///     Remove a given callback from the set of callback of a given key event.
        /// </summary>
        /// <param name="type">The type of the event.</param>
        /// <param name="key">The key focused by the event.</param>
        /// <param name="callback">The callback to remove.</param>
        static public void RemoveCallback(Map type, KeyCode key, KeyCallback callback)
        {
            HashSet <KeyCallback> hs;

            Dictionary <KeyCode, HashSet <KeyCallback> > currDic = keyMap[(int)type];

            // If set does not exist, delete it.
            if (currDic.TryGetValue(key, out hs))
            {
                hs.Remove(callback);

                if (hs.Count == 0)
                {
                    currDic.Remove(key);
                }
            }
        }
コード例 #11
0
        internal CallbackBinder(Callback callback)
        {
            this.OnWidgetLoaded = new CallbackVoid(callback.OnWidgetLoaded);

            this.OnStateChange = new CallbackOnStateChange(callback.OnStateChange);

            this.OnProgress        = new CallbackOnProgress(callback.OnProgress);
            this.OnLocationChanged = new CallbackOnLocationChanged(callback.OnLocationChanged);
            this.OnStatusChange    = new CallbackOnStatusChange(callback.OnStatusChange);
            this.OnSecurityChange  = new CallbackOnSecurityChange(callback.OnSecurityChange);

            this.OnKeyDown  = new KeyCallback(callback.OnClientDomKeyDown);
            this.OnKeyUp    = new KeyCallback(callback.OnClientDomKeyUp);
            this.OnKeyPress = new KeyCallback(callback.OnClientDomKeyPress);

            this.OnMouseDown        = new MouseCallback(callback.OnClientMouseDown);
            this.OnMouseUp          = new MouseCallback(callback.OnClientMouseUp);
            this.OnMouseClick       = new MouseCallback(callback.OnClientMouseClick);
            this.OnMouseDoubleClick = new MouseCallback(callback.OnClientMouseDoubleClick);
            this.OnMouseOver        = new MouseCallback(callback.OnClientMouseOver);
            this.OnMouseOut         = new MouseCallback(callback.OnClientMouseOut);

            this.OnActivate = new Callback2(callback.OnClientActivate);
            this.OnFocus    = new Callback2(callback.OnClientFocus);
            this.OnBlur     = new Callback2(callback.OnClientBlur);

            this.OnAlert        = new CallbackPtrPtr(callback.OnAlert);
            this.OnAlertCheck   = new CallbackOnAlertCheck(callback.OnAlertCheck);
            this.OnConfirm      = new CallbackOnConfirm(callback.OnConfirm);
            this.OnConfirmCheck = new CallbackOnConfirmCheck(callback.OnConfirmCheck);
            this.OnConfirmEx    = new CallbackOnConfirmEx(callback.OnConfirmEx);
            this.OnPrompt       = new CallbackOnPrompt(callback.OnPrompt);
            this.OnPromptUsernameAndPassword = new CallbackOnPromptUsernameAndPassword(callback.OnPromptUsernameAndPassword);
            this.OnPromptPassword            = new CallbackOnPromptPassword(callback.OnPromptPassword);
            this.OnSelect = new CallbackOnSelect(callback.OnSelect);

            this.OnLoad   = new CallbackVoid(callback.OnLoad);
            this.OnUnload = new CallbackVoid(callback.OnUnload);

            this.OnShowContextMenu = new CallbackOnShowContextMenu(callback.OnShowContextMenu);

            this.OnGeneric = new CallbackWString(callback.OnGeneric);
        }
コード例 #12
0
            private bool CheckMapping(string mapping, CustomCallback customCallback, KeyCallback keyCallback, ButtonCallback buttonCallback)
            {
                CustomMapping custom;

                if (customMap.TryGetValue(mapping, out custom))
                {
                    if (customCallback(custom))
                    {
                        return(true);
                    }
                }

                Keys[] keys;
                if (keyMap.TryGetValue(mapping, out keys))
                {
                    foreach (Keys key in keys)
                    {
                        if (keyCallback(key))
                        {
                            return(true);
                        }
                    }
                }

                Buttons[] buttons;
                if (buttonMap.TryGetValue(mapping, out buttons))
                {
                    foreach (var button in buttons)
                    {
                        if (buttonCallback(button))
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            }
コード例 #13
0
		internal CallbackBinder (Callback callback) {
			this.OnWidgetLoaded			= new CallbackVoid (callback.OnWidgetLoaded);

			this.OnStateChange			= new CallbackOnStateChange (callback.OnStateChange);

			this.OnProgress				= new CallbackOnProgress (callback.OnProgress);
			this.OnLocationChanged		= new CallbackOnLocationChanged (callback.OnLocationChanged);
			this.OnStatusChange			= new CallbackOnStatusChange (callback.OnStatusChange);
			this.OnSecurityChange		= new CallbackOnSecurityChange (callback.OnSecurityChange);

			this.OnKeyDown				= new KeyCallback (callback.OnClientDomKeyDown);
			this.OnKeyUp				= new KeyCallback (callback.OnClientDomKeyUp);
			this.OnKeyPress				= new KeyCallback (callback.OnClientDomKeyPress);

			this.OnMouseDown			= new MouseCallback (callback.OnClientMouseDown);
			this.OnMouseUp				= new MouseCallback (callback.OnClientMouseUp);
			this.OnMouseClick			= new MouseCallback (callback.OnClientMouseClick);
			this.OnMouseDoubleClick		= new MouseCallback (callback.OnClientMouseDoubleClick);
			this.OnMouseOver			= new MouseCallback (callback.OnClientMouseOver);
			this.OnMouseOut				= new MouseCallback (callback.OnClientMouseOut);

			this.OnActivate				= new Callback2 (callback.OnClientActivate);
			this.OnFocus				= new Callback2 (callback.OnClientFocus);
			this.OnBlur					= new Callback2 (callback.OnClientBlur);

			this.OnAlert				= new CallbackPtrPtr (callback.OnAlert);
			this.OnAlertCheck			= new CallbackOnAlertCheck (callback.OnAlertCheck);
			this.OnConfirm 				= new CallbackOnConfirm (callback.OnConfirm);
			this.OnConfirmCheck 		= new CallbackOnConfirmCheck (callback.OnConfirmCheck);
			this.OnConfirmEx 			= new CallbackOnConfirmEx (callback.OnConfirmEx);
			this.OnPrompt 				= new CallbackOnPrompt (callback.OnPrompt);
			this.OnPromptUsernameAndPassword = new CallbackOnPromptUsernameAndPassword (callback.OnPromptUsernameAndPassword);
			this.OnPromptPassword 		= new CallbackOnPromptPassword (callback.OnPromptPassword);
			this.OnSelect 				= new CallbackOnSelect (callback.OnSelect);

			this.OnLoad 				= new CallbackVoid (callback.OnLoad);
			this.OnUnload 				= new CallbackVoid (callback.OnUnload);
			
			this.OnShowContextMenu		= new CallbackOnShowContextMenu (callback.OnShowContextMenu);
			
			this.OnGeneric				= new CallbackWString (callback.OnGeneric);
		}
コード例 #14
0
 public void Set(Keys key, KeyCallback callback)
 {
     actions[key] = new Action(key, callback);
 }
コード例 #15
0
ファイル: KeyHooker.cs プロジェクト: LuoTR/EasyHooker
 public KeyHooker(KeyCallback callback)
 {
     kc = callback;
 }
コード例 #16
0
        private static KeyCallback mlvKeyCallback; // required to keep c# garbage collector from moving the callbacks

        static void Main(string[] args)
        {
            bool       listenOnlyMode = false;
            bool       viewOnlyMode = false;
            bool       mixedMode = false;
            int        height, width;
            string     title;
            HTTPServer httpServer = null;

            if (args.Length == 1 && args[0] == "--listenonly")
            {
                listenOnlyMode = true;
            }
            else if (args.Length == 3)
            {
                if (args[0] != "-h" || Convert.ToInt32(args[1]) < 1 || args[2] != "--viewonly")
                {
                    Console.WriteLine("\nUSAGE:");
                    Console.WriteLine("======================================================================================");
                    Console.WriteLine("mlv.exe --listenonly (listen for new data only)");
                    Console.WriteLine("mlv.exe -h window-height --viewonly (visualize existing data only)");
                    Console.WriteLine("mlv.exe -h window-height (listen and visualize)");

                    return;
                }
                viewOnlyMode = true;
            }
            else if (args.Length == 2)
            {
                if (args[0] != "-h" || Convert.ToInt32(args[1]) < 1)
                {
                    Console.WriteLine("\nUSAGE:");
                    Console.WriteLine("======================================================================================");
                    Console.WriteLine("mlv.exe --listenonly (listen for new data only)");
                    Console.WriteLine("mlv.exe -h window-height --viewonly (visualize existing data only)");
                    Console.WriteLine("mlv.exe -h window-height (listen and visualize)");

                    return;
                }
                mixedMode = true;
            }
            else
            {
                Console.WriteLine("\nUSAGE:");
                Console.WriteLine("======================================================================================");
                Console.WriteLine("mlv.exe --listenonly (listen for new data only)");
                Console.WriteLine("mlv.exe -h window-height --viewonly (visualize existing data only)");
                Console.WriteLine("mlv.exe -h window-height (listen and visualize)");

                return;
            }

            if (listenOnlyMode || mixedMode)
            {
                // launch the http server thread
                var httpListener = new HttpListener();

                // local machine binding
                //httpServer = new HTTPServer(httpListener, "https://IP.ADDRESS:PORT/URL/");

                httpServer = new HTTPServer(httpListener, "https://192.168.100.100:1234/MerakiLocationVisualizer/");

                httpServer.Start();
            }

            if (viewOnlyMode || mixedMode)
            {
                height   = Convert.ToInt32(args[1]);
                width    = height; // hard coding square viewport
                myHeight = height;
                myWidth  = width;
                title    = "WiFi Radar";

                // load the initial batch of observation reports
                bool successfulDataInit = DataSelector.InitData(width, height);

                if (VerticeData.NumberOfAPs == 0)
                {
                    Console.WriteLine("There are no reporting access points.  Aborting!");
                    Console.Read();

                    return;
                }

                if (!successfulDataInit)
                {
                    Console.WriteLine("There is no observation data in the database.  Aborting!");
                    Console.Read();

                    return;
                }

                Running = true;

                Glfw.Init();

                DisplayManager.CreateWindow(height, width, title);

                // input events registered below in KeyCallBack()
                Glfw.SetKeyCallback(DisplayManager.Window, mlvKeyCallback = KeyCallback);

                uint[] textures = Renderer.LoadTextures();

                Shader.Load();

                float degrees      = 0f;
                float sweepDegrees = 0f;
                bool  isAscending  = true;

                // visualization loop
                while (!Glfw.WindowShouldClose(DisplayManager.Window) && Running)
                {
                    glClearColor(0, 0, 0, 0);
                    glClear(GL_COLOR_BUFFER_BIT);

                    Shader.Use();

                    // BACKGROUND GRAPHIC
                    glActiveTexture(GL_TEXTURE1);
                    glBindTexture(GL_TEXTURE_2D, textures[0]);
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "backgroundTexture"), 0);

                    // tell the shaders what is being sent to them
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "isAp"), 0);
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "isBackground"), 1);
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "isClient"), 0);
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "isSweep"), 0);

                    float alphaTime = ((((float)Math.Sin(degrees * 3.0f)) + 1f) / 2) + .05f;
                    glUniform1f(glGetUniformLocation(Shader.ProgramID, "alphaTime"), alphaTime);

                    uint vao = Renderer.Render(VerticeData.backgroundVertices());

                    glBindVertexArray(vao);

                    glDrawArrays(GL_TRIANGLES, 0, VerticeData.backgroundVertices().Length / 8);

                    glBindVertexArray(0);
                    glDeleteVertexArray(vao);
                    glBindTexture(GL_TEXTURE_2D, 0);

                    // RADAR SWEEP GRAPHIC
                    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "isAp"), 0);
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "isBackground"), 0);
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "isClient"), 0);
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "isSweep"), 1);

                    vao = Renderer.Render(VerticeData.sweepVertices(sweepDegrees));

                    if (sweepDegrees == 360)
                    {
                        sweepDegrees = 0.0f;
                    }
                    else
                    {
                        sweepDegrees += 0.001f;
                    }

                    glBindVertexArray(vao);

                    glDrawArrays(GL_TRIANGLES, 0, 3);

                    glBindVertexArray(0);
                    glDeleteVertexArray(vao);

                    // WIFI CLIENT DEVICE GRAPHICS
                    glBlendFunc(GL_ONE, GL_ONE);

                    glActiveTexture(GL_TEXTURE1);
                    glBindTexture(GL_TEXTURE_2D, textures[1]);
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "greenTexture"), 1);

                    glActiveTexture(GL_TEXTURE2);
                    glBindTexture(GL_TEXTURE_2D, textures[2]);
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "redTexture"), 2);

                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "isAp"), 0);
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "isBackground"), 0);
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "isClient"), 1);
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "isSweep"), 0);

                    if (isAscending)
                    {
                        degrees += 0.0012f;
                    }
                    else
                    {
                        degrees -= 0.0012f;
                    }
                    if (degrees == 0)
                    {
                        isAscending = true;
                    }
                    else if (degrees == 360.0f)
                    {
                        isAscending = false;
                    }

                    vao = Renderer.Render(VerticeData.SquareVertices);
                    glBindVertexArray(vao);

                    glDrawArrays(GL_TRIANGLES, 0, VerticeData.SquareVertices.Length / 8);

                    glBindVertexArray(0);
                    glDeleteVertexArray(vao);
                    glBindTexture(GL_TEXTURE_2D, 0);

                    // ACCESS POINT GRAPHIC
                    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

                    glActiveTexture(GL_TEXTURE + DataSelector.currentAP + 3);
                    glBindTexture(GL_TEXTURE_2D, textures[DataSelector.currentAP + 3]);
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "apTexture"), DataSelector.currentAP + 3);

                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "isAp"), 1);
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "isBorder"), 0);
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "isClient"), 0);
                    glUniform1i(glGetUniformLocation(Shader.ProgramID, "isSweep"), 0);

                    float[] tmpVertices = VerticeData.apVertices();
                    vao = Renderer.Render(tmpVertices);
                    glBindVertexArray(vao);

                    glDrawArrays(GL_TRIANGLES, 0, tmpVertices.Length / 8);

                    glBindVertexArray(0);
                    glDeleteVertexArray(vao);
                    glBindTexture(GL_TEXTURE_2D, 0);

                    Glfw.SwapBuffers(DisplayManager.Window);
                    Glfw.PollEvents();
                }

                DisplayManager.DestroyWindow();
            }
            else // listen only
            {
                ConsoleKey input;

                do
                {
                    input = Console.ReadKey(true).Key;

                    if (input == ConsoleKey.Escape)
                    {
                        httpServer.Stop();
                        Console.WriteLine("Listener terminated...");
                    }
                } while (input != ConsoleKey.Escape);
            }
        }
コード例 #17
0
ファイル: LowLevelHook.cs プロジェクト: gsbastian/Switcheroo
 /// <summary>
 /// Creates a low-level keyboard hook and hooks it.
 /// </summary>
 /// <param name="callback"></param>
 public LowLevelKeyboardHook(KeyCallback callback)
     : this()
 {
     this.KeyIntercepted = callback;
     StartHook();
 }
コード例 #18
0
 internal static extern void SetKeyCallBack(KeyCallback callback, DeviceIndex devINdex = DeviceIndex.DEV_DEFAULT);
コード例 #19
0
 public void AutomatePocketing(string address, string privateKey, Action <Block> callback)
 {
     keyListeners[address] = new KeyCallback(privateKey, callback);
 }
コード例 #20
0
ファイル: KeyListener.cs プロジェクト: LatexBotox/SPACE
/*	public KeyListener(KeyCode _key, KeyCallback _kc) {
		key = _key;
		delay = 0.0f;
		kc = _kc;
	}
*/
	public KeyListener(KeyCode _key, KeyCallback _kc, float _delay = 0.0f) {
		key = _key;
		delay = _delay;
		kc = _kc;
	}
コード例 #21
0
 public static extern IntPtr glfwSetKeyCallback(WindowPtr window, KeyCallback callback);
コード例 #22
0
ファイル: Action.cs プロジェクト: sma-it/game-02-connect4
 public Action(Keys key, KeyCallback func)
 {
     this.key  = key;
     this.func = func;
 }
コード例 #23
0
 public static extern KeyCallback SetKeyCallback(IntPtr window, KeyCallback callback);
コード例 #24
0
ファイル: Core.cs プロジェクト: JakubSzark/szark-game-engine
 internal static extern void SetKeyCallback(KeyCallback callback);
コード例 #25
0
 public static extern void SetKeyCallBack(KeyCallback callback);
コード例 #26
0
        static bool ImGui_ImplGlfw_Init(Window window, bool installCallbacks)
        {
            windowHandle = window;
            time         = 0.0f;

            ImGuiIOPtr io = ImGui.GetIO();

            io.BackendFlags |= ImGuiBackendFlags.HasMouseCursors;
            io.BackendFlags |= ImGuiBackendFlags.HasSetMousePos;
            //io.BackendPlatformName = "imgui_impl_glfw";

            io.KeyMap[(int)ImGuiKey.Tab]         = (int)Keys.Tab;
            io.KeyMap[(int)ImGuiKey.LeftArrow]   = (int)Keys.Left;
            io.KeyMap[(int)ImGuiKey.RightArrow]  = (int)Keys.Right;
            io.KeyMap[(int)ImGuiKey.UpArrow]     = (int)Keys.Up;
            io.KeyMap[(int)ImGuiKey.DownArrow]   = (int)Keys.Down;
            io.KeyMap[(int)ImGuiKey.PageUp]      = (int)Keys.PageUp;
            io.KeyMap[(int)ImGuiKey.PageDown]    = (int)Keys.PageDown;
            io.KeyMap[(int)ImGuiKey.Home]        = (int)Keys.Home;
            io.KeyMap[(int)ImGuiKey.End]         = (int)Keys.End;
            io.KeyMap[(int)ImGuiKey.Insert]      = (int)Keys.Insert;
            io.KeyMap[(int)ImGuiKey.Delete]      = (int)Keys.Delete;
            io.KeyMap[(int)ImGuiKey.Backspace]   = (int)Keys.Backspace;
            io.KeyMap[(int)ImGuiKey.Space]       = (int)Keys.Space;
            io.KeyMap[(int)ImGuiKey.Enter]       = (int)Keys.Enter;
            io.KeyMap[(int)ImGuiKey.Escape]      = (int)Keys.Escape;
            io.KeyMap[(int)ImGuiKey.KeyPadEnter] = (int)Keys.NumpadEnter;
            io.KeyMap[(int)ImGuiKey.A]           = (int)Keys.A;
            io.KeyMap[(int)ImGuiKey.C]           = (int)Keys.C;
            io.KeyMap[(int)ImGuiKey.V]           = (int)Keys.V;
            io.KeyMap[(int)ImGuiKey.X]           = (int)Keys.X;
            io.KeyMap[(int)ImGuiKey.Y]           = (int)Keys.Y;
            io.KeyMap[(int)ImGuiKey.Z]           = (int)Keys.Z;

//            io.SetClipboardTextFn = ImGui_ImplGlfw_SetClipboardText;
//            io.GetClipboardTextFn = ImGui_ImplGlfw_GetClipboardText;
//            io.ClipboardUserData = g_Window;
//#if defined(_WIN32)
//            io.ImeWindowHandle = (void*)glfwGetWin32Window(g_Window);
//#endif

            ErrorCallback prev_error_callback = Glfw.SetErrorCallback(null);

            mouseCursors[(int)ImGuiMouseCursor.Arrow]     = Glfw.CreateStandardCursor(CursorType.Arrow);
            mouseCursors[(int)ImGuiMouseCursor.TextInput] = Glfw.CreateStandardCursor(CursorType.Beam);
            mouseCursors[(int)ImGuiMouseCursor.ResizeNS]  = Glfw.CreateStandardCursor(CursorType.ResizeVertical);
            mouseCursors[(int)ImGuiMouseCursor.ResizeEW]  = Glfw.CreateStandardCursor(CursorType.ResizeHorizontal);
            mouseCursors[(int)ImGuiMouseCursor.Hand]      = Glfw.CreateStandardCursor(CursorType.Hand);

            // if GLFW_HAS_NEW_CURSORS
            //mouseCursors[(int)ImGuiMouseCursor.ResizeAll] = GLFW.Glfw.CreateStandardCursor(GLFW.CursorType. GLFW_RESIZE_ALL_CURSOR);
            //mouseCursors[(int)ImGuiMouseCursor.ResizeNESW] = GLFW.Glfw.CreateStandardCursor(GLFW.CursorType. GLFW_RESIZE_NESW_CURSOR);
            //mouseCursors[(int)ImGuiMouseCursor.ResizeNWSE] = GLFW.Glfw.CreateStandardCursor(GLFW.CursorType. GLFW_RESIZE_NWSE_CURSOR);
            //mouseCursors[(int)ImGuiMouseCursor.NotAllowed] = GLFW.Glfw.CreateStandardCursor(GLFW.CursorType. GLFW_NOT_ALLOWED_CURSOR);

            mouseCursors[(int)ImGuiMouseCursor.ResizeAll]  = Glfw.CreateStandardCursor(CursorType.Arrow);
            mouseCursors[(int)ImGuiMouseCursor.ResizeNESW] = Glfw.CreateStandardCursor(CursorType.Arrow);
            mouseCursors[(int)ImGuiMouseCursor.ResizeNWSE] = Glfw.CreateStandardCursor(CursorType.Arrow);
            mouseCursors[(int)ImGuiMouseCursor.NotAllowed] = Glfw.CreateStandardCursor(CursorType.Arrow);

            Glfw.SetErrorCallback(prev_error_callback);

            prevUserCallbackMousebutton = null;
            prevUserCallbackScroll      = null;
            prevUserCallbackKey         = null;
            prevUserCallbackChar        = null;
            if (installCallbacks)
            {
                installedCallbacks          = true;
                prevUserCallbackMousebutton = Glfw.SetMouseButtonCallback(windowHandle, mousebuttonCallbackHolder = ImGui_ImplGlfw_MouseButtonCallback);
                prevUserCallbackScroll      = Glfw.SetScrollCallback(windowHandle, scrollCallbackHolder = ImGui_ImplGlfw_ScrollCallback);
                prevUserCallbackKey         = Glfw.SetKeyCallback(windowHandle, keyCallbackHolder = ImGui_ImplGlfw_KeyCallback);
                prevUserCallbackChar        = Glfw.SetCharCallback(windowHandle, charCallbackHolder = ImGui_ImplGlfw_CharCallback);
            }

            return(true);
        }
コード例 #27
0
ファイル: LowLevelHook.cs プロジェクト: zhaokeli/GestureSign
 /// <summary>
 /// Creates a low-level keyboard hook and hooks it.
 /// </summary>
 /// <param name="callback"></param>
 public LowLevelKeyboardHook(KeyCallback callback)
     : this()
 {
     this.KeyIntercepted = callback;
     StartHook();
 }
コード例 #28
0
 public static extern void SetKeyCallBack(KeyCallback callback, DeviceIndex devIndex = DeviceIndex.DevDefault);
コード例 #29
0
 public void SetKeyCallBack(KeyCallback callback)
 {
     DLL.SetKeyCallBack(callback, DeviceIndex);
 }
コード例 #30
0
 private static extern KeyCallback glfwSetKeyCallback(WindowHandle window, KeyCallback callback);