diff options
author | Sven Gothel <[email protected]> | 2023-03-10 03:11:24 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-10 03:11:24 +0100 |
commit | 3131eaaf5272ca3f0011e334eb08c6ba68702a6c (patch) | |
tree | 73f2e61e9986d2b72cad12ddc2b6cd5193e53028 /src | |
parent | 52e4bc6cd4ace3fdf7ccaf790566500670709a44 (diff) |
GraphUI: Promote API to JOGL via graphui.jar or within any jogl-all*.jar (WIP)
Root package is 'com.jogamp.graph.ui.gl', i.e. a sub-package of Graph denoting UI and OpenGL usage.
Implementation will stay small, hence relative files size costs are minimal.
Source and build is in parallel to nativewindow, jogl and newt
and has a dependency to all of them.
The NEWT dependencies are merely the input listener ..
Diffstat (limited to 'src')
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java) | 62 | ||||
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java) | 30 | ||||
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Button.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java) | 40 | ||||
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/gl/shapes/CrossHair.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/ui/CrossHair.java) | 13 | ||||
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/gl/shapes/GLButton.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/ui/GLEventListenerButton.java) | 22 | ||||
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/gl/shapes/ImageButton.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/ui/ImageSeqButton.java) | 18 | ||||
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java) | 13 | ||||
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/gl/shapes/MediaButton.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java) | 20 | ||||
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Rectangle.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Rectangle.java) | 11 | ||||
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/gl/shapes/RoundButton.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RoundButton.java) | 18 | ||||
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/gl/shapes/TexSeqButton.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TextureSeqButton.java) | 18 | ||||
-rw-r--r-- | src/graphui/classes/jogamp/graph/ui/shapes/Label0.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label0.java) | 4 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java | 3 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java | 3 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/graph/ui/demos/GPUUISceneGLListener0A.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java) | 123 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/graph/ui/demos/GPUUISceneNewtCanvasAWTDemo.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java) | 2 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/graph/ui/demos/GPUUISceneNewtDemo.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java) | 2 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/graph/ui/demos/GPUUISceneTextAnim01.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneTextAnim01.java) | 23 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/graph/ui/demos/UIShapeDemo01.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/UIShapeDemo01.java) | 15 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/graph/ui/demos/UITypeDemo01.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/UITypeDemo01.java) | 21 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/graph/ui/demos/button-pressed-145x53.png (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/button-pressed-145x53.png) | bin | 8603 -> 8603 bytes | |||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/graph/ui/demos/button-released-145x53.png (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/button-released-145x53.png) | bin | 9429 -> 9429 bytes | |||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/graph/ui/testshapes/Glyph01UbuntuLight_o.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph01UbuntuLight_o.java) | 6 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/graph/ui/testshapes/Glyph02UbuntuLight_ae.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph02UbuntuLight_ae.java) | 6 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph03FreeMonoRegular_M.java) | 6 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/graph/ui/testshapes/Glyph04FreeSans_0.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph04FreeSans_0.java) | 6 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/graph/ui/testshapes/Glyph05FreeSerifBoldItalic_ae.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph05FreeSerifBoldItalic_ae.java) | 6 |
27 files changed, 294 insertions, 197 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java b/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java index 196447a23..a87dd9a23 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos.ui; +package com.jogamp.graph.ui.gl; import java.util.ArrayList; import java.util.Arrays; @@ -55,8 +55,18 @@ import com.jogamp.opengl.math.Ray; import com.jogamp.opengl.math.geom.AABBox; import com.jogamp.opengl.util.PMVMatrix; -public class SceneUIController implements GLEventListener{ - private final ArrayList<UIShape> shapes = new ArrayList<UIShape>(); +/** + * GraphUI Scene + * <p> + * GraphUI is GPU based and resolution independent. + * </p> + * <p> + * GraphUI is intended to become an immediate- and retained-mode API. + * </p> + * @see Shape + */ +public class Scene implements GLEventListener{ + private final ArrayList<Shape> shapes = new ArrayList<Shape>(); private final float sceneDist, zNear, zFar; @@ -71,7 +81,7 @@ public class SceneUIController implements GLEventListener{ private final float[] scenePlaneOrigin = new float[3]; - private volatile UIShape activeShape = null; + private volatile Shape activeShape = null; private SBCMouseListener sbcMouseListener = null; private SBCGestureListener sbcGestureListener = null; @@ -79,11 +89,11 @@ public class SceneUIController implements GLEventListener{ private GLAutoDrawable cDrawable = null; - public SceneUIController(final float sceneDist, final float zNear, final float zFar) { + public Scene(final float sceneDist, final float zNear, final float zFar) { this(null, sceneDist, zNear, zFar); } - public SceneUIController(final RegionRenderer renderer, final float sceneDist, final float zNear, final float zFar) { + public Scene(final RegionRenderer renderer, final float sceneDist, final float zNear, final float zFar) { this.renderer = renderer; this.sceneDist = sceneDist; this.zFar = zFar; @@ -133,23 +143,23 @@ public class SceneUIController implements GLEventListener{ } } - public ArrayList<UIShape> getShapes() { + public ArrayList<Shape> getShapes() { return shapes; } - public void addShape(final UIShape b) { + public void addShape(final Shape b) { shapes.add(b); } - public void removeShape(final UIShape b) { + public void removeShape(final Shape b) { shapes.remove(b); } - public final UIShape getShapeByIdx(final int id) { + public final Shape getShapeByIdx(final int id) { if( 0 > id ) { return null; } return shapes.get(id); } - public UIShape getShapeByName(final int name) { - for(final UIShape b : shapes) { + public Shape getShapeByName(final int name) { + for(final Shape b : shapes) { if(b.getName() == name ) { return b; } @@ -192,9 +202,9 @@ public class SceneUIController implements GLEventListener{ } } - private static Comparator<UIShape> shapeZAscComparator = new Comparator<UIShape>() { + private static Comparator<Shape> shapeZAscComparator = new Comparator<Shape>() { @Override - public int compare(final UIShape s1, final UIShape s2) { + public int compare(final Shape s1, final Shape s2) { final float s1Z = s1.getBounds().getMinZ()+s1.getTranslate()[2]; final float s2Z = s2.getBounds().getMinZ()+s2.getTranslate()[2]; if( FloatUtil.isEqual(s1Z, s2Z, FloatUtil.EPSILON) ) { @@ -226,7 +236,7 @@ public class SceneUIController implements GLEventListener{ final int shapeCount = shapesS.length; for(int i=0; i<shapeCount; i++) { // final UIShape uiShape = shapes.get(i); - final UIShape uiShape = (UIShape)shapesS[i]; + final Shape uiShape = (Shape)shapesS[i]; // System.err.println("Id "+i+": "+uiShape); if( uiShape.isEnabled() ) { uiShape.validate(gl, renderer); @@ -240,7 +250,7 @@ public class SceneUIController implements GLEventListener{ renderer.enable(gl, false); } - public void pickShape(final int glWinX, final int glWinY, final float[] objPos, final UIShape[] shape, final Runnable runnable) { + public void pickShape(final int glWinX, final int glWinY, final float[] objPos, final Shape[] shape, final Runnable runnable) { if( null == cDrawable ) { return; } @@ -255,7 +265,7 @@ public class SceneUIController implements GLEventListener{ } } ); } @SuppressWarnings({ "unchecked", "rawtypes" }) - private UIShape pickShapeImpl(final int glWinX, final int glWinY, final float[] objPos) { + private Shape pickShapeImpl(final int glWinX, final int glWinY, final float[] objPos) { final float winZ0 = 0f; final float winZ1 = 0.3f; /** @@ -272,7 +282,7 @@ public class SceneUIController implements GLEventListener{ Arrays.sort(shapesS, (Comparator)shapeZAscComparator); for(int i=shapesS.length-1; i>=0; i--) { - final UIShape uiShape = (UIShape)shapesS[i]; + final Shape uiShape = (Shape)shapesS[i]; if( uiShape.isEnabled() ) { pmv.glPushMatrix(); @@ -299,14 +309,14 @@ public class SceneUIController implements GLEventListener{ private final float[] dpyTmp3V3 = new float[3]; /** - * Calling {@link UIShape#winToObjCoord(RegionRenderer, int, int, float[])}, retrieving its object position. + * Calling {@link Shape#winToObjCoord(RegionRenderer, int, int, float[])}, retrieving its object position. * @param activeShape * @param glWinX in GL window coordinates, origin bottom-left * @param glWinY in GL window coordinates, origin bottom-left * @param objPos resulting object position * @param runnable action */ - public void windowToShapeCoords(final UIShape activeShape, final int glWinX, final int glWinY, final float[] objPos, final Runnable runnable) { + public void windowToShapeCoords(final Shape activeShape, final int glWinX, final int glWinY, final float[] objPos, final Runnable runnable) { if( null == cDrawable || null == activeShape ) { return; } @@ -330,7 +340,7 @@ public class SceneUIController implements GLEventListener{ } /** - * Disposes all {@link #addShape(UIShape) added} {@link UIShape}s. + * Disposes all {@link #addShape(Shape) added} {@link Shape}s. * <p> * Implementation also issues {@link RegionRenderer#destroy(GL2ES2)} if set * and {@link #detachInputListenerFrom(GLWindow)} in case the drawable is of type {@link GLWindow}. @@ -415,14 +425,14 @@ public class SceneUIController implements GLEventListener{ pmv.glScalef(sceneScale[0], sceneScale[1], sceneScale[2]); } - public final UIShape getActiveShape() { + public final Shape getActiveShape() { return activeShape; } public void release() { setActiveShape(null); } - private void setActiveShape(final UIShape shape) { + private void setActiveShape(final Shape shape) { activeShape = shape; } @@ -438,7 +448,7 @@ public class SceneUIController implements GLEventListener{ final int glWinX = e.getX(); final int glWinY = viewport[3] - e.getY() - 1; final float[] objPos = new float[3]; - final UIShape shape = activeShape; + final Shape shape = activeShape; windowToShapeCoords(shape, glWinX, glWinY, objPos, new Runnable() { @Override public void run() { @@ -471,7 +481,7 @@ public class SceneUIController implements GLEventListener{ */ final void dispatchMouseEventPickShape(final MouseEvent e, final int glWinX, final int glWinY, final boolean setActive) { final float[] objPos = new float[3]; - final UIShape[] shape = { null }; + final Shape[] shape = { null }; pickShape(glWinX, glWinY, objPos, shape, new Runnable() { @Override public void run() { @@ -488,7 +498,7 @@ public class SceneUIController implements GLEventListener{ * @param glWinX in GL window coordinates, origin bottom-left * @param glWinY in GL window coordinates, origin bottom-left */ - final void dispatchMouseEventForShape(final UIShape shape, final MouseEvent e, final int glWinX, final int glWinY) { + final void dispatchMouseEventForShape(final Shape shape, final MouseEvent e, final int glWinX, final int glWinY) { final float[] objPos = new float[3]; windowToShapeCoords(shape, glWinX, glWinY, objPos, new Runnable() { @Override diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java b/src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java index 1ef54304f..97439c24c 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos.ui; +package com.jogamp.graph.ui.gl; import java.util.ArrayList; @@ -52,7 +52,17 @@ import com.jogamp.opengl.math.VectorUtil; import com.jogamp.opengl.math.geom.AABBox; import com.jogamp.opengl.util.PMVMatrix; -public abstract class UIShape { +/** + * GraphUI Shape + * <p> + * GraphUI is GPU based and resolution independent. + * </p> + * <p> + * GraphUI is intended to become an immediate- and retained-mode API. + * </p> + * @see Scene + */ +public abstract class Shape { public static final boolean DRAW_DEBUG_BOX = false; private static final boolean DEBUG = false; @@ -97,7 +107,7 @@ public abstract class UIShape { private boolean enabled = true; private ArrayList<MouseGestureListener> mouseListeners = new ArrayList<MouseGestureListener>(); - public UIShape(final Factory<? extends Vertex> factory, final int renderModes) { + public Shape(final Factory<? extends Vertex> factory, final int renderModes) { this.vertexFactory = factory; this.renderModes = renderModes; this.box = new AABBox(); @@ -595,19 +605,19 @@ public abstract class UIShape { } /** - * {@link UIShape} event details for propagated {@link NEWTEvent}s + * {@link Shape} event details for propagated {@link NEWTEvent}s * containing reference of {@link #shape the intended shape} as well as * the {@link #objPos rotated relative position}. * The latter is normalized to lower-left zero origin, allowing easier usage. */ public static class UIShapeEvent { - /** The associated {@link UIShape} for this event */ - public final UIShape shape; - /** The relative object coordinate of glWinX/glWinY to the associated {@link UIShape}. */ + /** The associated {@link Shape} for this event */ + public final Shape shape; + /** The relative object coordinate of glWinX/glWinY to the associated {@link Shape}. */ public final float[] objPos; /** The GL window coordinates, origin bottom-left */ public final int[] winPos; - /** The drag delta of the relative object coordinate of glWinX/glWinY to the associated {@link UIShape}. */ + /** The drag delta of the relative object coordinate of glWinX/glWinY to the associated {@link Shape}. */ public final float[] objDrag = { 0f, 0f }; /** The drag delta of GL window coordinates, origin bottom-left */ public final int[] winDrag = { 0, 0 }; @@ -619,7 +629,7 @@ public abstract class UIShape { * @param shape associated shape * @param objPos relative object coordinate of glWinX/glWinY to the associated shape. */ - UIShapeEvent(final int glWinX, final int glWinY, final UIShape shape, final float[] objPos) { + UIShapeEvent(final int glWinX, final int glWinY, final Shape shape, final float[] objPos) { this.winPos = new int[] { glWinX, glWinY }; this.shape = shape; this.objPos = objPos; @@ -655,7 +665,7 @@ public abstract class UIShape { * @param objPos object position of mouse event within this shape */ public final void dispatchMouseEvent(final MouseEvent e, final int glWinX, final int glWinY, final float[] objPos) { - final UIShape.UIShapeEvent shapeEvent = new UIShapeEvent(glWinX, glWinY, this, objPos); + final Shape.UIShapeEvent shapeEvent = new UIShapeEvent(glWinX, glWinY, this, objPos); e.setAttachment(shapeEvent); final short eventType = e.getEventType(); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Button.java index 8a357c8a6..981441f9a 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Button.java @@ -1,5 +1,5 @@ /** - * Copyright 2010 JogAmp Community. All rights reserved. + * Copyright 2010-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos.ui; +package com.jogamp.graph.ui.gl.shapes; import com.jogamp.opengl.GL; import com.jogamp.opengl.GL2ES2; @@ -38,10 +38,19 @@ import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.opengl.math.geom.AABBox; +import jogamp.graph.ui.shapes.Label0; + /** - * GPU based resolution independent Button impl + * A GraphUI text labeled {@link RoundButton} {@link Shape} + * <p> + * GraphUI is GPU based and resolution independent. + * </p> + * <p> + * This button is rendered with a round oval shape. + * To render it rectangular, {@link #setCorner(float)} to zero. + * </p> */ -public class LabelButton extends RoundButton { +public class Button extends RoundButton { /** {@value} */ public static final float DEFAULT_SPACING_X = 0.12f; /** {@value} */ @@ -53,7 +62,7 @@ public class LabelButton extends RoundButton { private float spacingX = DEFAULT_SPACING_X; private float spacingY = DEFAULT_SPACING_Y; - public LabelButton(final Factory<? extends Vertex> factory, final int renderModes, + public Button(final Factory<? extends Vertex> factory, final int renderModes, final Font labelFont, final String labelText, final float width, final float height) { super(factory, renderModes | Region.COLORCHANNEL_RENDERING_BIT, width, height); @@ -64,7 +73,8 @@ public class LabelButton extends RoundButton { setToggleOnColorMod(0.85f, 0.85f, 0.85f, 1.0f); } - public Font getFont() { return label.font; } + public Font getFont() { return label.getFont(); } + public String getLaben() { return label.getText(); } @Override public void drawShape(final GL2ES2 gl, final RegionRenderer renderer, final int[] sampleCount) { @@ -95,7 +105,7 @@ public class LabelButton extends RoundButton { // Precompute text-box size .. guessing pixelSize final float lw = width * ( 1f - spacingX ) ; final float lh = height * ( 1f - spacingY ) ; - final AABBox lbox0_em = label.font.getGlyphBounds(label.text, tempT1, tempT2); + final AABBox lbox0_em = label.getFont().getGlyphBounds(label.getText(), tempT1, tempT2); final float lsx = lw / lbox0_em.getWidth(); final float lsy = lh / lbox0_em.getHeight(); final float lScale = lsx < lsy ? lsx : lsy; @@ -111,7 +121,7 @@ public class LabelButton extends RoundButton { System.err.println("RIButton: dim "+width+" x "+height+", spacing "+spacingX+", "+spacingY); System.err.println("RIButton: net-text "+lw+" x "+lh); System.err.println("RIButton: shape "+box); - System.err.println("RIButton: text_em "+lbox0_em+" em, "+label.text); + System.err.println("RIButton: text_em "+lbox0_em+" em, "+label.getText()); System.err.println("RIButton: lscale "+lsx+" x "+lsy+" -> "+lScale); System.err.printf ("RIButton: text_s %s%n", lbox1_s); System.err.printf ("RIButton: tleft %f / %f, %f / %f%n", ltx[0], ltx[1], ltx[0] * lScale, ltx[1] * lScale); @@ -164,7 +174,19 @@ public class LabelButton extends RoundButton { markShapeDirty(); } - public final void setLabelText(final Font labelFont, final String labelText) { + public final void setFont(final Font labelFont) { + if( !label.getFont().equals(labelFont) ) { + label.setFont(labelFont); + markShapeDirty(); + } + } + public final void setLabel(final String labelText) { + if( !label.getText().equals(labelText) ) { + label.setText(labelText); + markShapeDirty(); + } + } + public final void setLabel(final Font labelFont, final String labelText) { if( !label.getText().equals(labelText) || !label.getFont().equals(labelFont) ) { label.setFont(labelFont); label.setText(labelText); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/CrossHair.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/CrossHair.java index 0c8595c70..b93639e5d 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/CrossHair.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/CrossHair.java @@ -1,5 +1,5 @@ /** - * Copyright 2010 JogAmp Community. All rights reserved. + * Copyright 2010-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -25,19 +25,22 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos.ui; +package com.jogamp.graph.ui.gl.shapes; import com.jogamp.opengl.GL2ES2; - import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; +import com.jogamp.graph.ui.gl.Shape; /** - * GPU based resolution independent Crosshair + * A GraphUI Crosshair {@link Shape} + * <p> + * GraphUI is GPU based and resolution independent. + * </p> */ -public class CrossHair extends UIShape { +public class CrossHair extends Shape { private float width, height, lineWidth; public CrossHair(final Factory<? extends Vertex> factory, final int renderModes, final float width, final float height, final float linewidth) { diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/GLEventListenerButton.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/GLButton.java index 9e6c131ed..ace658a7b 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/GLEventListenerButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/GLButton.java @@ -1,5 +1,5 @@ /** - * Copyright 2014 JogAmp Community. All rights reserved. + * Copyright 2014-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos.ui; +package com.jogamp.graph.ui.gl.shapes; import com.jogamp.opengl.GL; import com.jogamp.opengl.GL2ES2; @@ -36,7 +36,6 @@ import com.jogamp.opengl.GLDrawable; import com.jogamp.opengl.GLDrawableFactory; import com.jogamp.opengl.GLEventListener; import com.jogamp.opengl.GLOffscreenAutoDrawable; - import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; @@ -45,10 +44,19 @@ import com.jogamp.opengl.util.texture.ImageSequence; import com.jogamp.opengl.util.texture.Texture; /** - * GPU based resolution independent Button impl, - * rendering {@link GLEventListener} content via FBO as an {@link ImageSequence}. + * A GraphUI {@link GLEventListener} based {@link TexSeqButton} {@link Shape}. + * <p> + * GraphUI is GPU based and resolution independent. + * </p> + * <p> + * The {@link GLEventListener} is rendered via an {@link GLOffscreenAutoDrawable.FBO} into an {@link ImageSequence}. + * </p> + * <p> + * This button is rendered with a round oval shape. + * To render it rectangular, {@link #setCorner(float)} to zero. + * </p> */ -public class GLEventListenerButton extends TextureSeqButton { +public class GLButton extends TexSeqButton { private final GLEventListener glel; private final boolean useAlpha; private volatile int fboWidth = 200; @@ -56,7 +64,7 @@ public class GLEventListenerButton extends TextureSeqButton { private volatile GLOffscreenAutoDrawable.FBO fboGLAD = null; private boolean animateGLEL = false; - public GLEventListenerButton(final Factory<? extends Vertex> factory, final int renderModes, + public GLButton(final Factory<? extends Vertex> factory, final int renderModes, final float width, final float height, final int textureUnit, final GLEventListener glel, final boolean useAlpha, final int fboWidth, final int fboHeight) { super(factory, renderModes, width, height, new ImageSequence(textureUnit, true)); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/ImageSeqButton.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/ImageButton.java index 8556007d3..6ebc0d7ba 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/ImageSeqButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/ImageButton.java @@ -1,5 +1,5 @@ /** - * Copyright 2014 JogAmp Community. All rights reserved. + * Copyright 2014-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -25,21 +25,27 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos.ui; +package com.jogamp.graph.ui.gl.shapes; import com.jogamp.opengl.GL2ES2; - import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.opengl.util.texture.ImageSequence; /** - * GPU based resolution independent {@link ImageSequence} Button impl + * A GraphUI {@link ImageSequence} based {@link TexSeqButton} {@link Shape}. + * <p> + * GraphUI is GPU based and resolution independent. + * </p> + * <p> + * This button is rendered with a round oval shape. + * To render it rectangular, {@link #setCorner(float)} to zero. + * </p> */ -public class ImageSeqButton extends TextureSeqButton { +public class ImageButton extends TexSeqButton { - public ImageSeqButton(final Factory<? extends Vertex> factory, final int renderModes, + public ImageButton(final Factory<? extends Vertex> factory, final int renderModes, final float width, final float height, final ImageSequence texSeq) { super(factory, renderModes, width, height, texSeq); setColor(0.95f, 0.95f, 0.95f, 1.0f); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java index d64b9a731..4af782a37 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java @@ -1,5 +1,5 @@ /** - * Copyright 2010 JogAmp Community. All rights reserved. + * Copyright 2010-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos.ui; +package com.jogamp.graph.ui.gl.shapes; import com.jogamp.opengl.GL2ES2; import com.jogamp.opengl.math.geom.AABBox; @@ -35,8 +35,15 @@ import com.jogamp.graph.font.Font; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.geom.plane.AffineTransform; +import com.jogamp.graph.ui.gl.Shape; -public class Label extends UIShape { +/** + * A GraphUI text label {@link Shape} + * <p> + * GraphUI is GPU based and resolution independent. + * </p> + */ +public class Label extends Shape { protected Font font; protected float pixelSize; protected String text; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/MediaButton.java index 44e2c6034..290abba6e 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/MediaButton.java @@ -1,5 +1,5 @@ /** - * Copyright 2014 JogAmp Community. All rights reserved. + * Copyright 2014-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos.ui; +package com.jogamp.graph.ui.gl.shapes; import com.jogamp.opengl.GL2ES2; import com.jogamp.common.util.InterruptSource; @@ -38,9 +38,16 @@ import com.jogamp.opengl.util.av.GLMediaPlayer.StreamException; import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame; /** - * GPU based resolution independent {@link GLMediaPlayer} Button impl + * A GraphUI {@link GLMediaPlayer} based {@link TexSeqButton} {@link Shape}. + * <p> + * GraphUI is GPU based and resolution independent. + * </p> + * <p> + * This button is rendered with a round oval shape. + * To render it rectangular, {@link #setCorner(float)} to zero. + * </p> */ -public class MediaPlayerButton extends TextureSeqButton { +public class MediaButton extends TexSeqButton { private boolean verbose = false; /** @@ -51,7 +58,7 @@ public class MediaPlayerButton extends TextureSeqButton { * @param mPlayer * @param mPlayerListener */ - public MediaPlayerButton(final Factory<? extends Vertex> factory, final int renderModes, + public MediaButton(final Factory<? extends Vertex> factory, final int renderModes, final float width, final float height, final GLMediaPlayer mPlayer) { super(factory, renderModes, width, height, mPlayer); @@ -87,13 +94,14 @@ public class MediaPlayerButton extends TextureSeqButton { System.err.println("MovieCube State: "+mp); } if( 0 != ( GLMediaEventListener.EVENT_CHANGE_INIT & event_mask ) ) { - MediaPlayerButton.this.setEnabled(true); // data and shader is available .. + MediaButton.this.setEnabled(true); // data and shader is available .. } if( 0 != ( GLMediaEventListener.EVENT_CHANGE_SIZE & event_mask ) ) { // FIXME: mPlayer.resetGLState(); } if( 0 != ( GLMediaEventListener.EVENT_CHANGE_EOS & event_mask ) ) { new InterruptSource.Thread() { + @Override public void run() { // loop for-ever .. mPlayer.seek(0); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Rectangle.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Rectangle.java index aa9400050..6a93bc842 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Rectangle.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Rectangle.java @@ -25,19 +25,22 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos.ui; +package com.jogamp.graph.ui.gl.shapes; import com.jogamp.opengl.GL2ES2; - import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; +import com.jogamp.graph.ui.gl.Shape; /** - * GPU based resolution independent Rectangle + * A GraphUI Rectangle {@link Shape} + * <p> + * GraphUI is GPU based and resolution independent. + * </p> */ -public class Rectangle extends UIShape { +public class Rectangle extends Shape { private float width, height, lineWidth; public Rectangle(final Factory<? extends Vertex> factory, final int renderModes, final float width, final float height, final float linewidth) { diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RoundButton.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/RoundButton.java index 1f238763d..56ab4146b 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RoundButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/RoundButton.java @@ -1,5 +1,5 @@ /** - * Copyright 2010 JogAmp Community. All rights reserved. + * Copyright 2010-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -25,16 +25,26 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos.ui; +package com.jogamp.graph.ui.gl.shapes; import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; -import com.jogamp.graph.geom.plane.AffineTransform; +import com.jogamp.graph.ui.gl.Shape; -public abstract class RoundButton extends UIShape { +/** + * An abstract GraphUI round Button {@link Shape} + * <p> + * GraphUI is GPU based and resolution independent. + * </p> + * <p> + * This button is rendered with a round oval shape. + * To render it rectangular, {@link #setCorner(float)} to zero. + * </p> + */ +public abstract class RoundButton extends Shape { /** {@value} */ public static final float DEFAULT_CORNER = 1f; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TextureSeqButton.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/TexSeqButton.java index 226dfc1cd..3ebde276f 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TextureSeqButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/TexSeqButton.java @@ -1,5 +1,5 @@ /** - * Copyright 2014 JogAmp Community. All rights reserved. + * Copyright 2014-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos.ui; +package com.jogamp.graph.ui.gl.shapes; import com.jogamp.opengl.GL2ES2; import com.jogamp.opengl.GLProfile; @@ -35,15 +35,23 @@ import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; +import com.jogamp.graph.ui.gl.Shape; import com.jogamp.opengl.util.texture.TextureSequence; /** - * GPU based resolution independent {@link TextureSequence} Button impl + * An abstract GraphUI {@link TextureSequence} {@link RoundButton} {@link Shape}. + * <p> + * GraphUI is GPU based and resolution independent. + * </p> + * <p> + * This button is rendered with a round oval shape. + * To render it rectangular, {@link #setCorner(float)} to zero. + * </p> */ -public class TextureSeqButton extends RoundButton { +public abstract class TexSeqButton extends RoundButton { protected final TextureSequence texSeq; - public TextureSeqButton(final Factory<? extends Vertex> factory, final int renderModes, + public TexSeqButton(final Factory<? extends Vertex> factory, final int renderModes, final float width, final float height, final TextureSequence texSeq) { super(factory, renderModes | Region.COLORTEXTURE_RENDERING_BIT, width, height); this.texSeq = texSeq; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label0.java b/src/graphui/classes/jogamp/graph/ui/shapes/Label0.java index 7d8f34261..1a7520daa 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label0.java +++ b/src/graphui/classes/jogamp/graph/ui/shapes/Label0.java @@ -1,5 +1,5 @@ /** - * Copyright 2010 JogAmp Community. All rights reserved. + * Copyright 2010-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos.ui; +package jogamp.graph.ui.shapes; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.TextRegionUtil; diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java index f84c7672b..a272490bf 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java @@ -29,14 +29,13 @@ package com.jogamp.opengl.test.android; import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.test.junit.graph.ui.demos.GPUUISceneGLListener0A; import jogamp.newt.driver.android.NewtBaseActivity; import com.jogamp.newt.event.MonitorEvent; import com.jogamp.newt.event.MonitorModeListener; import com.jogamp.newt.opengl.GLWindow; - -import com.jogamp.opengl.test.junit.graph.demos.GPUUISceneGLListener0A; import com.jogamp.opengl.util.Animator; import android.os.Bundle; diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java index af079f1ac..0acc87690 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java @@ -29,6 +29,7 @@ package com.jogamp.opengl.test.android; import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.test.junit.graph.ui.demos.GPUUISceneGLListener0A; import jogamp.newt.driver.android.NewtBaseActivity; @@ -36,8 +37,6 @@ import com.jogamp.graph.curve.Region; import com.jogamp.newt.event.MonitorEvent; import com.jogamp.newt.event.MonitorModeListener; import com.jogamp.newt.opengl.GLWindow; - -import com.jogamp.opengl.test.junit.graph.demos.GPUUISceneGLListener0A; import com.jogamp.opengl.util.Animator; import android.os.Bundle; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/ui/demos/GPUUISceneGLListener0A.java index 311099169..f49258832 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/ui/demos/GPUUISceneGLListener0A.java @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos; +package com.jogamp.opengl.test.junit.graph.ui.demos; import java.io.File; import java.io.IOException; @@ -53,6 +53,14 @@ import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontScale; import com.jogamp.graph.geom.SVertex; +import com.jogamp.graph.ui.gl.Scene; +import com.jogamp.graph.ui.gl.Shape; +import com.jogamp.graph.ui.gl.shapes.Button; +import com.jogamp.graph.ui.gl.shapes.GLButton; +import com.jogamp.graph.ui.gl.shapes.ImageButton; +import com.jogamp.graph.ui.gl.shapes.Label; +import com.jogamp.graph.ui.gl.shapes.MediaButton; +import com.jogamp.graph.ui.gl.shapes.RoundButton; import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.Window; import com.jogamp.newt.event.InputEvent; @@ -64,14 +72,7 @@ import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.math.FloatUtil; import com.jogamp.opengl.math.VectorUtil; import com.jogamp.opengl.test.junit.graph.FontSet01; -import com.jogamp.opengl.test.junit.graph.demos.ui.GLEventListenerButton; -import com.jogamp.opengl.test.junit.graph.demos.ui.Label; -import com.jogamp.opengl.test.junit.graph.demos.ui.LabelButton; -import com.jogamp.opengl.test.junit.graph.demos.ui.MediaPlayerButton; -import com.jogamp.opengl.test.junit.graph.demos.ui.RoundButton; -import com.jogamp.opengl.test.junit.graph.demos.ui.SceneUIController; -import com.jogamp.opengl.test.junit.graph.demos.ui.ImageSeqButton; -import com.jogamp.opengl.test.junit.graph.demos.ui.UIShape; +import com.jogamp.opengl.test.junit.graph.demos.MSAATool; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.util.GLReadBufferUtil; import com.jogamp.opengl.util.av.GLMediaPlayer; @@ -85,7 +86,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { private boolean trace = false; private final float noAADPIThreshold; - private final SceneUIController sceneUICntrl; + private final Scene sceneUICntrl; /** -1 == AUTO, TBD @ init(..) */ private int renderModes; @@ -204,7 +205,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { rs.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); // renderer = RegionRenderer.create(rs, null, null); - sceneUICntrl = new SceneUIController(renderer, sceneDist, zNear, zFar); + sceneUICntrl = new Scene(renderer, sceneDist, zNear, zFar); // sceneUIController.setSampleCount(3); // easy on embedded devices w/ just 3 samples (default is 4)? } screenshot = new GLReadBufferUtil(false, false); @@ -225,8 +226,8 @@ public class GPUUISceneGLListener0A implements GLEventListener { private void setButtonsSpacing(final float dx, final float dy) { for(int i=0; i<buttons.size(); i++) { final RoundButton b = buttons.get(i); - if( b instanceof LabelButton ) { - final LabelButton lb = (LabelButton) b; + if( b instanceof Button ) { + final Button lb = (Button) b; final float sx = lb.getSpacingX()+dx, sy = lb.getSpacingY()+dy; System.err.println("Spacing: X "+sx+", Y "+sy); lb.setSpacing(sx, sy); @@ -247,8 +248,8 @@ public class GPUUISceneGLListener0A implements GLEventListener { final RoundButton b = buttons.get(i); b.getRotation().setIdentity(); b.setCorner(RoundButton.DEFAULT_CORNER); - if( b instanceof LabelButton ) { - ((LabelButton)b).setSpacing(LabelButton.DEFAULT_SPACING_X, LabelButton.DEFAULT_SPACING_Y); + if( b instanceof Button ) { + ((Button)b).setSpacing(Button.DEFAULT_SPACING_X, Button.DEFAULT_SPACING_Y); } } } @@ -260,7 +261,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { public static final int BUTTON_MOVIE = 200; public static final int BUTTON_GLEL = 200; - public UIShape getShapeByName(final int name) { + public Shape getShapeByName(final int name) { return sceneUICntrl.getShapeByName(name); } @@ -277,10 +278,10 @@ public class GPUUISceneGLListener0A implements GLEventListener { final float diffX = 1.2f * buttonXSize; final float diffY = 1.5f * buttonYSize; - LabelButton button = new LabelButton(SVertex.factory(), renderModes, font, "Next Text", buttonXSize, buttonYSize); + Button button = new Button(SVertex.factory(), renderModes, font, "Next Text", buttonXSize, buttonYSize); button.setName(BUTTON_NEXTTEXT); button.translate(xStartLeft,yStartTop-diffY*buttons.size(), 0f); - button.addMouseListener(new UIShape.MouseGestureAdapter() { + button.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mouseClicked(final MouseEvent e) { if( null != labels[currentText] ) { @@ -294,12 +295,12 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.addMouseListener(dragZoomRotateListener); buttons.add(button); - button = new LabelButton(SVertex.factory(), renderModes, font, "Show FPS", buttonXSize, buttonYSize); + button = new Button(SVertex.factory(), renderModes, font, "Show FPS", buttonXSize, buttonYSize); button.setName(BUTTON_FPS); button.translate(xStartLeft,yStartTop - diffY*buttons.size(), 0f); button.setToggleable(true); button.setToggle(fpsLabel.isEnabled()); - button.addMouseListener(new UIShape.MouseGestureAdapter() { + button.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mouseClicked(final MouseEvent e) { final GLAnimatorControl a = cDrawable.getAnimator(); @@ -311,12 +312,12 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.addMouseListener(dragZoomRotateListener); buttons.add(button); - button = new LabelButton(SVertex.factory(), renderModes, font, "V-Sync", buttonXSize, buttonYSize); + button = new Button(SVertex.factory(), renderModes, font, "V-Sync", buttonXSize, buttonYSize); button.setName(BUTTON_VSYNC); button.translate(xStartLeft,yStartTop - diffY*buttons.size(), 0f); button.setToggleable(true); button.setToggle(gl.getSwapInterval()>0); - button.addMouseListener(new UIShape.MouseGestureAdapter() { + button.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mouseClicked(final MouseEvent e) { cDrawable.invoke(false, new GLRunnable() { @@ -335,12 +336,12 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.addMouseListener(dragZoomRotateListener); buttons.add(button); - button = new LabelButton(SVertex.factory(), renderModes, font, "< Tilt >", buttonXSize, buttonYSize); + button = new Button(SVertex.factory(), renderModes, font, "< Tilt >", buttonXSize, buttonYSize); button.translate(xStartLeft,yStartTop - diffY*buttons.size(), 0f); - button.addMouseListener(new UIShape.MouseGestureAdapter() { + button.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mouseClicked(final MouseEvent e) { - final UIShape.UIShapeEvent shapeEvent = (UIShape.UIShapeEvent) e.getAttachment(); + final Shape.UIShapeEvent shapeEvent = (Shape.UIShapeEvent) e.getAttachment(); if( shapeEvent.objPos[0] < shapeEvent.shape.getBounds().getCenter()[0] ) { rotateButtons(new float[] { 0f, -5f, 0f}); // left-half pressed } else { @@ -354,12 +355,12 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); if( pass2Mode ) { // second column to the left - button = new LabelButton(SVertex.factory(), renderModes, font, "< Samples >", buttonXSize, buttonYSize); + button = new Button(SVertex.factory(), renderModes, font, "< Samples >", buttonXSize, buttonYSize); button.translate(xStartLeft,yStartTop - diffY*buttons.size(), 0f); - button.addMouseListener(new UIShape.MouseGestureAdapter() { + button.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mouseClicked(final MouseEvent e) { - final UIShape.UIShapeEvent shapeEvent = (UIShape.UIShapeEvent) e.getAttachment(); + final Shape.UIShapeEvent shapeEvent = (Shape.UIShapeEvent) e.getAttachment(); int sampleCount = sceneUICntrl.getSampleCount(); if( shapeEvent.objPos[0] < shapeEvent.shape.getBounds().getCenter()[0] ) { // left-half pressed @@ -373,12 +374,12 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.addMouseListener(dragZoomRotateListener); buttons.add(button); - button = new LabelButton(SVertex.factory(), renderModes, font, "< Quality >", buttonXSize, buttonYSize); + button = new Button(SVertex.factory(), renderModes, font, "< Quality >", buttonXSize, buttonYSize); button.translate(xStartLeft,yStartTop - diffY*buttons.size(), 0f); - button.addMouseListener(new UIShape.MouseGestureAdapter() { + button.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mouseClicked(final MouseEvent e) { - final UIShape.UIShapeEvent shapeEvent = (UIShape.UIShapeEvent) e.getAttachment(); + final Shape.UIShapeEvent shapeEvent = (Shape.UIShapeEvent) e.getAttachment(); int quality = shapeEvent.shape.getQuality(); if( shapeEvent.objPos[0] < shapeEvent.shape.getBounds().getCenter()[0] ) { @@ -398,13 +399,13 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); } - button = new LabelButton(SVertex.factory(), renderModes, font, "Quit", buttonXSize, buttonYSize); + button = new Button(SVertex.factory(), renderModes, font, "Quit", buttonXSize, buttonYSize); button.setName(BUTTON_QUIT); button.translate(xStartLeft,yStartTop - diffY*buttons.size(), 0f); button.setColor(0.7f, 0.0f, 0.0f, 1.0f); button.setLabelColor(1.2f, 1.2f, 1.2f); button.setPressedColorMod(1.1f, 0.0f, 0.0f, 1.0f); - button.addMouseListener(new UIShape.MouseGestureAdapter() { + button.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mouseClicked(final MouseEvent e) { new InterruptSource.Thread() { @@ -426,9 +427,9 @@ public class GPUUISceneGLListener0A implements GLEventListener { { final int j = 1; // column int k = 0; // row - button = new LabelButton(SVertex.factory(), renderModes, font, "Y Flip", buttonXSize, buttonYSize); + button = new Button(SVertex.factory(), renderModes, font, "Y Flip", buttonXSize, buttonYSize); button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); - button.addMouseListener(new UIShape.MouseGestureAdapter() { + button.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mouseClicked(final MouseEvent e) { rotateButtons(new float[] { 0f, 180f, 0f}); @@ -437,9 +438,9 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); k++; - button = new LabelButton(SVertex.factory(), renderModes, font, "X Flip", buttonXSize, buttonYSize); + button = new Button(SVertex.factory(), renderModes, font, "X Flip", buttonXSize, buttonYSize); button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); - button.addMouseListener(new UIShape.MouseGestureAdapter() { + button.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mouseClicked(final MouseEvent e) { rotateButtons(new float[] { 180f, 0f, 0f}); @@ -448,12 +449,12 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); k++; - button = new LabelButton(SVertex.factory(), renderModes, font, "+", buttonXSize, buttonYSize); + button = new Button(SVertex.factory(), renderModes, font, "+", buttonXSize, buttonYSize); button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); - button.addMouseListener(new UIShape.MouseGestureAdapter() { + button.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mouseClicked(final MouseEvent e) { - final UIShape.UIShapeEvent shapeEvent = (UIShape.UIShapeEvent) e.getAttachment(); + final Shape.UIShapeEvent shapeEvent = (Shape.UIShapeEvent) e.getAttachment(); // rel position to center final float dx = shapeEvent.objPos[0] - shapeEvent.shape.getBounds().getCenter()[0] ; final float dy = shapeEvent.objPos[1] - shapeEvent.shape.getBounds().getCenter()[1] ; @@ -472,12 +473,12 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); k++; - button = new LabelButton(SVertex.factory(), renderModes, font, "< Space >", buttonXSize, buttonYSize); + button = new Button(SVertex.factory(), renderModes, font, "< Space >", buttonXSize, buttonYSize); button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); - button.addMouseListener(new UIShape.MouseGestureAdapter() { + button.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mouseClicked(final MouseEvent e) { - final UIShape.UIShapeEvent shapeEvent = (UIShape.UIShapeEvent) e.getAttachment(); + final Shape.UIShapeEvent shapeEvent = (Shape.UIShapeEvent) e.getAttachment(); final float dx, dy; if( shapeEvent.objPos[0] < shapeEvent.shape.getBounds().getCenter()[0] ) { dx=-0.01f; dy=-0.005f; @@ -493,12 +494,12 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); k++; - button = new LabelButton(SVertex.factory(), renderModes, font, "< Corner >", buttonXSize, buttonYSize); + button = new Button(SVertex.factory(), renderModes, font, "< Corner >", buttonXSize, buttonYSize); button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); - button.addMouseListener(new UIShape.MouseGestureAdapter() { + button.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mouseClicked(final MouseEvent e) { - final UIShape.UIShapeEvent shapeEvent = (UIShape.UIShapeEvent) e.getAttachment(); + final Shape.UIShapeEvent shapeEvent = (Shape.UIShapeEvent) e.getAttachment(); final float dc; if( shapeEvent.objPos[0] < shapeEvent.shape.getBounds().getCenter()[0] ) { dc=-0.1f; @@ -514,9 +515,9 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); k++; - button = new LabelButton(SVertex.factory(), renderModes, font, "Reset", buttonXSize, buttonYSize); + button = new Button(SVertex.factory(), renderModes, font, "Reset", buttonXSize, buttonYSize); button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); - button.addMouseListener(new UIShape.MouseGestureAdapter() { + button.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mouseClicked(final MouseEvent e) { resetButtons(); @@ -525,9 +526,9 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); k++; - button = new LabelButton(SVertex.factory(), renderModes, font, "Snapshot", buttonXSize, buttonYSize); + button = new Button(SVertex.factory(), renderModes, font, "Snapshot", buttonXSize, buttonYSize); button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); - button.addMouseListener(new UIShape.MouseGestureAdapter() { + button.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mouseClicked(final MouseEvent e) { cDrawable.invoke(false, new GLRunnable() { @@ -559,7 +560,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { if( true ) { final GLMediaPlayer mPlayer = GLMediaPlayerFactory.createDefault(); mPlayer.setTextureUnit(texUnitMediaPlayer); - final MediaPlayerButton mPlayerButton = new MediaPlayerButton(sceneUICntrl.getVertexFactory(), renderModes, + final MediaButton mPlayerButton = new MediaButton(sceneUICntrl.getVertexFactory(), renderModes, button2XSize, button2YSize, mPlayer); mPlayerButton.setName(BUTTON_MOVIE); mPlayerButton.setVerbose(true); @@ -569,7 +570,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { mPlayerButton.setToggle(false); // toggle == false -> mute audio mPlayerButton.setToggleOffColorMod(0f, 1f, 0f, 1.0f); mPlayerButton.addMouseListener(dragZoomRotateListener); - mPlayerButton.addMouseListener(new UIShape.MouseGestureAdapter() { + mPlayerButton.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mouseClicked(final MouseEvent e) { mPlayer.setAudioVolume( mPlayerButton.isToggleOn() ? 1f : 0f ); @@ -584,7 +585,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { } if( true ) { final ImageSequence imgSeq = new ImageSequence(texUnitImageButton, true); - final ImageSeqButton imgButton = new ImageSeqButton(sceneUICntrl.getVertexFactory(), renderModes, + final ImageButton imgButton = new ImageButton(sceneUICntrl.getVertexFactory(), renderModes, button2XSize, button2YSize, imgSeq); try { imgSeq.addFrame(gl, GPUUISceneGLListener0A.class, "button-released-145x53.png", TextureIO.PNG); @@ -595,7 +596,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { imgSeq.setManualStepping(true); imgButton.translate(xStartRight, yStartTop - diffY*2.5f, 0f); imgButton.addMouseListener(dragZoomRotateListener); - imgButton.addMouseListener(new UIShape.MouseGestureAdapter() { + imgButton.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mousePressed(final MouseEvent e) { imgButton.setCurrentIdx(1); @@ -617,7 +618,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { gears.setClearColor(new float[] { 0.9f, 0.9f, 0.9f, 1f } ); glel = gears; } - final GLEventListenerButton glelButton = new GLEventListenerButton(sceneUICntrl.getVertexFactory(), renderModes, + final GLButton glelButton = new GLButton(sceneUICntrl.getVertexFactory(), renderModes, button2XSize, button2YSize, texUnitGLELButton, glel, false /* useAlpha */, (int)(button2XSize), (int)(button2YSize)); @@ -627,7 +628,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { glelButton.setAnimate(false); glelButton.translate(xStartRight, yStartTop - diffY*4f, 0f); glelButton.addMouseListener(dragZoomRotateListener); - glelButton.addMouseListener(new UIShape.MouseGestureAdapter() { + glelButton.addMouseListener(new Shape.MouseGestureAdapter() { @Override public void mouseClicked(final MouseEvent e) { glelButton.setAnimate( glelButton.isToggleOn() ); @@ -897,7 +898,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { if( null == actionText ) { text = sceneUICntrl.getStatusText(drawable, renderModes, fpsLabel.getQuality(), dpiV); } else if( null != drawable.getAnimator() ) { - text = SceneUIController.getStatusText(drawable.getAnimator())+", "+actionText; + text = Scene.getStatusText(drawable.getAnimator())+", "+actionText; } else { text = actionText; } @@ -920,7 +921,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { * We can share this instance w/ all UI elements, * since only mouse action / gesture is complete for a single one (press, drag, released and click). */ - private final UIShape.MouseGestureAdapter dragZoomRotateListener = new UIShape.MouseGestureAdapter() { + private final Shape.MouseGestureAdapter dragZoomRotateListener = new Shape.MouseGestureAdapter() { @Override public void mouseReleased(final MouseEvent e) { actionText = null; @@ -928,7 +929,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { @Override public void mouseDragged(final MouseEvent e) { - final UIShape.UIShapeEvent shapeEvent = (UIShape.UIShapeEvent) e.getAttachment(); + final Shape.UIShapeEvent shapeEvent = (Shape.UIShapeEvent) e.getAttachment(); if( e.getPointerCount() == 1 ) { final float[] tx = shapeEvent.shape.getTranslate(); actionText = String.format((Locale)null, "Pos %6.2f / %6.2f / %6.2f", tx[0], tx[1], tx[2]); @@ -937,7 +938,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { @Override public void mouseWheelMoved(final MouseEvent e) { - final UIShape.UIShapeEvent shapeEvent = (UIShape.UIShapeEvent) e.getAttachment(); + final Shape.UIShapeEvent shapeEvent = (Shape.UIShapeEvent) e.getAttachment(); final boolean isOnscreen = PointerClass.Onscreen == e.getPointerType(0).getPointerClass(); if( 0 == ( ~InputEvent.BUTTONALL_MASK & e.getModifiers() ) && !isOnscreen ) { // offscreen vertical mouse wheel zoom @@ -957,7 +958,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { } @Override public void gestureDetected(final GestureEvent e) { - final UIShape.UIShapeEvent shapeEvent = (UIShape.UIShapeEvent) e.getAttachment(); + final Shape.UIShapeEvent shapeEvent = (Shape.UIShapeEvent) e.getAttachment(); if( e instanceof PinchToZoomGesture.ZoomEvent ) { final PinchToZoomGesture.ZoomEvent ze = (PinchToZoomGesture.ZoomEvent) e; final float tz = ze.getDelta() * ze.getScale(); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/ui/demos/GPUUISceneNewtCanvasAWTDemo.java index 4ca8401dc..c279079b7 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/ui/demos/GPUUISceneNewtCanvasAWTDemo.java @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos; +package com.jogamp.opengl.test.junit.graph.ui.demos; import java.awt.Component; import java.awt.Frame; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/ui/demos/GPUUISceneNewtDemo.java index b4fd16796..36e8ee713 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/ui/demos/GPUUISceneNewtDemo.java @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos; +package com.jogamp.opengl.test.junit.graph.ui.demos; import com.jogamp.nativewindow.ScalableSurface; import com.jogamp.opengl.GLCapabilities; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneTextAnim01.java b/src/test/com/jogamp/opengl/test/junit/graph/ui/demos/GPUUISceneTextAnim01.java index e9bbfc0fb..49757e7a0 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneTextAnim01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/ui/demos/GPUUISceneTextAnim01.java @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos; +package com.jogamp.opengl.test.junit.graph.ui.demos; import java.io.File; import java.io.IOException; @@ -40,6 +40,9 @@ import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontScale; import com.jogamp.graph.geom.SVertex; +import com.jogamp.graph.ui.gl.Scene; +import com.jogamp.graph.ui.gl.Shape; +import com.jogamp.graph.ui.gl.shapes.Label; import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.Window; import com.jogamp.newt.event.GestureHandler.GestureEvent; @@ -58,9 +61,7 @@ import com.jogamp.opengl.JoglVersion; import com.jogamp.opengl.math.FloatUtil; import com.jogamp.opengl.math.VectorUtil; import com.jogamp.opengl.test.junit.graph.FontSet01; -import com.jogamp.opengl.test.junit.graph.demos.ui.Label; -import com.jogamp.opengl.test.junit.graph.demos.ui.SceneUIController; -import com.jogamp.opengl.test.junit.graph.demos.ui.UIShape; +import com.jogamp.opengl.test.junit.graph.demos.MSAATool; import com.jogamp.opengl.util.GLReadBufferUtil; public class GPUUISceneTextAnim01 implements GLEventListener { @@ -69,7 +70,7 @@ public class GPUUISceneTextAnim01 implements GLEventListener { private boolean trace = false; private final float noAADPIThreshold; - private final SceneUIController sceneUICntrl; + private final Scene sceneUICntrl; /** -1 == AUTO, TBD @ init(..) */ private int renderModes; @@ -140,7 +141,7 @@ public class GPUUISceneTextAnim01 implements GLEventListener { rs.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); // renderer = RegionRenderer.create(rs, null, null); - sceneUICntrl = new SceneUIController(renderer, sceneDist, zNear, zFar); + sceneUICntrl = new Scene(renderer, sceneDist, zNear, zFar); // sceneUIController.setSampleCount(3); // easy on embedded devices w/ just 3 samples (default is 4)? } screenshot = new GLReadBufferUtil(false, false); @@ -279,7 +280,7 @@ public class GPUUISceneTextAnim01 implements GLEventListener { if( null == actionText ) { text = sceneUICntrl.getStatusText(drawable, renderModes, fpsLabel.getQuality(), dpiV); } else if( null != drawable.getAnimator() ) { - text = SceneUIController.getStatusText(drawable.getAnimator())+", "+actionText; + text = Scene.getStatusText(drawable.getAnimator())+", "+actionText; } else { text = actionText; } @@ -302,7 +303,7 @@ public class GPUUISceneTextAnim01 implements GLEventListener { * We can share this instance w/ all UI elements, * since only mouse action / gesture is complete for a single one (press, drag, released and click). */ - private final UIShape.MouseGestureAdapter dragZoomRotateListener = new UIShape.MouseGestureAdapter() { + private final Shape.MouseGestureAdapter dragZoomRotateListener = new Shape.MouseGestureAdapter() { @Override public void mouseReleased(final MouseEvent e) { actionText = null; @@ -310,7 +311,7 @@ public class GPUUISceneTextAnim01 implements GLEventListener { @Override public void mouseDragged(final MouseEvent e) { - final UIShape.UIShapeEvent shapeEvent = (UIShape.UIShapeEvent) e.getAttachment(); + final Shape.UIShapeEvent shapeEvent = (Shape.UIShapeEvent) e.getAttachment(); if( e.getPointerCount() == 1 ) { final float[] tx = shapeEvent.shape.getTranslate(); actionText = String.format((Locale)null, "Pos %6.2f / %6.2f / %6.2f", tx[0], tx[1], tx[2]); @@ -319,7 +320,7 @@ public class GPUUISceneTextAnim01 implements GLEventListener { @Override public void mouseWheelMoved(final MouseEvent e) { - final UIShape.UIShapeEvent shapeEvent = (UIShape.UIShapeEvent) e.getAttachment(); + final Shape.UIShapeEvent shapeEvent = (Shape.UIShapeEvent) e.getAttachment(); final boolean isOnscreen = PointerClass.Onscreen == e.getPointerType(0).getPointerClass(); if( 0 == ( ~InputEvent.BUTTONALL_MASK & e.getModifiers() ) && !isOnscreen ) { // offscreen vertical mouse wheel zoom @@ -339,7 +340,7 @@ public class GPUUISceneTextAnim01 implements GLEventListener { } @Override public void gestureDetected(final GestureEvent e) { - final UIShape.UIShapeEvent shapeEvent = (UIShape.UIShapeEvent) e.getAttachment(); + final Shape.UIShapeEvent shapeEvent = (Shape.UIShapeEvent) e.getAttachment(); if( e instanceof PinchToZoomGesture.ZoomEvent ) { final PinchToZoomGesture.ZoomEvent ze = (PinchToZoomGesture.ZoomEvent) e; final float tz = ze.getDelta() * ze.getScale(); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/UIShapeDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/ui/demos/UIShapeDemo01.java index 656345694..7ccd80f46 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/UIShapeDemo01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/ui/demos/UIShapeDemo01.java @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos; +package com.jogamp.opengl.test.junit.graph.ui.demos; import java.io.File; import java.io.IOException; @@ -44,9 +44,7 @@ import com.jogamp.opengl.GLRunnable; import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.math.FloatUtil; import com.jogamp.opengl.math.geom.AABBox; -import com.jogamp.opengl.test.junit.graph.demos.ui.CrossHair; -import com.jogamp.opengl.test.junit.graph.demos.ui.LabelButton; -import com.jogamp.opengl.test.junit.graph.demos.ui.UIShape; +import com.jogamp.opengl.test.junit.graph.demos.MSAATool; import com.jogamp.common.util.InterruptSource; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RegionRenderer; @@ -57,6 +55,9 @@ import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontSet; import com.jogamp.graph.geom.SVertex; import com.jogamp.graph.geom.plane.AffineTransform; +import com.jogamp.graph.ui.gl.Shape; +import com.jogamp.graph.ui.gl.shapes.Button; +import com.jogamp.graph.ui.gl.shapes.CrossHair; import com.jogamp.newt.Window; import com.jogamp.newt.event.KeyAdapter; import com.jogamp.newt.event.KeyEvent; @@ -150,7 +151,7 @@ public class UIShapeDemo01 implements GLEventListener { private final boolean debug; private final boolean trace; - private final LabelButton button; + private final Button button; private final CrossHair crossHair; private KeyAction keyAction; @@ -179,7 +180,7 @@ public class UIShapeDemo01 implements GLEventListener { this.trace = trace; this.screenshot = new GLReadBufferUtil(false, false); - button = new LabelButton(SVertex.factory(), renderModes, font, "Click me!", 1/8f, 1/16f); + button = new Button(SVertex.factory(), renderModes, font, "Click me!", 1/8f, 1/16f); button.setLabelColor(0.0f,0.0f,0.0f); /** Button defaults ! button.setLabelColor(1.0f,1.0f,1.0f); @@ -233,7 +234,7 @@ public class UIShapeDemo01 implements GLEventListener { final int[] sampleCount = { 4 }; - private void drawShape(final GL2ES2 gl, final PMVMatrix pmv, final RegionRenderer renderer, final UIShape shape) { + private void drawShape(final GL2ES2 gl, final PMVMatrix pmv, final RegionRenderer renderer, final Shape shape) { pmv.glPushMatrix(); shape.setTransform(pmv); shape.drawShape(gl, renderer, sampleCount); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/UITypeDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/ui/demos/UITypeDemo01.java index 212a0aff0..b2a1bc772 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/UITypeDemo01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/ui/demos/UITypeDemo01.java @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.demos; +package com.jogamp.opengl.test.junit.graph.ui.demos; import java.io.File; import java.io.IOException; @@ -44,12 +44,10 @@ import com.jogamp.opengl.GLRunnable; import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.math.FloatUtil; import com.jogamp.opengl.math.geom.AABBox; -import com.jogamp.opengl.test.junit.graph.demos.ui.CrossHair; -import com.jogamp.opengl.test.junit.graph.demos.ui.Rectangle; -import com.jogamp.opengl.test.junit.graph.demos.ui.UIShape; -import com.jogamp.opengl.test.junit.graph.testshapes.Glyph03FreeMonoRegular_M; -import com.jogamp.opengl.test.junit.graph.testshapes.Glyph04FreeSans_0; -import com.jogamp.opengl.test.junit.graph.testshapes.Glyph05FreeSerifBoldItalic_ae; +import com.jogamp.opengl.test.junit.graph.demos.MSAATool; +import com.jogamp.opengl.test.junit.graph.ui.testshapes.Glyph03FreeMonoRegular_M; +import com.jogamp.opengl.test.junit.graph.ui.testshapes.Glyph04FreeSans_0; +import com.jogamp.opengl.test.junit.graph.ui.testshapes.Glyph05FreeSerifBoldItalic_ae; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.common.util.InterruptSource; import com.jogamp.graph.curve.Region; @@ -63,6 +61,9 @@ import com.jogamp.graph.font.FontSet; import com.jogamp.graph.font.Font.Glyph; import com.jogamp.graph.geom.SVertex; import com.jogamp.graph.geom.plane.AffineTransform; +import com.jogamp.graph.ui.gl.Shape; +import com.jogamp.graph.ui.gl.shapes.CrossHair; +import com.jogamp.graph.ui.gl.shapes.Rectangle; import com.jogamp.newt.Window; import com.jogamp.newt.event.KeyAdapter; import com.jogamp.newt.event.KeyEvent; @@ -169,7 +170,7 @@ public class UITypeDemo01 implements GLEventListener { private final boolean trace; private final CrossHair crossHair; - private final UIShape testObj; + private final Shape testObj; private KeyAction keyAction; private MouseAction mouseAction; @@ -211,7 +212,7 @@ public class UITypeDemo01 implements GLEventListener { } else { final float scale = 0.15312886f; final float size_xz = 0.541f; - final UIShape o = new Glyph03FreeMonoRegular_M(SVertex.factory(), renderModes); + final Shape o = new Glyph03FreeMonoRegular_M(SVertex.factory(), renderModes); o.scale(scale, scale, 1f); // o.translate(size_xz, -size_xz, 0f); testObj = o; @@ -260,7 +261,7 @@ public class UITypeDemo01 implements GLEventListener { final int[] sampleCount = { 4 }; - private void drawShape(final GL2ES2 gl, final PMVMatrix pmv, final RegionRenderer renderer, final UIShape shape) { + private void drawShape(final GL2ES2 gl, final PMVMatrix pmv, final RegionRenderer renderer, final Shape shape) { pmv.glPushMatrix(); shape.setTransform(pmv); shape.drawShape(gl, renderer, sampleCount); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/button-pressed-145x53.png b/src/test/com/jogamp/opengl/test/junit/graph/ui/demos/button-pressed-145x53.png Binary files differindex 1eba3a09e..1eba3a09e 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/button-pressed-145x53.png +++ b/src/test/com/jogamp/opengl/test/junit/graph/ui/demos/button-pressed-145x53.png diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/button-released-145x53.png b/src/test/com/jogamp/opengl/test/junit/graph/ui/demos/button-released-145x53.png Binary files differindex fe223c6d3..fe223c6d3 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/button-released-145x53.png +++ b/src/test/com/jogamp/opengl/test/junit/graph/ui/demos/button-released-145x53.png diff --git a/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph01UbuntuLight_o.java b/src/test/com/jogamp/opengl/test/junit/graph/ui/testshapes/Glyph01UbuntuLight_o.java index f1ef69800..a79a68d4e 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph01UbuntuLight_o.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/ui/testshapes/Glyph01UbuntuLight_o.java @@ -25,22 +25,22 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.testshapes; +package com.jogamp.opengl.test.junit.graph.ui.testshapes; import com.jogamp.opengl.GL2ES2; -import com.jogamp.opengl.test.junit.graph.demos.ui.UIShape; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.geom.plane.Winding; +import com.jogamp.graph.ui.gl.Shape; /** * GPU based resolution independent test object * - Ubuntu-Light, lower case 'o' * - TTF Shape for Glyph 82 */ -public class Glyph01UbuntuLight_o extends UIShape { +public class Glyph01UbuntuLight_o extends Shape { public Glyph01UbuntuLight_o(final Factory<? extends Vertex> factory, final int renderModes) { super(factory, renderModes); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph02UbuntuLight_ae.java b/src/test/com/jogamp/opengl/test/junit/graph/ui/testshapes/Glyph02UbuntuLight_ae.java index 0b024f970..b81eb546f 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph02UbuntuLight_ae.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/ui/testshapes/Glyph02UbuntuLight_ae.java @@ -25,21 +25,21 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.testshapes; +package com.jogamp.opengl.test.junit.graph.ui.testshapes; import com.jogamp.opengl.GL2ES2; -import com.jogamp.opengl.test.junit.graph.demos.ui.UIShape; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; +import com.jogamp.graph.ui.gl.Shape; /** * GPU based resolution independent test object * - Ubuntu-Light, lower case 'æ' * - TTF Shape for Glyph 193 */ -public class Glyph02UbuntuLight_ae extends UIShape { +public class Glyph02UbuntuLight_ae extends Shape { public Glyph02UbuntuLight_ae(final Factory<? extends Vertex> factory, final int renderModes) { super(factory, renderModes); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph03FreeMonoRegular_M.java b/src/test/com/jogamp/opengl/test/junit/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java index 55fc7609e..053134866 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph03FreeMonoRegular_M.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java @@ -25,21 +25,21 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.testshapes; +package com.jogamp.opengl.test.junit.graph.ui.testshapes; import com.jogamp.opengl.GL2ES2; -import com.jogamp.opengl.test.junit.graph.demos.ui.UIShape; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; +import com.jogamp.graph.ui.gl.Shape; /** * GPU based resolution independent test object * - FreeMono-Regular, capital case 'M' * - TTF Shape for Glyph 48 */ -public class Glyph03FreeMonoRegular_M extends UIShape { +public class Glyph03FreeMonoRegular_M extends Shape { public Glyph03FreeMonoRegular_M(final Factory<? extends Vertex> factory, final int renderModes) { super(factory, renderModes); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph04FreeSans_0.java b/src/test/com/jogamp/opengl/test/junit/graph/ui/testshapes/Glyph04FreeSans_0.java index 5b677b622..1f8d87888 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph04FreeSans_0.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/ui/testshapes/Glyph04FreeSans_0.java @@ -25,21 +25,21 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.testshapes; +package com.jogamp.opengl.test.junit.graph.ui.testshapes; import com.jogamp.opengl.GL2ES2; -import com.jogamp.opengl.test.junit.graph.demos.ui.UIShape; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; +import com.jogamp.graph.ui.gl.Shape; /** * GPU based resolution independent test object * - FreeSans, '0' * - TTF Shape for Glyph 19 */ -public class Glyph04FreeSans_0 extends UIShape { +public class Glyph04FreeSans_0 extends Shape { public Glyph04FreeSans_0(final Factory<? extends Vertex> factory, final int renderModes) { super(factory, renderModes); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph05FreeSerifBoldItalic_ae.java b/src/test/com/jogamp/opengl/test/junit/graph/ui/testshapes/Glyph05FreeSerifBoldItalic_ae.java index e7f726b1f..c02ca56bc 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/testshapes/Glyph05FreeSerifBoldItalic_ae.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/ui/testshapes/Glyph05FreeSerifBoldItalic_ae.java @@ -25,21 +25,21 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ -package com.jogamp.opengl.test.junit.graph.testshapes; +package com.jogamp.opengl.test.junit.graph.ui.testshapes; import com.jogamp.opengl.GL2ES2; -import com.jogamp.opengl.test.junit.graph.demos.ui.UIShape; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; +import com.jogamp.graph.ui.gl.Shape; /** * GPU based resolution independent test object * - FreeSans, '0' * - TTF Shape for Glyph 19 */ -public class Glyph05FreeSerifBoldItalic_ae extends UIShape { +public class Glyph05FreeSerifBoldItalic_ae extends Shape { public Glyph05FreeSerifBoldItalic_ae(final Factory<? extends Vertex> factory, final int renderModes) { super(factory, renderModes); |