From 8f2384e0be3a28e0033c36fcd3f021b160b54229 Mon Sep 17 00:00:00 2001 From: Col-E Date: Tue, 5 Jun 2018 14:20:28 -0400 Subject: [PATCH] Update readme --- Readme.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Readme.md b/Readme.md index 31acea3..acefcf3 100644 --- a/Readme.md +++ b/Readme.md @@ -4,17 +4,17 @@ Simplified JNA is a library that allows for the quick creation of mouse and keyb JNA and JNA-platform must be imported into a project in order to use Simplified JNA. Currently only windows is supported. #### Examples +In these samples, returing `false` allows the event to be parsed by the system. Chaning the return value to `true` will cancel the event. + > Keyboard Hook ```java KeyEventReceiver keyHook = new KeyEventReceiver() { @Override - public boolean onKeyRelease(boolean sys, KBDLLHOOKSTRUCT info) { - System.out.println("Key Released:" + info.vkCode); - return false; - } - @Override - public boolean onKeyPress(boolean sys, KBDLLHOOKSTRUCT info) { - System.out.println("Key Pressed:" + info.vkCode); + public boolean onKeyUpdate(SystemState sysState, PressState pressState, int time, int vkCode) { + System.out.println("Is pressed:" + (pressState == PressState.DOWN)); + System.out.println("Alt down:" + (sysState == SystemState.SYSTEM)); + System.out.println("Timestamp:" + time); + System.out.println("KeyCode:" + vkCode); return false; } }; @@ -24,16 +24,16 @@ KeyHook.hook(keyHook); ```java MouseEventReceiver mer = new MouseEventReceiver() { @Override - public boolean onMousePress(MouseButtonType type, MOUSEHOOKSTRUCT info) { + public boolean boolean onMousePress(MouseButtonType type, HWND hwnd, POINT info) { boolean isLeft = type == MouseButtonType.LEFT_DOWN; if (isLeft) { System.out.println("Left mouse button has been pressed!") } return false; } - @Override public boolean onMouseRelease(MouseButtonType type, MOUSEHOOKSTRUCT info) { return false; } - @Override public boolean onMouseScroll(boolean down, MOUSEHOOKSTRUCT info) { return false; } - @Override public boolean onMouseMove(MOUSEHOOKSTRUCT info) { return false; } + @Override public boolean onMouseRelease(MouseButtonType type, HWND hwnd, POINT info) { return false; } + @Override public boolean onMouseScroll(boolean down, HWND hwnd, POINT info) { return false; } + @Override public boolean boolean onMouseMove(HWND hwnd, POINT info) { return false; } }; MouseHook.hook(mer); ``` \ No newline at end of file