mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-08 07:54:05 +00:00
Added org.lwjgl.opengl.AWTInputAdapter which enabled use of Mouse and
Keyboard with AWTGLCanvases. Programs can now avoid implementing AWT input processing and access the mouse grabbing features from both Display and AWTGLCanvas. See org.lwjgl.test.opengl.awt.AWTInputAdapterTest for an example. Note: This commit is the linux and generic AWT imlementation and can still change a lot while implementing windows and mac os x.
This commit is contained in:
parent
0a17002082
commit
3674d843c2
24 changed files with 1344 additions and 153 deletions
|
|
@ -42,7 +42,7 @@ import org.lwjgl.BufferUtils;
|
|||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.Sys;
|
||||
import org.lwjgl.opengl.Display;
|
||||
import org.lwjgl.opengl.DisplayImplementation;
|
||||
import org.lwjgl.opengl.InputImplementation;
|
||||
|
||||
/**
|
||||
* <br>
|
||||
|
|
@ -264,7 +264,7 @@ public class Keyboard {
|
|||
/** One time initialization */
|
||||
private static boolean initialized;
|
||||
|
||||
private static DisplayImplementation implementation;
|
||||
private static InputImplementation implementation;
|
||||
|
||||
/**
|
||||
* Keyboard cannot be constructed.
|
||||
|
|
@ -282,6 +282,24 @@ public class Keyboard {
|
|||
initialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Create" the keyboard with the given implementation. This is used
|
||||
* reflectively from AWTInputAdapter.
|
||||
*
|
||||
* @throws LWJGLException if the keyboard could not be created for any reason
|
||||
*/
|
||||
private static void create(InputImplementation impl) throws LWJGLException {
|
||||
if (created)
|
||||
throw new IllegalStateException("Destroy the Keyboard first.");
|
||||
if (!initialized)
|
||||
initialize();
|
||||
implementation = impl;
|
||||
implementation.createKeyboard();
|
||||
created = true;
|
||||
readBuffer = ByteBuffer.allocate(EVENT_SIZE*BUFFER_SIZE);
|
||||
reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* "Create" the keyboard. The display must first have been created. The
|
||||
* reason for this is so the keyboard has a window to "focus" in.
|
||||
|
|
@ -289,17 +307,7 @@ public class Keyboard {
|
|||
* @throws LWJGLException if the keyboard could not be created for any reason
|
||||
*/
|
||||
public static void create() throws LWJGLException {
|
||||
if (!Display.isCreated())
|
||||
throw new IllegalStateException("Display must be created before you can create Keyboard");
|
||||
if (!initialized)
|
||||
initialize();
|
||||
if (created)
|
||||
return;
|
||||
implementation = Mouse.getImplementation();
|
||||
implementation.createKeyboard();
|
||||
created = true;
|
||||
readBuffer = ByteBuffer.allocate(EVENT_SIZE*BUFFER_SIZE);
|
||||
reset();
|
||||
create(Mouse.createImplementation());
|
||||
}
|
||||
|
||||
private static void reset() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue