当前位置: 首页>>代码示例>>Java>>正文


Java Point.getY方法代码示例

本文整理汇总了Java中org.newdawn.slick.geom.Point.getY方法的典型用法代码示例。如果您正苦于以下问题:Java Point.getY方法的具体用法?Java Point.getY怎么用?Java Point.getY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.newdawn.slick.geom.Point的用法示例。


在下文中一共展示了Point.getY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: IsColliding

import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
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;
}
 
开发者ID:Pheelbert,项目名称:chatterino,代码行数:17,代码来源:Player.java

示例2: SendPosition

import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
public void SendPosition(Point position) {
  if (!IsConnected()) {
    return;
  }

  PointInfo point = new PointInfo();
  point.x = position.getX();
  point.y = position.getY();
  client.sendTCP(point);
}
 
开发者ID:Pheelbert,项目名称:chatterino,代码行数:11,代码来源:NetworkClient.java

示例3: Translate

import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
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);
  }
}
 
开发者ID:Pheelbert,项目名称:chatterino,代码行数:8,代码来源:Player.java

示例4: Render

import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
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);
}
 
开发者ID:Pheelbert,项目名称:chatterino,代码行数:14,代码来源:ChatBubble.java

示例5: RenderBubble

import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
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);
  }
}
 
开发者ID:Pheelbert,项目名称:chatterino,代码行数:30,代码来源:ChatBubble.java

示例6: makeNewStone

import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
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());
	}
}
 
开发者ID:DominikHorn,项目名称:Go,代码行数:10,代码来源:ClientMain.java

示例7: renderLayer

import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
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);
    }		    
}	
   }
 
开发者ID:Cr0s,项目名称:JavaRA,代码行数:38,代码来源:SmudgeLayer.java

示例8: render

import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
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);
   }
 
开发者ID:Cr0s,项目名称:JavaRA,代码行数:36,代码来源:TileMap.java

示例9: renderMapEntities

import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
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();	
   }
 
开发者ID:Cr0s,项目名称:JavaRA,代码行数:33,代码来源:TileMap.java

示例10: renderAll

import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
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);
	    }		    
	}
    }
}	
   }
 
开发者ID:Cr0s,项目名称:JavaRA,代码行数:36,代码来源:ResourcesLayer.java

示例11: renderCell

import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
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);
    }		    
}	
   }
 
开发者ID:Cr0s,项目名称:JavaRA,代码行数:15,代码来源:ResourcesLayer.java

示例12: SideBarItemsButton

import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
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);
}
   }
 
开发者ID:Cr0s,项目名称:JavaRA,代码行数:15,代码来源:SideBarItemsButton.java

示例13: renderMinimap

import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
public void renderMinimap(Point minimapPos, Graphics gr, Color filterColor) {
int miniX = (int) minimapPos.getX();
int miniY = (int) minimapPos.getY();

this.minimapImage.draw(miniX, miniY, filterColor);
   }
 
开发者ID:Cr0s,项目名称:JavaRA,代码行数:7,代码来源:MinimapRenderer.java

示例14: distanceSq

import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
public static int distanceSq(Point p1, Point p2) {
float dx = p1.getX() - p2.getX();
float dy = p1.getY() - p2.getY();

return (int) Math.ceil(dx * dx + dy * dy);
   }
 
开发者ID:Cr0s,项目名称:JavaRA,代码行数:7,代码来源:PointsUtil.java

示例15: DrawableGameComponent

import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
/**
 * Creates a new Instance at the given position.
 *
 * @param pos The Slick2D Point holding the positions x and y coordinates
 */
public DrawableGameComponent(Point pos)
{
    this.position = new Point(pos.getX(), pos.getY());
}
 
开发者ID:klausklapper,项目名称:Sharktron,代码行数:10,代码来源:DrawableGameComponent.java


注:本文中的org.newdawn.slick.geom.Point.getY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。