Code cleanup and formatting.
[sixth-3d-demos.git] / src / main / java / eu / svjatoslav / sixth / e3d / examples / RainingNumbersDemo.java
index a077cb9..c42f6f8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sixth 3D engine demos. Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ * Sixth 3D engine demos. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
  *
  * 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
@@ -9,34 +9,33 @@
 package eu.svjatoslav.sixth.e3d.examples;
 
 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
-import eu.svjatoslav.sixth.e3d.geometry.Transform;
-import eu.svjatoslav.sixth.e3d.gui.ViewContext;
 import eu.svjatoslav.sixth.e3d.gui.ViewFrame;
-import eu.svjatoslav.sixth.e3d.gui.ViewUpdateListener;
+import eu.svjatoslav.sixth.e3d.gui.ViewPanel;
+import eu.svjatoslav.sixth.e3d.gui.ViewRenderListener;
+import eu.svjatoslav.sixth.e3d.math.Transform;
 import eu.svjatoslav.sixth.e3d.renderer.raster.Color;
 import eu.svjatoslav.sixth.e3d.renderer.raster.ShapeCollection;
 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape;
 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.textcanvas.TextCanvas;
 
-import java.io.IOException;
 import java.util.Collection;
 import java.util.Random;
 
-public class RainingNumbersDemo implements ViewUpdateListener {
+public class RainingNumbersDemo implements ViewRenderListener {
 
     private static final int NUMBERS_COUNT = 1000;
     private final static int AREA = 600;
     private final static int AREA_HALF = AREA / 2;
 
-    public static void main(final String[] args) throws IOException {
+    public static void main(final String[] args) {
         new RainingNumbersDemo().run();
     }
 
     @Override
-    public boolean beforeViewUpdate(final ViewContext viewContext,
-                                    final int millisecondsSinceLastFrame) {
+    public boolean beforeRender(final ViewPanel viewPanel,
+                                final int millisecondsSinceLastFrame) {
 
-        final Collection<AbstractShape> shapes = viewContext
+        final Collection<AbstractShape> shapes = viewPanel
                 .getRootShapeCollection().getShapes();
 
         final double translateAmount = millisecondsSinceLastFrame / 50d;
@@ -53,11 +52,11 @@ public class RainingNumbersDemo implements ViewUpdateListener {
         return true;
     }
 
-    private void run() throws IOException {
+    private void run() {
         final ViewFrame viewFrame = new ViewFrame();
 
-        final ShapeCollection geometryCollection = viewFrame.getView()
-                .getContext().getRootShapeCollection();
+        final ShapeCollection geometryCollection = viewFrame.getViewPanel()
+                .getRootShapeCollection();
 
         Random random = new Random();
 
@@ -76,6 +75,6 @@ public class RainingNumbersDemo implements ViewUpdateListener {
             geometryCollection.addShape(textCanvas);
         }
 
-        viewFrame.getView().addViewUpdateListener(this);
+        viewFrame.getViewPanel().addViewUpdateListener(this);
     }
 }