X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=sixth-3d-demos.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Fexamples%2FTextEditorDemo.java;h=a2a46694bb1f69f0694818fc9ccf5f8008716f6b;hp=bc98ff77f24cec6988a265b94ee8bfea91f52353;hb=bd6502aee14dbda7936780fd81d1b1520c2d1cb8;hpb=efd2a72758ee107b48cf4795e05ffb9219fd1d8b diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/TextEditorDemo.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/TextEditorDemo.java index bc98ff7..a2a4669 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/TextEditorDemo.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/TextEditorDemo.java @@ -1,18 +1,18 @@ /* - * Sixth 3D engine demos. Copyright ©2012-2019, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Sixth 3D engine demos. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - */ +*/ package eu.svjatoslav.sixth.e3d.examples; import eu.svjatoslav.sixth.e3d.geometry.Point2D; import eu.svjatoslav.sixth.e3d.geometry.Point3D; import eu.svjatoslav.sixth.e3d.geometry.Rectangle; +import eu.svjatoslav.sixth.e3d.gui.Avatar; import eu.svjatoslav.sixth.e3d.gui.ViewFrame; import eu.svjatoslav.sixth.e3d.gui.ViewPanel; +import eu.svjatoslav.sixth.e3d.gui.textEditorComponent.LookAndFeel; import eu.svjatoslav.sixth.e3d.gui.textEditorComponent.TextEditComponent; import eu.svjatoslav.sixth.e3d.math.Transform; import eu.svjatoslav.sixth.e3d.renderer.raster.Color; @@ -22,17 +22,6 @@ import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe.Grid2D public class TextEditorDemo { - private static Grid2D createGrid() { - final Transform transform = new Transform(new Point3D(0, 100, 0), 0, - Math.PI / 2); - - final Rectangle rectangle = new Rectangle(2000); - final LineAppearance appearance = new LineAppearance(10, new Color( - "00b3ad")); - - return new Grid2D(transform, rectangle, 10, 10, appearance); - } - public static void main(final String[] args) { final ViewFrame viewFrame = new ViewFrame(); @@ -41,22 +30,41 @@ public class TextEditorDemo { final ShapeCollection shapeCollection = viewFrame.getViewPanel() .getRootShapeCollection(); - shapeCollection.addShape(createGrid()); + setAvatarLocation(viewPanel); + + addGrid(shapeCollection); + + addTextEditors(viewPanel, shapeCollection); + } + private static void addGrid(ShapeCollection shapeCollection) { + final Transform transform = new Transform(new Point3D(0, 100, 0), 0, + Math.PI / 2); + + final Rectangle rectangle = new Rectangle(2000); + final LineAppearance appearance = new LineAppearance(10, new Color( + "00b3ad")); + + shapeCollection.addShape(new Grid2D(transform, rectangle, 10, 10, appearance)); + } + + private static void addTextEditors(ViewPanel viewPanel, ShapeCollection shapeCollection) { final double m = 1.5; for (double z = -500 * m; z <= (500 * m); z += 250 * m) for (double x = -500 * m; x <= (500 * m); x += 250 * m) { final TextEditComponent textEditor = new TextEditComponent( new Transform(new Point3D(x, 0, z)), viewPanel, - new Point2D(200, 120)); + new Point2D(200, 120), new LookAndFeel()); shapeCollection.addShape(textEditor); } + } - viewPanel.getAvatar().setLocation(new Point3D(500, -300, -800)); - viewPanel.getAvatar().setAngleXZ(0.6); - viewPanel.getAvatar().setAngleYZ(-0.5); - + private static void setAvatarLocation(ViewPanel viewPanel) { + Avatar avatar = viewPanel.getAvatar(); + avatar.setLocation(new Point3D(500, -300, -800)); + avatar.setAngleXZ(0.6); + avatar.setAngleYZ(-0.5); } }