X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Fgui%2FRenderingContext.java;h=91b73762aac1d22e8547ef1f72cfc2ae0082dfce;hb=58faaac88fe1a65fe42a68979d4e4d8f3765d878;hp=5ebb59bd8f7f24e44710e6b77bd86cca2ccd50ac;hpb=b1e8d7bd8c9d0905e9fe3c46fc84a11779b95982;p=sixth-3d.git diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/RenderingContext.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/RenderingContext.java index 5ebb59b..91b7376 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/RenderingContext.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/RenderingContext.java @@ -1,5 +1,5 @@ /* - * Sixth 3D engine. Copyright ©2012-2017, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Sixth 3D engine. 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 @@ -21,11 +21,11 @@ public class RenderingContext { public static final int bufferedImageType = BufferedImage.TYPE_4BYTE_ABGR; - public final BufferedImage bufferedImage; + final BufferedImage bufferedImage; public final Graphics2D graphics; - public final byte[] bytes; + public final byte[] pixels; public final int width; public final int height; @@ -44,13 +44,17 @@ public class RenderingContext { */ public boolean doRender = true; // TODO: make use of the variable + /** + * Mouse click. During rendering we can detect which item user clicked on. + */ public MouseClick mouseClick; + /** + * Item that user clicked on. + */ public MouseInteractionController clickedItem; - public RenderingContext(final int width, final int height, - final RenderingContext oldContext) { - + public RenderingContext(final int width, final int height) { this.width = width; this.height = height; @@ -63,20 +67,11 @@ public class RenderingContext { final WritableRaster raster = bufferedImage.getRaster(); final DataBufferByte dbi = (DataBufferByte) raster.getDataBuffer(); - bytes = dbi.getData(); + pixels = dbi.getData(); graphics = (Graphics2D) bufferedImage.getGraphics(); - - graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - - graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, - RenderingHints.VALUE_TEXT_ANTIALIAS_ON); - - if (oldContext != null) { - mouseClick = oldContext.mouseClick; - clickedItem = oldContext.clickedItem; - } + graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); } }