Java 类org.newdawn.slick.util.pathfinding.navmesh.Link 实例源码

项目:trashjam2017    文件:NavMeshTest.java   
/**
 * Render the game - in this case render the map and diagnostic data
 * 
 * @param container The container we're running the game in
 * @param g The graphics context on which to render
 */
public void render(GameContainer container, Graphics g)
        throws SlickException {
    g.translate(50,50);
    for (int x=0;x<50;x++) {
        for (int y=0;y<50;y++) {
            if (dataMap.blocked(this, x, y)) {
                g.setColor(Color.gray);
                g.fillRect((x*10)+1,(y*10)+1,8,8);
            }
        }
    }

    if (showSpaces) {
        for (int i=0;i<navMesh.getSpaceCount();i++) {
            Space space = navMesh.getSpace(i);
            if (builder.clear(dataMap, space)) {
                g.setColor(new Color(1,1,0,0.5f));
                g.fillRect(space.getX()*10, space.getY()*10, space.getWidth()*10, space.getHeight()*10);
            }
            g.setColor(Color.yellow);
            g.drawRect(space.getX()*10, space.getY()*10, space.getWidth()*10, space.getHeight()*10);

            if (showLinks) {
                int links = space.getLinkCount();
                for (int j=0;j<links;j++) {
                    Link link = space.getLink(j);
                    g.setColor(Color.red);
                    g.fillRect((link.getX()*10)-2, (link.getY()*10)-2,5,5);
                }
            }
        }
    }

    if (path != null) {
        g.setColor(Color.white);
        for (int i=0;i<path.length()-1;i++) {
            g.drawLine(path.getX(i)*10, path.getY(i)*10, path.getX(i+1)*10, path.getY(i+1)*10);
        }
    }
}
项目:Progetto-C    文件:NavMeshTest.java   
/**
 * Render the game - in this case render the map and diagnostic data
 * 
 * @param container The container we're running the game in
 * @param g The graphics context on which to render
 */
public void render(GameContainer container, Graphics g)
        throws SlickException {
    g.translate(50,50);
    for (int x=0;x<50;x++) {
        for (int y=0;y<50;y++) {
            if (dataMap.blocked(this, x, y)) {
                g.setColor(Color.gray);
                g.fillRect((x*10)+1,(y*10)+1,8,8);
            }
        }
    }

    if (showSpaces) {
        for (int i=0;i<navMesh.getSpaceCount();i++) {
            Space space = navMesh.getSpace(i);
            if (builder.clear(dataMap, space)) {
                g.setColor(new Color(1,1,0,0.5f));
                g.fillRect(space.getX()*10, space.getY()*10, space.getWidth()*10, space.getHeight()*10);
            }
            g.setColor(Color.yellow);
            g.drawRect(space.getX()*10, space.getY()*10, space.getWidth()*10, space.getHeight()*10);

            if (showLinks) {
                int links = space.getLinkCount();
                for (int j=0;j<links;j++) {
                    Link link = space.getLink(j);
                    g.setColor(Color.red);
                    g.fillRect((link.getX()*10)-2, (link.getY()*10)-2,5,5);
                }
            }
        }
    }

    if (path != null) {
        g.setColor(Color.white);
        for (int i=0;i<path.length()-1;i++) {
            g.drawLine(path.getX(i)*10, path.getY(i)*10, path.getX(i+1)*10, path.getY(i+1)*10);
        }
    }
}
项目:BaseClient    文件:NavMeshTest.java   
/**
 * Render the game - in this case render the map and diagnostic data
 * 
 * @param container The container we're running the game in
 * @param g The graphics context on which to render
 */
public void render(GameContainer container, Graphics g)
        throws SlickException {
    g.translate(50,50);
    for (int x=0;x<50;x++) {
        for (int y=0;y<50;y++) {
            if (dataMap.blocked(this, x, y)) {
                g.setColor(Color.gray);
                g.fillRect((x*10)+1,(y*10)+1,8,8);
            }
        }
    }

    if (showSpaces) {
        for (int i=0;i<navMesh.getSpaceCount();i++) {
            Space space = navMesh.getSpace(i);
            if (builder.clear(dataMap, space)) {
                g.setColor(new Color(1,1,0,0.5f));
                g.fillRect(space.getX()*10, space.getY()*10, space.getWidth()*10, space.getHeight()*10);
            }
            g.setColor(Color.yellow);
            g.drawRect(space.getX()*10, space.getY()*10, space.getWidth()*10, space.getHeight()*10);

            if (showLinks) {
                int links = space.getLinkCount();
                for (int j=0;j<links;j++) {
                    Link link = space.getLink(j);
                    g.setColor(Color.red);
                    g.fillRect((link.getX()*10)-2, (link.getY()*10)-2,5,5);
                }
            }
        }
    }

    if (path != null) {
        g.setColor(Color.white);
        for (int i=0;i<path.length()-1;i++) {
            g.drawLine(path.getX(i)*10, path.getY(i)*10, path.getX(i+1)*10, path.getY(i+1)*10);
        }
    }
}
项目:GPVM    文件:NavMeshTest.java   
/**
 * Render the game - in this case render the map and diagnostic data
 * 
 * @param container The container we're running the game in
 * @param g The graphics context on which to render
 */
public void render(GameContainer container, Graphics g)
        throws SlickException {
    g.translate(50,50);
    for (int x=0;x<50;x++) {
        for (int y=0;y<50;y++) {
            if (dataMap.blocked(this, x, y)) {
                g.setColor(Color.gray);
                g.fillRect((x*10)+1,(y*10)+1,8,8);
            }
        }
    }

    if (showSpaces) {
        for (int i=0;i<navMesh.getSpaceCount();i++) {
            Space space = navMesh.getSpace(i);
            if (builder.clear(dataMap, space)) {
                g.setColor(new Color(1,1,0,0.5f));
                g.fillRect(space.getX()*10, space.getY()*10, space.getWidth()*10, space.getHeight()*10);
            }
            g.setColor(Color.yellow);
            g.drawRect(space.getX()*10, space.getY()*10, space.getWidth()*10, space.getHeight()*10);

            if (showLinks) {
                int links = space.getLinkCount();
                for (int j=0;j<links;j++) {
                    Link link = space.getLink(j);
                    g.setColor(Color.red);
                    g.fillRect((link.getX()*10)-2, (link.getY()*10)-2,5,5);
                }
            }
        }
    }

    if (path != null) {
        g.setColor(Color.white);
        for (int i=0;i<path.length()-1;i++) {
            g.drawLine(path.getX(i)*10, path.getY(i)*10, path.getX(i+1)*10, path.getY(i+1)*10);
        }
    }
}
项目:SpaceStationAlpha    文件:NavMeshTest.java   
/**
 * Render the game - in this case render the map and diagnostic data
 * 
 * @param container The container we're running the game in
 * @param g The graphics context on which to render
 */
public void render(GameContainer container, Graphics g)
        throws SlickException {
    g.translate(50,50);
    for (int x=0;x<50;x++) {
        for (int y=0;y<50;y++) {
            if (dataMap.blocked(this, x, y)) {
                g.setColor(Color.gray);
                g.fillRect((x*10)+1,(y*10)+1,8,8);
            }
        }
    }

    if (showSpaces) {
        for (int i=0;i<navMesh.getSpaceCount();i++) {
            Space space = navMesh.getSpace(i);
            if (builder.clear(dataMap, space)) {
                g.setColor(new Color(1,1,0,0.5f));
                g.fillRect(space.getX()*10, space.getY()*10, space.getWidth()*10, space.getHeight()*10);
            }
            g.setColor(Color.yellow);
            g.drawRect(space.getX()*10, space.getY()*10, space.getWidth()*10, space.getHeight()*10);

            if (showLinks) {
                int links = space.getLinkCount();
                for (int j=0;j<links;j++) {
                    Link link = space.getLink(j);
                    g.setColor(Color.red);
                    g.fillRect((link.getX()*10)-2, (link.getY()*10)-2,5,5);
                }
            }
        }
    }

    if (path != null) {
        g.setColor(Color.white);
        for (int i=0;i<path.length()-1;i++) {
            g.drawLine(path.getX(i)*10, path.getY(i)*10, path.getX(i+1)*10, path.getY(i+1)*10);
        }
    }
}
项目:cretion    文件:NavMeshTest.java   
/**
 * Render the game - in this case render the map and diagnostic data
 * 
 * @param container The container we're running the game in
 * @param g The graphics context on which to render
 */
public void render(GameContainer container, Graphics g)
        throws SlickException {
    g.translate(50,50);
    for (int x=0;x<50;x++) {
        for (int y=0;y<50;y++) {
            if (dataMap.blocked(this, x, y)) {
                g.setColor(Color.gray);
                g.fillRect((x*10)+1,(y*10)+1,8,8);
            }
        }
    }

    if (showSpaces) {
        for (int i=0;i<navMesh.getSpaceCount();i++) {
            Space space = navMesh.getSpace(i);
            if (builder.clear(dataMap, space)) {
                g.setColor(new Color(1,1,0,0.5f));
                g.fillRect(space.getX()*10, space.getY()*10, space.getWidth()*10, space.getHeight()*10);
            }
            g.setColor(Color.yellow);
            g.drawRect(space.getX()*10, space.getY()*10, space.getWidth()*10, space.getHeight()*10);

            if (showLinks) {
                int links = space.getLinkCount();
                for (int j=0;j<links;j++) {
                    Link link = space.getLink(j);
                    g.setColor(Color.red);
                    g.fillRect((link.getX()*10)-2, (link.getY()*10)-2,5,5);
                }
            }
        }
    }

    if (path != null) {
        g.setColor(Color.white);
        for (int i=0;i<path.length()-1;i++) {
            g.drawLine(path.getX(i)*10, path.getY(i)*10, path.getX(i+1)*10, path.getY(i+1)*10);
        }
    }
}
项目:slick2d-maven    文件:NavMeshTest.java   
/**
 * Render the game - in this case render the map and diagnostic data
 * 
 * @param container The container we're running the game in
 * @param g The graphics context on which to render
 */
public void render(GameContainer container, Graphics g)
        throws SlickException {
    g.translate(50,50);
    for (int x=0;x<50;x++) {
        for (int y=0;y<50;y++) {
            if (dataMap.blocked(this, x, y)) {
                g.setColor(Color.gray);
                g.fillRect((x*10)+1,(y*10)+1,8,8);
            }
        }
    }

    if (showSpaces) {
        for (int i=0;i<navMesh.getSpaceCount();i++) {
            Space space = navMesh.getSpace(i);
            if (builder.clear(dataMap, space)) {
                g.setColor(new Color(1,1,0,0.5f));
                g.fillRect(space.getX()*10, space.getY()*10, space.getWidth()*10, space.getHeight()*10);
            }
            g.setColor(Color.yellow);
            g.drawRect(space.getX()*10, space.getY()*10, space.getWidth()*10, space.getHeight()*10);

            if (showLinks) {
                int links = space.getLinkCount();
                for (int j=0;j<links;j++) {
                    Link link = space.getLink(j);
                    g.setColor(Color.red);
                    g.fillRect((link.getX()*10)-2, (link.getY()*10)-2,5,5);
                }
            }
        }
    }

    if (path != null) {
        g.setColor(Color.white);
        for (int i=0;i<path.length()-1;i++) {
            g.drawLine(path.getX(i)*10, path.getY(i)*10, path.getX(i+1)*10, path.getY(i+1)*10);
        }
    }
}