diff options
author | Sven Gothel <[email protected]> | 2023-09-04 05:39:05 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-09-04 06:28:26 +0200 |
commit | 4ca9efd6759856f46eb0cedde28998bc2b68d2cb (patch) | |
tree | e3793bf608e2f71a1e1a76604f105e4e924f168e /src/demos/com/jogamp | |
parent | c3bb3fb871a92a71e7a6b05897a3dd9b62842fc5 (diff) |
GraphUI: Button/Label: Complete String -> CharSequence type change for text, rename Button set{Label->Text}(..), adjust demo/text code
Diffstat (limited to 'src/demos/com/jogamp')
7 files changed, 11 insertions, 18 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java index 106944449..10803e256 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java @@ -77,12 +77,7 @@ public class UISceneDemo01b { final Font font = FontFactory.get(FontFactory.UBUNTU).get(FontSet.FAMILY_LIGHT, FontSet.STYLE_SERIF); System.err.println("Font: "+font.getFullFamilyName()); - final Shape shape; - { - final Button b = new Button(options.renderModes, font, "L", 1/8f, 1/8f/2.5f); // normalized: 1 is 100% surface size (width and/or height) - b.setCorner(0f); - shape = b; - } + final Shape shape = new Button(options.renderModes, font, "L", 1/8f, 1/8f/2.5f).setPerp(); // normalized: 1 is 100% surface size (width and/or height) shape.getRotation().rotateByAngleX(FloatUtil.PI); shape.getRotation().rotateByAngleY(FloatUtil.PI); System.err.println("Shape bounds "+shape.getBounds(reqGLP)); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java index a670b02f8..f2fe509b2 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java @@ -207,7 +207,7 @@ public class UISceneDemo02 { destText.validate(hasGLP); movingGlyph.setText(hasGLP, movingChar[0]); final float start_pos = sceneBox.getMaxX() - movingGlyph.getScaledWidth(); - final float end_pos = sceneBox.getMinX() + ( destText.getText().isEmpty() ? 0 : destText.getScaledWidth() ); + final float end_pos = sceneBox.getMinX() + ( destText.getText().length() == 0 ? 0 : destText.getScaledWidth() ); movingGlyph.moveTo(start_pos, 0f, 0f); final PMVMatrix pmv = new PMVMatrix(); @@ -265,7 +265,7 @@ public class UISceneDemo02 { System.err.printf("Actual char travel-duration %.3f s, %.3f mm/s, delay exp %.3f s, req %.3f%n", has_dur_s, (dist_m/has_dur_s)*1e3f, has_dur_s-exp_dur_s, has_dur_s-req_dur_s); } - destText.setText(destText.getText() + movingGlyph.getText()); + destText.setText( new StringBuilder(destText.getText()).append(movingGlyph.getText()) ); movingGlyph.setText(""); } final float has_dur_s = ( ( Clock.currentNanos() / 1000 ) - t0_us ) / 1e6f; // [us] diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java index 00a4854a6..6f720cb3e 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java @@ -260,9 +260,7 @@ public class UISceneDemo10 { } } ); return b; } else if( true ){ - final Button b = new Button(renderModes, font, "+", sw, sh); - b.setCorner(0.0f); - return b; + return new Button(renderModes, font, "+", sw, sh).setPerp(); } else { final CrossHair b = new CrossHair(renderModes, sw, sw, 1f/100f); return b; diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java index eb5c4d3e2..120ab6203 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java @@ -86,10 +86,10 @@ public class UISceneDemo11 { final Group groupA0 = new Group(new GridLayout(2, 1f, 1/2f, Alignment.Fill, new Gap(0.10f))); { - groupA0.addShape( new Button(options.renderModes, font, "r1 c1", 1f, 1f/2f).setCorner(0f).setDragAndResizeable(false) ); - groupA0.addShape( new Button(options.renderModes, font, "r1 c2", 1f, 1f/2f).setCorner(0f).setDragAndResizeable(false) ); - groupA0.addShape( new Button(options.renderModes, font, "r2 c1", 1f, 1f/2f).setCorner(0f).setDragAndResizeable(false) ); - groupA0.addShape( new Button(options.renderModes, font, "r2 c2", 1f, 1f/2f).setCorner(0f).setDragAndResizeable(false) ); + groupA0.addShape( new Button(options.renderModes, font, "r1 c1", 1f, 1f/2f).setPerp().setDragAndResizeable(false) ); + groupA0.addShape( new Button(options.renderModes, font, "r1 c2", 1f, 1f/2f).setPerp().setDragAndResizeable(false) ); + groupA0.addShape( new Button(options.renderModes, font, "r2 c1", 1f, 1f/2f).setPerp().setDragAndResizeable(false) ); + groupA0.addShape( new Button(options.renderModes, font, "r2 c2", 1f, 1f/2f).setPerp().setDragAndResizeable(false) ); } groupA0.setInteractive(true); groupA0.scale(1/8f, 1/8f, 1); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java index c9aa8078d..6204cd501 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java @@ -457,7 +457,7 @@ public class UISceneDemo20 implements GLEventListener { shape.setSpacing(Button.DEFAULT_SPACING_X, Button.DEFAULT_SPACING_Y); } - shape.setLabel(s); + shape.setText(s); } private void initButtons(final GL2ES2 gl) { diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java index cc918c9fe..134892622 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java @@ -344,7 +344,7 @@ public class UIShapeDemo01 implements GLEventListener { } public void printScreen(final GLAutoDrawable drawable, final String dir, final String tech, final String objName, final boolean exportAlpha) throws GLException, IOException { - final String sw = String.format("-%03dx%03d-Z%04d-T%04d-%s", drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), (int)Math.abs(zTran), 0, objName); + final String sw = String.format("-%03dx%03d-Z%04d-T%04d-%s", drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), (int)FloatUtil.abs(zTran), 0, objName); final String filename = dir + tech + sw +".png"; if(screenshot.readPixels(drawable.getGL(), false)) { diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java index ecd7b1ccf..6af975e7c 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java @@ -413,7 +413,7 @@ public class UITypeDemo01 implements GLEventListener { final String tech="demo-"+Region.getRenderModeString(renderModes); final String objName = "snap"+screenshot_num; { - final String sw = String.format("-%03dx%03d-Z%04d-T%04d-%s", drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), (int)Math.abs(zTran), 0, objName); + final String sw = String.format("-%03dx%03d-Z%04d-T%04d-%s", drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), (int)FloatUtil.abs(zTran), 0, objName); final String filename = dir + tech + sw +".png"; if(screenshot.readPixels(drawable.getGL(), false)) { |