本文整理汇总了Java中org.newdawn.slick.geom.Point.getX方法的典型用法代码示例。如果您正苦于以下问题:Java Point.getX方法的具体用法?Java Point.getX怎么用?Java Point.getX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.newdawn.slick.geom.Point
的用法示例。
在下文中一共展示了Point.getX方法的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;
}
示例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);
}
示例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);
}
}
示例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);
}
示例5: 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());
}
}
示例6: 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);
}
}
}
示例7: 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);
}
示例8: 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();
}
示例9: 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);
}
}
}
}
}
示例10: 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);
}
}
}
示例11: 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);
}
}
示例12: cellToMinimapPixel
import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
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()));
}
示例13: computeCurrentLineX
import org.newdawn.slick.geom.Point; //导入方法依赖的package包/类
private static float computeCurrentLineX(Point point, Dimension sizeOffset, int maxWidth) {
return point.getX() + (sizeOffset.width / 2.0f) - (maxWidth / 2.0f);
}
示例14: 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);
}
示例15: 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);
}