/*
- * Sixth 3D engine demos. Copyright ©2012-2016, 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.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;
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();
geometryCollection.addShape(textCanvas);
}
- viewFrame.getView().addViewUpdateListener(this);
+ viewFrame.getViewPanel().addViewUpdateListener(this);
}
}