Package org.spoutcraft.api.gui

Examples of org.spoutcraft.api.gui.Point


    });

    addProperty("scrollpos", new Property() {
      @Override
      public void set(Object value) {
        Point p = (Point) value;
        scrollTo(p, false, 0);
      }

      @Override
      public Object get() {
        return mapOutsideToCoords(new Point(0,0));
      }
    });

    setScrollBarPolicy(Orientation.HORIZONTAL, ScrollBarPolicy.SHOW_NEVER);
    setScrollBarPolicy(Orientation.VERTICAL, ScrollBarPolicy.SHOW_NEVER);
View Full Code Here


    int y = outside.getY() + scrollY;
    x /= scale;
    y /= scale;
    x += heightMap.getMinX() * 16;
    y += heightMap.getMinZ() * 16;
    return new Point(x,y);
  }
View Full Code Here

    int y = coords.getY();
    x -= heightMap.getMinX() * 16;
    y -= heightMap.getMinZ() * 16;
    x *= scale;
    y *= scale;
    return new Point(x, y);
  }
View Full Code Here

    scrollTo(x,z, false, 0);
  }

  public void scrollTo(int x, int z, boolean animated, int duration) {
    if (!animated) {
      Point p = mapCoordsToOutside(new Point(x,z));
      int scrollX = p.getX(), scrollZ = p.getY();
      setScrollPosition(Orientation.HORIZONTAL, scrollX - (int) (getWidth() / 2));
      setScrollPosition(Orientation.VERTICAL, scrollZ - (int) (getHeight() / 2));
    } else {
      Point start = getCenterCoord();
      Point end = new Point(x, z);
      PropertyAnimation ani = new PropertyAnimation(this, "scrollpos");
      ani.setStartValue(start);
      ani.setEndValue(end);
      ani.setDuration(duration);
      ani.start();
View Full Code Here

      ani.start();
    }
  }

  public Point getCenterCoord() {
    return mapOutsideToCoords(new Point((int) (getWidth() / 2), (int) (getHeight() / 2)));
  }
View Full Code Here

    synchronized(chunks) {
      for (int chunkX = minChunkX; chunkX <= maxChunkX; chunkX+=levelOfDetail) {
        for (int chunkZ = minChunkZ; chunkZ <= maxChunkZ; chunkZ+=levelOfDetail) {
          Map map = getChunkMap(levelOfDetail).get(chunkX, chunkZ);
          if (dirty || map == null || random .nextInt(10000) == 0) {
            renderer.renderQueue.add(new Point(chunkX, chunkZ));
          }
          if (map != null && map != blankMap) {
            GL11.glPushMatrix();
            int x = chunkX * 16;
            int y = chunkZ * 16;
            int width = x + 16 * levelOfDetail;
            int height = y + 16 * levelOfDetail;
            map.loadColorImage();
            MinecraftTessellator tessellator = Spoutcraft.getTessellator();
            tessellator.startDrawingQuads();
            tessellator.addVertexWithUV((double) width, (double) height, -90, 1, 1);
            tessellator.addVertexWithUV((double) width, (double) y, -90, 1, 0);
            tessellator.addVertexWithUV((double) x, (double) y, -90, 0, 0);
            tessellator.addVertexWithUV((double) x, (double) height, -90, 0, 1);
            tessellator.draw();
  //          GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
  //          RenderUtil.drawRectangle(x, y, width, height, 0x88ffffff);
            if (MinimapConfig.getInstance().isHeightmap()) {
              GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_COLOR);
              map.loadHeightImage();
              tessellator.startDrawingQuads();
              tessellator.addVertexWithUV((double) width, (double) height, -90, 1, 1);
              tessellator.addVertexWithUV((double) width, (double) y, -90, 1, 0);
              tessellator.addVertexWithUV((double) x, (double) y, -90, 0, 0);
              tessellator.addVertexWithUV((double) x, (double) height, -90, 0, 1);
              tessellator.draw();
            }
            GL11.glPopMatrix();
          }
        }
      }
    }
    int x = (int) SpoutClient.getHandle().thePlayer.posX;
    int z = (int) SpoutClient.getHandle().thePlayer.posZ;

    drawPOI("You", x, z, 0xffff0000);

    for (Waypoint waypoint : MinimapConfig.getInstance().getAllWaypoints(MinimapUtils.getWorldName())) {
      if (!waypoint.deathpoint || MinimapConfig.getInstance().isDeathpoints()) {
        drawPOI(waypoint.name, waypoint.x, waypoint.z, 0xff00ff00);
      }
    }

    if (MinimapConfig.getInstance().getFocussedWaypoint() != null) {
      Waypoint pos = MinimapConfig.getInstance().getFocussedWaypoint();
      drawPOI("Marker", pos.x, pos.z, 0xff00ffff);
    }

    GL11.glPopMatrix();
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glEnable(2929);
    GL11.glDisable(3042);
    dirty = false;

    Point newpos = getPlayerPosition();
    if (lastPlayerPos.getX() != newpos.getX() || lastPlayerPos.getY() != newpos.getY()) {
      showPlayer(0);
      lastPlayerPos = newpos;
    }
  }
View Full Code Here

    setScale(value, false, 0);
  }

  public void setScale(double newscale, boolean animated, int duration) {
    if (!animated) {
      Point center = getCenterCoord();
      this.scale = newscale;
      scrollTo(center);
      updateLOD();
    } else {
      PropertyAnimation ani = new PropertyAnimation(this, "scale");
View Full Code Here

  }

  public Point getPlayerPosition() {
    int x = (int) SpoutClient.getHandle().thePlayer.posX;
    int z = (int) SpoutClient.getHandle().thePlayer.posZ;
    return new Point(x, z);
  }
View Full Code Here

  @Override
  public void run() {
    while (true) {
      while (!renderQueue.isEmpty()) {
        try {
          Point coords = renderQueue.remove();
          MapWidget.drawChunk(coords.getX(), coords.getY(), true);
        } catch(NoSuchElementException e) {
          break;
        } catch(Exception e) {
          continue;
        }
View Full Code Here

    int y = clicked.getY();
    return x >= cx - length && x <= cx + length && y >= cy - length && y <= cy + length;
  }

  private Waypoint getClickedWaypoint(int x, int z) {
    Point clicked = new Point(x,z);
    for (Waypoint waypoint:MinimapConfig.getInstance().getAllWaypoints(MinimapUtils.getWorldName())) {
      if (withinManhattanLength(new Point(waypoint.x, waypoint.z), clicked, (float) (2f/map.scale))) {
        return waypoint;
      }
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.spoutcraft.api.gui.Point

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.