Java 类org.newdawn.slick.geom.Point 实例源码

项目:chatterino    文件:Player.java   
public boolean IsColliding(Point translation, MapData mapData) {
  Point newPoint = new Point(position.getX() + translation.getX(), position.getY() + translation.getY());

  for (TileData tileData : mapData.GetTiles()) {
    // TODO: Get width & height from somewhere
    boolean collideRight = newPoint.getX() + size.width > tileData.x;
    boolean collideLeft = newPoint.getX() < tileData.x + 8;
    boolean collideBottom = newPoint.getY() + size.height > tileData.y;
    boolean collideTop = newPoint.getY() < tileData.y + 8;

    if (collideRight && collideLeft && collideBottom && collideTop) {
      return true;
    }
  }
  return false;
}
项目:Go    文件:ClientMain.java   
private Point getGridAlignedCoordinates(int x, int y) {
    x -= this.tileImage.getWidth() / 2;
    y -= this.tileImage.getHeight() / 2;
    int newX = ((x / (SCREEN_WIDTH / (BOARD_SIZE + 2))) * (SCREEN_WIDTH / (BOARD_SIZE + 2)))
            + (SCREEN_WIDTH / (BOARD_SIZE + 2));
    int newY = ((y / (SCREEN_HEIGHT / (BOARD_SIZE + 2))) * (SCREEN_HEIGHT / (BOARD_SIZE + 2)))
            + (SCREEN_HEIGHT / (BOARD_SIZE + 2));
    newX -= this.tileImage.getWidth() / 2;
    newY -= this.tileImage.getHeight() / 2;

    // Limit values on each axis to a maximum
    if (newX > SCREEN_WIDTH - 1.5 * TILE_SIZE)
        newX = (int) (SCREEN_WIDTH - 1.5 * TILE_SIZE);
    if (newY > SCREEN_HEIGHT - 1.5 * TILE_SIZE)
        newY = (int) (SCREEN_HEIGHT - 1.5 * TILE_SIZE);

    return new Point(newX, newY);
}
项目:JavaRA    文件:PageInfantry.java   
public PageInfantry(Point pos) {
super(pos);

addButton(new InfantrySidebarButton("Shock Trooper", "shokicon.shp", this.getPosition(), 0, 4, false, null));

//addButton(new InfantrySidebarButton("", "icon.shp", this.getPosition(), 1, 5, false, null));
//addButton(new InfantrySidebarButton("", "icon.shp", this.getPosition(), 1, 5, false, null));

addButton(new InfantrySidebarButton("Flamethrower", "e4icon.shp", this.getPosition(), 0, 6, false, null));
//addButton(new InfantrySidebarButton("", "icon.shp", this.getPosition(), 1, 6, false, null));

addButton(new InfantrySidebarButton("Rocket Soldier", "e3icon.shp", this.getPosition(), 0, 7, false, null));
addButton(new InfantrySidebarButton("Tanya", "e7icon.shp", this.getPosition(), 1, 7, false, null));

addButton(new InfantrySidebarButton("Grenade Trooper", "e2icon.shp", this.getPosition(), 0, 8, false, null));
//addButton(new InfantrySidebarButton("", "icon.shp", this.getPosition(), 1, 8, false, null));

addButton(new InfantrySidebarButton("Riffle Trooper", "e1icon.shp", this.getPosition(), 0, 9, false, null));
addButton(new InfantrySidebarButton("Engineer", "e6icon.shp", this.getPosition(), 1, 9, false, null));
   }
项目:ESCP    文件:HeroController.java   
/**
 * Calculates the next position the model would be at by checking the user
 * input and the model's movement speed. Also sets the model's isMoving
 * property.
 * 
 * 
 * @param input
 *            Input object to mouse position against.
 * @param model
 *            Model to calculate facing for.
 * @param delta
 *            The time in milliseconds since the last update.
 * @return The next position the model would be in.
 */
private Point calculateNextPosition(Input input,
        AbstractCharacterModel model, int delta) {
    boolean goingUp = input.isKeyDown(KeyBindings.getBinding(Key.UP));
    boolean goingDown = input.isKeyDown(KeyBindings.getBinding(Key.DOWN));
    boolean goingRight = input.isKeyDown(KeyBindings.getBinding(Key.RIGHT));
    boolean goingLeft = input.isKeyDown(KeyBindings.getBinding(Key.LEFT));

    // Calculate move direction and move
    float speedY = (goingUp ? 1 : 0) - (goingDown ? 1 : 0);
    float speedX = (goingLeft ? 1 : 0) - (goingRight ? 1 : 0);

    if (speedY != 0 || speedX != 0) {
        double direction = Math.atan2(speedY, speedX);
        speedY = (float) (model.getVelocity() * Math.sin(direction));
        speedX = (float) (model.getVelocity() * Math.cos(direction));
    }

    float newX = model.getX() - (delta * speedX);
    float newY = model.getY() - (delta * speedY);

    model.setMoving(speedY != 0 || speedX != 0);

    return new Point(newX, newY);
}
项目:chatterino    文件:NetworkClient.java   
public void SendPosition(Point position) {
  if (!IsConnected()) {
    return;
  }

  PointInfo point = new PointInfo();
  point.x = position.getX();
  point.y = position.getY();
  client.sendTCP(point);
}
项目:chatterino    文件:Player.java   
public void Translate(Point point) {
  if (point.getX() != 0 || point.getY() != 0) {
    position.setX(position.getX() + point.getX());
    position.setY(position.getY() + point.getY());
    NetworkClient.GetInstance().SendPosition(position);
  }
}
项目:chatterino    文件:LocalPlayer.java   
public void Update(int delta) {
  Point translation = new Point(0, 0);
  if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
    translation.setY(translation.getY() + GetSpeed() * delta);
  } if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
    translation.setY(translation.getY() - GetSpeed() * delta);
  } if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) {
    translation.setX(translation.getX() - GetSpeed() * delta);
  } if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) {
    translation.setX(translation.getX() + GetSpeed() * delta);
  }
  if (!IsColliding(translation, Game.GetCurrentRoom().GetMapData())) {
    Translate(translation);
  }
}
项目:chatterino    文件:ChatBubble.java   
public void Render(Graphics g) {
  g.setFont(Fonts.VERDANA);
  Point point = new Point(positionable.GetPosition().getX(), positionable.GetPosition().getY());

  Node next = GetHead();
  while (next != null && next.GetNext() != null && next != this) {
    point.setY(point.getY() - ((ChatBubble)next).ComputeHeight(g.getFont()) - (MARGIN * 4));
    next = next.GetNext();
  }

  Point newPoint = new Point(point.getX(), point.getY());
  ChatBubble.RenderBubble(g, text, newPoint, dimension);
}
项目:chatterino    文件:ChatBubble.java   
static void RenderBubble(Graphics g, String text, Point point, Dimension sizeOffset) {
  g.setColor(Color.white);
  if (!text.isEmpty()) {
    int textFontHeight = g.getFont().getLineHeight();

    int totalLineCount = Math.round((text.length() - 1) / (float) MAX_TEXT_PER_LINE) + 1;
    float textY = point.getY() - sizeOffset.height - (textFontHeight / 3.0f) - (totalLineCount * textFontHeight);
    int maxLineWidth = 0;
    int lineCount = 0;
    for (int i = 0; i < text.length(); i += MAX_TEXT_PER_LINE) {
      int start = i;
      int end = Math.min(text.length(), start + ((lineCount + 1) * MAX_TEXT_PER_LINE));
      float currentLineY = textY + (lineCount * textFontHeight) - MARGIN;
      String lineText = text.substring(start, end);
      maxLineWidth = Math.max(maxLineWidth, g.getFont().getWidth(lineText));
      g.drawString(lineText, computeCurrentLineX(point, sizeOffset, maxLineWidth), currentLineY);
      lineCount++;
    }

    float rectX = computeCurrentLineX(point, sizeOffset, maxLineWidth) - MARGIN;
    float rectY = textY - (textFontHeight * (totalLineCount - 1)) - MARGIN;
    if (totalLineCount > 1) {
      rectY += textFontHeight;
    }
    float rectWidth = maxLineWidth + (MARGIN * 2);
    float rectHeight = (textFontHeight * totalLineCount) + (MARGIN * 2);
    g.drawRoundRect(rectX, rectY, rectWidth, rectHeight, 1);
  }
}
项目:Go    文件:ClientMain.java   
/** Mouse listener methods */
public void mouseMoved(int oldx, int oldy, int newx, int newy) {
    if (this.currentStone != null) {
        Point newPosition = getGridAlignedCoordinates(newx, newy);
        this.currentStone.setX((int) newPosition.getX());
        this.currentStone.setY((int) newPosition.getY());
    }
}
项目:Go    文件:ClientMain.java   
private void makeNewStone(GameContainer gc) {
    Point newPosition = getGridAlignedCoordinates(gc.getInput().getMouseX(), gc.getInput().getMouseY());
    if (this.currentStone == null) {
        if (this.blacksTurn)
            this.currentStone = new BlackStone((int) newPosition.getX(), (int) newPosition.getY());
        else
            this.currentStone = new WhiteStone((int) newPosition.getX(), (int) newPosition.getY());
    }
}
项目:VortexGameLibrary    文件:GameEntity.java   
/**
 * The default constructor. Sets the spawn point to the center of the screen.
 */
public GameEntity(){
    startPoint = new Point(Game.getScreenWidth() / 2, Game.getScreenHeight() / 2);
    width = 0;
    height = 0;
    movementVector = new Vector(0,0);
    collisionBox = new ArrayList<CollisionShape>();
}
项目:VortexGameLibrary    文件:GameEntity.java   
/**
 * A constructor with parameters.
 * 
 * @param startPoint The x and y coordinates to spawn at
 * @param width The width of the entity
 * @param height The height of the entity.
 */
public GameEntity(Point startPoint, float width, float height){
    this.startPoint = startPoint;
    this.width = width;
    this.height = height;
    movementVector = new Vector(0,0);
    collisionBox = new ArrayList<CollisionShape>();
}
项目:VortexGameLibrary    文件:Camera.java   
/**
 * A constructor that takes an entity. The Camera's point will be located at the center of the GameEntity.
 * 
 * @param entity The GameEntity to base this Camera's position on
 */
public Camera(GameEntity entity){
    super();
    localX = 0;
    localY = 0;
    viewport = new Point(Game.getScreenWidth(), Game.getScreenHeight());
    globalX = Math.round((entity.getX() + localX + (entity.getWidth() / 2)));
    globalY = Math.round((entity.getY() + localY + (entity.getHeight() / 2)));
    magnification = 1.0f;
    this.entity = entity;
    if(entity != null){
        entity.attachCamera(this);
    }
}
项目:VortexGameLibrary    文件:Camera.java   
/**
 * A constructor with parameters. The Camera's point will be located at the center + offset of the GameEntity.
 * 
 * @param entity The GameEntity to base this Camera's position on
 * @param offsetX The offset from the center in the x-axis
 * @param offsetY The offset from the center in the y-axis
 */
public Camera(GameEntity entity, float offsetX, float offsetY){
    super();
    localX = offsetX;
    localY = offsetY;
    viewport = new Point(Game.getScreenWidth(), Game.getScreenHeight());
    globalX = Math.round((entity.getX() + localX + (entity.getWidth() / 2)));
    globalY = Math.round((entity.getY() + localY + (entity.getHeight() / 2)));
    magnification = 1.0f;
    this.entity = entity;
    if(entity != null){
        entity.attachCamera(this);
    }
}
项目:VortexGameLibrary    文件:Camera.java   
/**
 * A constructor with parameters. The Camera's point will be located at the center + offset of the GameEntity.
 * 
 * @param entity The GameEntity to base this Camera's position on.
 * @param offsetX The offset from the center in the x-axis
 * @param offsetY The offset from the center in the y-axis
 * @param magnification The magnification of the Camera (not currently implemented)
 */
public Camera(GameEntity entity, float offsetX, float offsetY, float magnification){
    super();
    localX = offsetX;
    localY = offsetY;
    viewport = new Point(Game.getScreenWidth(), Game.getScreenHeight());
    globalX = Math.round((entity.getX() + localX + (entity.getWidth() / 2)));
    globalY = Math.round((entity.getY() + localY + (entity.getHeight() / 2)));
    this.magnification = magnification;
    this.entity = entity;
    if(entity != null){
        entity.attachCamera(this);
    }
}
项目:JavaRA    文件:Theater.java   
private void putTextureInSheet(Image sheet, TmpTexture texture) {
if (texture == null) {
    return;
}

if (texture.height * texture.numImages > maximumYOffset) {
    this.maximumYOffset = texture.height * texture.numImages;
}

// Overflowed, lets move down and reset to left side
if (currentSheetX + texture.width > SHEET_SIZE) {
    currentSheetY += maximumYOffset;
    currentSheetX = 0;
}

texture.setSpriteSheetCoords(new Point(currentSheetX, currentSheetY));

for (int i = 0; i < texture.numImages; i++) {
    Image img = texture.getByIndex(i);

    int deployX = currentSheetX;
    int deployY = currentSheetY + (i * img.getHeight());

    // Copy texture into sheet
    try {
    sheet.getGraphics().drawImage(img, deployX, deployY);
    } catch (SlickException e) {
    e.printStackTrace();
    }    
}

Rectangle r = new Rectangle(currentSheetX, currentSheetY, texture.width, texture.height * texture.numImages);
this.texturesBounds.add(r);

currentSheetX += texture.width;
   }
项目:JavaRA    文件:Theater.java   
private void putShpTextureInSheetDissected(Image sheet, ShpTexture texture) {
if (texture == null) {
    return;
}

if (texture.height * texture.numImages > maximumYOffset) {
    this.maximumYOffset = texture.height * texture.numImages;
}

// Overflowed, lets move down and reset to left side
if (currentSheetX + texture.width > SHEET_SIZE) {
    currentSheetY += maximumYOffset;
    currentSheetX = 0;
}

this.shpTexturesPoints.put(texture.getTextureName(), new Point(currentSheetX, currentSheetY));

for (int i = 0; i < texture.numImages; i++) {
    Image img = texture.getAsImage(i, null);

    int deployX = currentSheetX;
    int deployY = currentSheetY + (i * img.getHeight());

    // Copy texture into sheet
    try {
    sheet.getGraphics().drawImage(img, deployX, deployY);
    } catch (SlickException e) {
    e.printStackTrace();
    }    
}

Rectangle r = new Rectangle(currentSheetX, currentSheetY, texture.width, texture.height * texture.numImages);
this.texturesBounds.add(r);

currentSheetX += texture.width;
   }
项目:JavaRA    文件:Theater.java   
public Point getTileTextureSheetCoord(TileReference<Integer, Byte> tile) {
String tileName = this.tileSet.getTiles().get(Integer.valueOf(tile.getTile()));

TmpTexture t = getTileTmp(tile);

int index = (short) (tile.getIndex() & 0xFF);

if (t != null && t.isInSpriteSheet()) {
    return t.getSpriteSheetCoords();
} else return new Point(-1, -1);
   }
项目:JavaRA    文件:SmudgeLayer.java   
private void renderLayer(Graphics g, HashMap<Pos, Smudge> layer) {
for (Entry<Pos, Smudge> v : layer.entrySet()) {
    Pos pos = v.getKey();
    Smudge smudge = v.getValue();

    int x = (int) pos.getX();
    int y = (int) pos.getY();

    // Check viewport bounds
    if (x < (int) -Main.getInstance().getCamera().offsetX / 24 - 1
        || x > (int) -Main.getInstance().getCamera().offsetX / 24 + (int) Main.getInstance().getContainer().getWidth()
        / 24 + 1) {
    continue;
    }

    if (y < (int) -Main.getInstance().getCamera().offsetY / 24 - 1
        || y > (int) -Main.getInstance().getCamera().offsetY / 24 + (int) Main.getInstance().getContainer().getHeight()
        / 24 + 1) {
    continue;
    }

    // Don't draw shrouded smudges
    if (Main.getInstance().getPlayer().getShroud() != null && !Main.getInstance().getPlayer().getShroud().isExplored(pos)) {
    continue;
    }

    String textureName = smudge.type + "." + this.map.getTileSet().getSetName().toLowerCase().substring(0, 3);
    Point sheetPoint = map.getTheater().getShpTexturePoint(textureName);

    int sX = (int) sheetPoint.getX();
    int sY = (int) sheetPoint.getY();

    if (sX != -1 && sY != -1) {
    this.map.getTheater().getSpriteSheet().renderInUse(x * 24, y * 24, sX / 24, (sY / 24) + smudge.depth);
    }           
}   
   }
项目:JavaRA    文件:TileMap.java   
public void render(GameContainer c, Graphics g, Camera camera) {
Color pColor = g.getColor();    
this.theater.getSpriteSheet().startUse();

// Draw tiles layer
for (int y = (int) (-Main.getInstance().getCamera().getOffsetY()) / 24; y < this.getHeight(); y++) {
    for (int x = (int) (-Main.getInstance().getCamera().getOffsetX()) / 24; x < this.getWidth(); x++) {
    // Don't render tile, if it shrouded and surrounding tiles shrouded too
    if (Main.getInstance().getPlayer().getShroud() != null && Main.getInstance().getPlayer().getShroud().isAreaShrouded(x, y, 2, 2)) {
        continue;
    }

    if ((int) this.mapTiles[x][y].getTile() != 0) {
        Point sheetPoint = this.theater
            .getTileTextureSheetCoord(this.mapTiles[x][y]);

        int index = (int) ((byte) this.mapTiles[x][y].getIndex() & 0xFF);

        int sX = (int) sheetPoint.getX();
        int sY = (int) sheetPoint.getY();

        if (sX != -1 && sY != -1) {
        this.theater.getSpriteSheet().renderInUse(x * 24, y * 24, sX / 24, (sY / 24) + index);
        }

        this.resourcesLayer.renderCell(x, y);
    }
    }
}

this.smudges.render(g);

this.theater.getSpriteSheet().endUse(); 
//this.theater.getSpriteSheet().draw(24 * 20, 24 * 20);
   }
项目:JavaRA    文件:TileMap.java   
public void renderMapEntities(GameContainer c, Graphics g, Camera camera) {
this.theater.getSpriteSheet().startUse();
// Draw map entities
for (MapEntity me : this.mapEntities) {
    int x = me.getX();
    int y = me.getY();

    // Don't draw invisible entities
    if (x < (int) -camera.offsetX / 24 - 2
        || x > (int) -camera.offsetX / 24 + (int) c.getWidth() / 24 + 2) {
    continue;
    }

    if (y < (int) -camera.offsetY / 24 - 2
        || y > (int) -camera.offsetY / 24 + (int) c.getHeight() / 24 + 2) {
    continue;
    }

    ShpTexture t = me.getTexture();

    Point sheetPoint = this.theater.getShpTexturePoint(t.getTextureName());

    int sX = (int) sheetPoint.getX();
    int sY = (int) sheetPoint.getY();

    this.theater.getSpriteSheet()
    .getSubImage(sX, sY, t.width, t.height)
    .drawEmbedded(x * 24, y * 24, t.width, t.height);
}

this.theater.getSpriteSheet().endUse(); 
   }
项目:JavaRA    文件:ResourcesLayer.java   
public void renderAll(Graphics g) {
// Draw tiles layer
for (int y = 0; y < this.map.getHeight(); y++) {
    for (int x = 0; x < this.map.getWidth(); x++) {
    if (x < (int) -Main.getInstance().getCamera().offsetX / 24 - 1
        || x > (int) -Main.getInstance().getCamera().offsetX / 24 + (int) Main.getInstance().getContainer().getWidth()
        / 24 + 1) {
        continue;
    }

    if (y < (int) -Main.getInstance().getCamera().offsetY / 24 - 1
        || y > (int) -Main.getInstance().getCamera().offsetY / 24 + (int) Main.getInstance().getContainer().getHeight()
        / 24 + 1) {
        continue;
    }

    if (Main.getInstance().getPlayer().getShroud() != null && Main.getInstance().getPlayer().getShroud().isAreaShrouded(x, y, 2, 2)) {
        continue;
    }

    if (this.resources[x][y] != null) {
        byte index = (byte) (this.resources[x][y].getFrameIndex() & 0xFF);

        Point sheetPoint = map.getTheater().getShpTexturePoint(this.resources[x][y].getSpriteName());

        int sX = (int) sheetPoint.getX();
        int sY = (int) sheetPoint.getY();

        if (sX != -1 && sY != -1) {
        this.map.getTheater().getSpriteSheet().renderInUse(x * 24, y * 24, sX / 24, (sY / 24) + index);
        }           
    }
    }
}   
   }
项目:JavaRA    文件:ResourcesLayer.java   
public void renderCell(int x, int y) {
if (this.resources[x][y] != null) {
    byte index = (byte) (this.resources[x][y].getFrameIndex() & 0xFF);

    Point sheetPoint = map.getTheater().getShpTexturePoint(this.resources[x][y].getSpriteName());

    int sX = (int) sheetPoint.getX();
    int sY = (int) sheetPoint.getY();

    if (sX != -1 && sY != -1) {
    this.map.getTheater().getSpriteSheet().renderInUse(x * 24, y * 24, sX / 24, (sY / 24) + index);
    }           
}   
   }
项目:JavaRA    文件:SideBarItemsButton.java   
public SideBarItemsButton(String aDescription, String aTextureName, Point pagePos, int aPosX, int aPosY, boolean aIsVisible) {
this.position = new Point(pagePos.getX() + aPosX * 64, pagePos.getY() + aPosY * 48);
this.posX = aPosX;
this.posY = aPosY;

this.description = aDescription;
this.isVisible = aIsVisible;

if (!aTextureName.isEmpty()) {
    this.textureName = aTextureName;
    this.buttonTexture = ResourceManager.getInstance().getSidebarTexture(aTextureName);
    this.buttonImg = buttonTexture.getAsImage(0, Main.getInstance().getSideBar().getPlayer().playerColor);
}
   }
项目:JavaRA    文件:PageVehicle.java   
public PageVehicle(Point pos) {
super(pos);

//addButton(new VehicleSidebarButton("", "icon.shp", this.getPosition(), 0, 0, false));
//addButton(new VehicleSidebarButton("", "icon.shp", this.getPosition(), 1, 0, false)); 

addButton(new VehicleSidebarButton("Demolition truck", "dtrkicon.shp", this.getPosition(), 0, 1, false));
//addButton(new VehicleSidebarButton("", "icon.shp", this.getPosition(), 1, 1, false));

addButton(new VehicleSidebarButton("Tesla tank", "ttnkicon.shp", this.getPosition(), 0, 2, false));
addButton(new VehicleSidebarButton("MAD tank", "qtnkicon.shp", this.getPosition(), 1, 2, false));

//addButton(new VehicleSidebarButton("", "icon.shp", this.getPosition(), 0, 3, false));
addButton(new VehicleSidebarButton("Mobile Construction Vehicle", "mcvicon.shp", this.getPosition(), 1, 3, false));

addButton(new VehicleSidebarButton("Mammonth tank", "4tnkicon.shp", this.getPosition(), 0, 4, false));
addButton(new VehicleSidebarButton("Mine layer", "mnlyicon.shp", this.getPosition(), 1, 4, false));

addButton(new VehicleSidebarButton("Heavy tank", "3tnkicon.shp", this.getPosition(), 0, 5, false));
//addButton(new VehicleSidebarButton("", "icon.shp", this.getPosition(), 1, 5, false));

//addButton(new VehicleSidebarButton("", "icon.shp", this.getPosition(), 0, 6, false));
//addButton(new VehicleSidebarButton("", "icon.shp", this.getPosition(), 1, 6, false));

//addButton(new VehicleSidebarButton("", "icon.shp", this.getPosition(), 0, 7, false));
//addButton(new VehicleSidebarButton("", "icon.shp", this.getPosition(), 1, 7, false));

addButton(new VehicleSidebarButton("V2 Rocket Launcher", "v2rlicon.shp", this.getPosition(), 0, 8, false));
//addButton(new VehicleSidebarButton("", "icon.shp", this.getPosition(), 1, 8, false));

//addButton(new VehicleSidebarButton("", "icon.shp", this.getPosition(), 0, 9, false));
addButton(new VehicleSidebarButton("Ore Truck", "harvicon.shp", this.getPosition(), 1, 9, false));
   }
项目:JavaRA    文件:PageBuildingSoviet.java   
public PageBuildingSoviet(Point pos) {
super(pos);

addButton(new BuildingSidebarButton("SAM Site", "samicon.shp", this.getPosition(), 0, 0, false));
addButton(new BuildingSidebarButton("Atom Bomb Silo", "msloicon.shp", this.getPosition(), 1, 0, false));

addButton(new BuildingSidebarButton("Tesla Coil", "tslaicon.shp", this.getPosition(), 0, 1, false));
addButton(new BuildingSidebarButton("Iron Curtain", "ironicon.shp", this.getPosition(), 1, 1, false));

addButton(new BuildingSidebarButton("Flame Tower", "fturicon.shp", this.getPosition(), 0, 2, false));
addButton(new BuildingSidebarButton("Soviet Tech Center", "stekicon.shp", this.getPosition(), 1, 2, false));

addButton(new BuildingSidebarButton("Air Field", "afldicon.shp", this.getPosition(), 0, 3, false));
addButton(new BuildingSidebarButton("Kennel", "kennicon.shp", this.getPosition(), 1, 3, false));

addButton(new BuildingSidebarButton("Helipad", "hpadicon.shp", this.getPosition(), 0, 4, false));
addButton(new BuildingSidebarButton("Radar Dome", "domeicon.shp", this.getPosition(), 1, 4, false));

addButton(new BuildingSidebarButton("Sub Pen", "spenicon.shp", this.getPosition(), 0, 5, false));
addButton(new BuildingSidebarButton("Service Depot", "fixicon.shp", this.getPosition(), 1, 5, false));

addButton(new BuildingSidebarButton("War Factory", "weapicon.shp", this.getPosition(), 0, 6, false));
addButton(new BuildingSidebarButton("Ore Silo", "siloicon.shp", this.getPosition(), 1, 6, false));

addButton(new BuildingSidebarButton("Advanced Power Plant", "apwricon.shp", this.getPosition(), 0, 7, false));
addButton(new BuildingSidebarButton("Ore Refinery", "procicon.shp", this.getPosition(), 1, 7, false));

addButton(new BuildingSidebarButton("Power Plant", "powricon.shp", this.getPosition(), 0, 8, false));
addButton(new BuildingSidebarButton("Barracks", "barricon.shp", this.getPosition(), 1, 8, false));

addButton(new BuildingSidebarButton("Wired Fence", "fencicon.shp", this.getPosition(), 0, 9, false));
addButton(new BuildingSidebarButton("Concrete Wall", "brikicon.shp", this.getPosition(), 1, 9, false));
   }
项目:JavaRA    文件:GameSideBar.java   
public GameSideBar(Team aTeam, Player aPlayer) {
try {
    this.menuCategoriesSheet = new SpriteSheet(ResourceManager.SIDEBAR_CATEGORIES_SHEET, 64, 48);

    System.out.println("Button sheet: " + this.menuCategoriesSheet.getHorizontalCount() + " x " + this.menuCategoriesSheet.getVerticalCount());
} catch (SlickException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

this.team = aTeam;
this.player = aPlayer;

this.sideBarPages = new HashMap<>();    
this.sidebarBounds = new Rectangle(Main.getInstance().getContainer().getWidth() - BAR_WIDTH - BAR_SPACING_W, BAR_SPACING_H, BAR_WIDTH, BAR_HEIGHT);


this.sideBarCategoriesOpened = new boolean[6][2];
this.sideBarCategoriesOpened[0][1] = true;
this.sideBarCategoriesOpened[1][1] = true;

this.radarRect.setBounds(Main.getInstance().getContainer().getWidth() - BAR_WIDTH - BAR_SPACING_W + 2, BAR_SPACING_H + 2, BAR_WIDTH - 4, RADAR_HEIGHT);
this.minimap = new MinimapRenderer(Main.getInstance().getWorld(), (int) Main.getInstance().getWorld().getMap().getBounds().getWidth() / 24, (int) (int) Main.getInstance().getWorld().getMap().getBounds().getHeight() / 24);

this.powerBar = new PowerBarRenderer(new Point(sidebarBounds.getMinX() - POWERBAR_WIDTH, sidebarBounds.getMaxY()), POWERBAR_WIDTH, (int) sidebarBounds.getHeight());

switchPage(START_PAGE_NAME);
   }
项目:JavaRA    文件:GameSideBar.java   
public void initSidebarPages() {
if (this.sideBarPages.isEmpty()) {
    this.sideBarPages.put(PAGE_BUILDING_SOVIET, new PageBuildingSoviet(new Point(Main.getInstance().getContainer().getWidth() - BAR_WIDTH - BAR_SPACING_W + 1, BAR_SPACING_H + 1)));
    this.sideBarPages.put(PAGE_VEHICLE, new PageVehicle(new Point(Main.getInstance().getContainer().getWidth() - BAR_WIDTH - BAR_SPACING_W + 1, BAR_SPACING_H + 1)));
    this.sideBarPages.put(PAGE_INFANTRY, new PageInfantry(new Point(Main.getInstance().getContainer().getWidth() - BAR_WIDTH - BAR_SPACING_W + 1, BAR_SPACING_H + 1)));
}
   }
项目:JavaRA    文件:GameSideBar.java   
public Point cellToMinimapPixel(Point p)
   {
Point viewOrigin = new Point(this.previewOrigin.getMinX(), this.previewOrigin.getMinY());
Point mapOrigin = new Point(Main.getInstance().getWorld().getMap().getBounds().getMinX() / 24, Main.getInstance().getWorld().getMap().getBounds().getMinY() / 24);

return new Point(viewOrigin.getMinX() + this.radarRect.getWidth() / 24 * previewScale * (p.getX()- mapOrigin.getMinX()), viewOrigin.getMinY() + this.radarRect.getHeight() / 24 * previewScale * (p.getMinY() - mapOrigin.getMinY()));
   }
项目:Sharktron    文件:InputManager.java   
/**
 * Returns the current absolute mouse position as a Slick2D Point.
 * 
 * @return Mouse position
 */
public static Point getAbsoluteMousePosition()
{
    int x = input.getAbsoluteMouseX();
    int y = input.getAbsoluteMouseY();

    return new Point(x, y);
}
项目:Sharktron    文件:InputManager.java   
/**
 * Returns the current mouse position as a Slick2D Point.
 * 
 * @return Mouse position
 */
public static Point getMousePosition()
{
    int x = input.getMouseX();
    int y = input.getMouseY();

    return new Point(x, y);
}
项目:Sharktron    文件:RedBullet.java   
@Override
protected void init()
{
    this.gfx = GFXLib.getBulletRed();

    // This bullet travels only on the X axis.
    this.velocity = new Point(10,0);

    super.init();
}
项目:chatterino    文件:Player.java   
public Player(String name) {
  this.name = name;
  position = new Point(16, 16);
  size = new Dimension(16, 16);
  speed = 0.2f;
}
项目:chatterino    文件:Player.java   
public Point GetPosition() {
  return position;
}
项目:chatterino    文件:ChatBubble.java   
private static float computeCurrentLineX(Point point, Dimension sizeOffset, int maxWidth) {
  return point.getX() + (sizeOffset.width / 2.0f) - (maxWidth / 2.0f);
}
项目:VortexGameLibrary    文件:TestPlayer.java   
public TestPlayer(Point startPoint, float width, float height){
    super(startPoint, width, height);
    setupAnimations();
}
项目:JavaRA    文件:TmpTexture.java   
public void setSpriteSheetCoords(Point coord) {
this.isInSpriteSheet = true;
this.spriteSheetPos = coord;
   }
项目:JavaRA    文件:TmpTexture.java   
public Point getSpriteSheetCoords() {
return this.spriteSheetPos;
   }
项目:JavaRA    文件:ShpTexture.java   
public void setSheetPos(int x, int y) {
this.sheetPos = new Point(x, y);
   }