diff options
author | Sven Gothel <[email protected]> | 2023-04-18 05:43:24 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-04-18 05:43:24 +0200 |
commit | 3ecba411d2677beee1996ebe9f3017c3fa3ef69e (patch) | |
tree | 543f3126b3eee9a7f4ed3e823125cc249c8f9213 /src/demos/com/jogamp/opengl | |
parent | 84ef03374eb1ebef08c2bd5c764a45f9ad21cec1 (diff) |
GraphUI Padding: Use CSS alike ctor semantics, hence swizzle ctor arguments
Diffstat (limited to 'src/demos/com/jogamp/opengl')
3 files changed, 5 insertions, 48 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java index 4cd5cd49b..86869b5a6 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java @@ -161,7 +161,7 @@ public class FontView01 { final int cellCount = gridCols * gridRows; final float gridSize = gridCols > gridRows ? 1f/gridCols : 1f/gridRows; System.err.println("Grid "+gridCols+" x "+gridRows+", "+cellCount+" cells, gridSize "+gridSize); - final Group mainGrid = new Group(new GridLayout(gridCols, gridSize, gridSize, new Padding(gridSize*0.1f, gridSize*0.1f))); + final Group mainGrid = new Group(new GridLayout(gridCols, gridSize, gridSize, new Padding(gridSize*0.05f, gridSize*0.05f))); final Group glyphCont = new Group(); { @@ -175,7 +175,7 @@ public class FontView01 { glyphInfo.setColor(0.1f, 0.1f, 0.1f, 1.0f); infoCont.addShape(glyphInfo); } - final Group infoGrid = new Group(new GridLayout(1/2f, 1/2f, new Padding(1/2f*0.01f, 1/2f*0.01f), 2)); + final Group infoGrid = new Group(new GridLayout(1/2f, 1/2f, new Padding(1/2f*0.005f, 1/2f*0.005f), 2)); infoGrid.addShape(glyphCont); infoGrid.addShape(infoCont); 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 68ee8da94..001f585fd 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java @@ -40,8 +40,6 @@ import com.jogamp.graph.ui.Shape; import com.jogamp.graph.ui.layout.GridLayout; import com.jogamp.graph.ui.layout.Padding; import com.jogamp.graph.ui.shapes.Button; -import com.jogamp.graph.ui.shapes.GLButton; -import com.jogamp.newt.event.MouseEvent; import com.jogamp.newt.event.WindowAdapter; import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.opengl.GLWindow; @@ -83,7 +81,7 @@ public class UISceneDemo11 { final Font font = FontFactory.get(FontFactory.UBUNTU).get(FontSet.FAMILY_LIGHT, FontSet.STYLE_SERIF); System.err.println("Font: "+font.getFullFamilyName()); - final Group groupA0 = new Group(new GridLayout(2, 1f, 1/2f, new Padding(0.1f, 0.1f))); + final Group groupA0 = new Group(new GridLayout(2, 1f, 1/2f, new Padding(0.05f, 0.05f))); { 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) ); @@ -204,45 +202,4 @@ public class UISceneDemo11 { window.destroy(); } } - - static Shape makeGLButton(final float sw, final float sh, final Font font, final int renderModes) { - final GearsES2 gears = new GearsES2(0); - gears.setVerbose(false); - gears.setClearColor(new float[] { 0.9f, 0.9f, 0.9f, 1f } ); - final boolean[] animate = { true }; - new Thread(new Runnable() { - @Override - public void run() { - System.err.println("Gears Anim: Waiting"); - try { - gears.waitForInit(true); - } catch (final InterruptedException e) { } - System.err.println("Gears Anim: Started"); - while( gears.isInit() ) { - if( animate[0] ) { - final float ry = ( gears.getRotY() + 1 ) % 360; - gears.setRotY(ry); - } - try { - Thread.sleep(15); - } catch (final InterruptedException e) { } - } - System.err.println("Gears Anim: End"); - } - }).start(); - final int texUnit = 1; - final GLButton b = new GLButton(renderModes, sw, - sh, texUnit, gears, false /* useAlpha */); - b.setToggleable(true); - b.setToggle(true); // toggle == true -> animation - b.setAnimate(true); - b.addMouseListener(new Shape.MouseGestureAdapter() { - @Override - public void mouseClicked(final MouseEvent e) { - b.setAnimate( b.isToggleOn() ); - animate[0] = b.getAnimate(); - } } ); - return b; - } - } 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 143b40651..735192715 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java @@ -384,12 +384,12 @@ public class UISceneDemo20 implements GLEventListener { final float buttonLWidth = buttonXSizeNorm; final float buttonLHeight = buttonLWidth / 2.5f; - buttonsLeft.setLayout(new GridLayout(buttonLWidth, buttonLHeight, new Padding(buttonLWidth*0.1f, buttonLHeight*0.5f), 7)); + buttonsLeft.setLayout(new GridLayout(buttonLWidth, buttonLHeight, new Padding(buttonLHeight*0.25f, buttonLWidth*0.05f), 7)); final float buttonRWidth = 2f*buttonLWidth; final float buttonRHeight = 2f*buttonLHeight; - buttonsRight.setLayout(new GridLayout(1, buttonRWidth, buttonRHeight, new Padding(buttonLWidth*0.1f, buttonLHeight*0.5f))); + buttonsRight.setLayout(new GridLayout(1, buttonRWidth, buttonRHeight, new Padding(buttonLHeight*0.25f, buttonLWidth*0.05f))); System.err.println("Button Size: "+buttonLWidth+" x "+buttonLHeight); |