Package se.llbit.chunky.world

Examples of se.llbit.chunky.world.ChunkView


  private CorruptLayer() {
  }

  @Override
  public synchronized void render(MapBuffer rbuff, int cx, int cz) {
    ChunkView view = rbuff.getView();
    int x0 = view.chunkScale * (cx - view.px0);
    int z0 = view.chunkScale * (cz - view.pz0);

    if (view.chunkScale == 1) {
      rbuff.setRGB(x0, z0, averageColor);
View Full Code Here


   * Called when the map view has changed.
   */
  public synchronized void viewUpdated() {
    refresher.setView(map);

    minimap = new ChunkView(map.x, map.z, minimapWidth, minimapHeight, 1);

    int rx0 = Math.min(minimap.prx0, map.prx0);
    int rx1 = Math.max(minimap.prx1, map.prx1);
    int rz0 = Math.min(minimap.prz0, map.prz0);
    int rz1 = Math.max(minimap.prz1, map.prz1);
View Full Code Here

   * Set the map view
   * @param cx
   * @param cz
   */
  public synchronized void setView(final double cx, final double cz) {
    map = new ChunkView(cx, cz, mapWidth, mapHeight, chunkScale);
    if (frame != null && getControls() != null) {
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          getControls().setPosition(cx, getLayer(), cz);
View Full Code Here

   */
  private void drawSelectionRect(Graphics g) {
    if (!mouseInsideWindow) {
      return;
    }
    ChunkView cv = view;

    ChunkPosition cp = end;
    g.setFont(font);
    g.setColor(Color.red);

    if (selectRect) {
      ChunkPosition cp0 = start;
      ChunkPosition cp1 = end;
      int x0 = Math.min(cp0.x, cp1.x);
      int x1 = Math.max(cp0.x, cp1.x);
      int z0 = Math.min(cp0.z, cp1.z);
      int z1 = Math.max(cp0.z, cp1.z);
      x0 = (int) (cv.scale * (x0 - cv.x0));
      z0 = (int) (cv.scale * (z0 - cv.z0));
      x1 = (int) (cv.scale * (x1 - cv.x0 + 1));
      z1 = (int) (cv.scale * (z1 - cv.z0 + 1));
      g.setColor(Color.red);
      g.drawRect(x0, z0, x1-x0, z1-z0);
    } else {
      // test if hovered chunk is visible
      if (cv.isChunkVisible(cp)) {

        if (cv.scale >= 16) {
          int x0 = (int) (cv.scale * (cp.x - cv.x0));
          int y0 = (int) (cv.scale * (cp.z - cv.z0));
          int blockScale = cv.scale;
View Full Code Here

TOP

Related Classes of se.llbit.chunky.world.ChunkView

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.