Package jgl.wt.awt.listener
Class GLUTLambdaCallbackListener
java.lang.Object
jgl.wt.awt.listener.GLUTLambdaCallbackListener
- All Implemented Interfaces:
GLUTListener
Newer, lambda based callback listener.
-
Field Summary
Modifier and TypeFieldDescriptionprotected KeyboardCallback
protected KeyboardCallback
protected MotionCallback
protected MouseCallback
protected ReshapeCallback
protected KeyboardCallback
protected KeyboardCallback
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates whether the listener has any of usableinvalid @link
{@link this#onKeyboard(Component, char, int, int)
invalid @link
{@link this#onSpecialKey(Component, char, int, int)
invalid @link
{@link this#onSpecialKeyUp(Component, char, int, int)
boolean
Indicates whether the listener has usableinvalid @link
{@link this#onMouse(Component, int, int, int, int)
void
Sets the display callback for the current window (occurs when window needs to be redisplayed).void
Sets the global idle callback so that program can perform background processing tasks.void
onKeyboard
(Component target, char key, int x, int y) Sets the keyboard callback for the current window.void
onKeyboardUp
(Component target, char key, int x, int y) Sets the keyboard key up callback for the current window.void
Set the motion callback for the current window (mouse movement within window while one or more mouse buttons are pressed) void glutMotionFunc (void (*func)(int x, int y))void
Sets mouse callback for the current window.void
Sets the reshape callback for the current window (triggered when window dimensions are changed) void glutReshapeFunc (void (*func)(int width, int height))void
onSpecialKey
(Component target, char key, int x, int y) Sets the special keyboard key callback for the current window.void
onSpecialKeyUp
(Component target, char key, int x, int y) Sets the special keyboard key up callback for the current window.void
setDisplayMethod
(Consumer<Component> displayMethod) void
setIdleMethod
(Consumer<Component> idleMethod) void
setKeyMethod
(KeyboardCallback keyMethod) void
setKeyUpMethod
(KeyboardCallback keyUpMethod) void
setMotionMethod
(MotionCallback motionMethod) void
setMouseMethod
(MouseCallback mouseMethod) void
setReshapeMethod
(ReshapeCallback reshapeMethod) void
setSpecialKeyMethod
(KeyboardCallback specialKeyMethod) void
setSpecialKeyUpMethod
(KeyboardCallback specialKeyUpMethod)
-
Field Details
-
reshapeMethod
-
mouseMethod
-
motionMethod
-
keyMethod
-
keyUpMethod
-
specialKeyMethod
-
specialKeyUpMethod
-
displayMethod
-
idleMethod
-
-
Constructor Details
-
GLUTLambdaCallbackListener
public GLUTLambdaCallbackListener()
-
-
Method Details
-
onMouse
Description copied from interface:GLUTListener
Sets mouse callback for the current window. void glutMouseFunc (void (*func)(int button, int state, int x, int y))- Specified by:
onMouse
in interfaceGLUTListener
- Parameters:
target
- Rendering target componentbutton
- Mouse button identifier (GLUT_LEFT_BUTTON, etc.)state
- GLUT_UP or GLUT_DOWN indicating mouse button state causex
- Window relative coordinate x of mouse when event has occurredy
- Window relative coordinate y of mouse when event has occurred
-
onMotion
Description copied from interface:GLUTListener
Set the motion callback for the current window (mouse movement within window while one or more mouse buttons are pressed) void glutMotionFunc (void (*func)(int x, int y))- Specified by:
onMotion
in interfaceGLUTListener
- Parameters:
target
- Rendering target componentx
- Window relative coordinate x of mouse when event has occurredy
- Window relative coordinate y of mouse when event has occurred
-
onKeyboard
Description copied from interface:GLUTListener
Sets the keyboard callback for the current window. void glutKeyboardFunc (void (*func)(unsigned char key, int x, int y))- Specified by:
onKeyboard
in interfaceGLUTListener
- Parameters:
target
- Rendering target componentkey
- Generated ASCII character (i.e. 'a' or 'A' depending on SHIFT key)x
- Window relative coordinate x of mouse when event has occurredy
- Window relative coordinate y of mouse when event has occurred
-
onKeyboardUp
Description copied from interface:GLUTListener
Sets the keyboard key up callback for the current window. void glutKeyboardUpFunc (void (*func)(unsigned char key, int x, int y))- Specified by:
onKeyboardUp
in interfaceGLUTListener
- Parameters:
target
- Rendering target componentkey
- Generated ASCII character (i.e. 'a' or 'A' depending on SHIFT key)x
- Window relative coordinate x of mouse when event has occurredy
- Window relative coordinate y of mouse when event has occurred
-
onSpecialKey
Description copied from interface:GLUTListener
Sets the special keyboard key callback for the current window. void glutSpecialFunc(void (*func)(int key, int x, int y))- Specified by:
onSpecialKey
in interfaceGLUTListener
- Parameters:
target
- Rendering target componentkey
- Special key code as char - i.e. GLUT_KEY_PAGE_UPx
- Window relative coordinate x of mouse when event has occurredy
- Window relative coordinate y of mouse when event has occurred
-
onSpecialKeyUp
Description copied from interface:GLUTListener
Sets the special keyboard key up callback for the current window. void glutSpecialUpFunc (void (*func)(unsigned char key, int x, int y))- Specified by:
onSpecialKeyUp
in interfaceGLUTListener
- Parameters:
target
- Rendering target componentkey
- Special key code as char - i.e. GLUT_KEY_PAGE_UPx
- Window relative coordinate x of mouse when event has occurredy
- Window relative coordinate y of mouse when event has occurred
-
onDisplay
Description copied from interface:GLUTListener
Sets the display callback for the current window (occurs when window needs to be redisplayed). void glutDisplayFunc (void (*func)(void))- Specified by:
onDisplay
in interfaceGLUTListener
- Parameters:
target
- Rendering target component
-
onReshape
Description copied from interface:GLUTListener
Sets the reshape callback for the current window (triggered when window dimensions are changed) void glutReshapeFunc (void (*func)(int width, int height))- Specified by:
onReshape
in interfaceGLUTListener
- Parameters:
target
- Rendering target componentwidth
- New width of window, pxheight
- New height of window, px
-
onIdle
Description copied from interface:GLUTListener
Sets the global idle callback so that program can perform background processing tasks. void glutIdleFunc (void (*func)(void))- Specified by:
onIdle
in interfaceGLUTListener
- Parameters:
target
- Rendering target component
-
hasMouseCallback
public boolean hasMouseCallback()Description copied from interface:GLUTListener
Indicates whether the listener has usableinvalid @link
{@link this#onMouse(Component, int, int, int, int)
- Specified by:
hasMouseCallback
in interfaceGLUTListener
-
hasKeyboardCallback
public boolean hasKeyboardCallback()Description copied from interface:GLUTListener
Indicates whether the listener has any of usableinvalid @link
{@link this#onKeyboard(Component, char, int, int)
invalid @link
{@link this#onSpecialKey(Component, char, int, int)
invalid @link
{@link this#onSpecialKeyUp(Component, char, int, int)
- Specified by:
hasKeyboardCallback
in interfaceGLUTListener
-
setReshapeMethod
-
setMouseMethod
-
setMotionMethod
-
setKeyMethod
-
setKeyUpMethod
-
setSpecialKeyMethod
-
setSpecialKeyUpMethod
-
setDisplayMethod
-
setIdleMethod
-