summaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-10-17 05:25:59 +0200
committerSven Gothel <[email protected]>2013-10-17 05:25:59 +0200
commit40863632d1428de015099b5967e5136425e99f25 (patch)
tree33dc7b82204280294d9faa266d75c6c01702cab9 /src/newt/classes/com
parent56322e1cf41bbb5bcc097164fb3ddcc0061c1c73 (diff)
Int -> Enum using EnumClass.values()[ordinal] instead of for-loop - FFMPEGNatives's Enums and new MouseEvent.PointerType.valueOf(int)
Diffstat (limited to 'src/newt/classes/com')
-rw-r--r--src/newt/classes/com/jogamp/newt/event/MouseEvent.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
index 4e13d63fe..fd5e27bdd 100644
--- a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
@@ -66,18 +66,28 @@ public class MouseEvent extends InputEvent
/** Type of pointer devices */
public static enum PointerType implements InputEvent.InputType {
- /** {@link PointerClass#Offscreen} mouse. */
+ /** {@link PointerClass#Offscreen} mouse. Ordinal 0. */
Mouse(PointerClass.Offscreen),
- /** {@link PointerClass#Offscreen} touch pad, usually using fingers. */
+ /** {@link PointerClass#Offscreen} touch pad, usually using fingers. Ordinal 1. */
TouchPad(PointerClass.Offscreen),
- /** {@link PointerClass#Onscreen} touch screen, usually using fingers. */
+ /** {@link PointerClass#Onscreen} touch screen, usually using fingers. Ordinal 2. */
TouchScreen(PointerClass.Onscreen),
- /** {@link PointerClass#Onscreen} pen on screen ?. */
+ /** {@link PointerClass#Onscreen} pen usually on screen? Ordinal 3. FIXME*/
Pen(PointerClass.Onscreen),
+ /** {@link PointerClass#Undefined} ?. Ordinal 4. */
Undefined(PointerClass.Undefined);
public PointerClass getPointerClass() { return pc; }
+ public static PointerType valueOf(int i) {
+ // ordinal = enumValue.ordinal(), reverse: enumValue = EnumClass.values()[ordinal]
+ final PointerType[] all = PointerType.values();
+ if( 0 <= i && i < all.length ) {
+ return all[i];
+ }
+ return null;
+ }
+
private PointerType(PointerClass pc) {
this.pc = pc;
}