Exemplo n.º 1
0
 @Override
 public void render(
     float delta, OrthographicCamera camera, GDXRenderer gdxRenderer, ShapeRenderer renderer) {
   if (!screen.isLive()) {
     renderer.setProjectionMatrix(camera.combined);
     renderer.begin(ShapeType.Line);
     for (GDXPath object : screen.getLevel().getPaths())
       renderNodeList(object.getNodes(), renderer, Color.GRAY);
     if (pathWindow != null) renderNodeList(pathWindow.getNodes(), renderer, Color.DARK_GRAY);
     renderer.end();
   }
 };
Exemplo n.º 2
0
 @Override
 public boolean touchDown(int x, int y, int x1, int y1) {
   super.touchDown(x, y, x1, y1);
   Gdx.app.debug("PathMode.touchDown", "x=" + x + " y=" + y);
   GDXPath path = screen.getLevel().getClosestPath(coordinates.x, coordinates.y);
   if (Gdx.input.isKeyPressed(Keys.CONTROL_LEFT)
       || path == null
       || path.getClosestNode(coordinates.x, coordinates.y).dst(coordinates.x, coordinates.y)
           > LevelEditorScreen.getNodeRadius()) path = new GDXPath();
   if (pathWindow == null)
     screen.getStage().addActor(pathWindow = new PathWindow(screen.getSkin(), this, path));
   if (path.getNodes().isEmpty()) pathWindow.add(coordinates.cpy());
   return false;
 }
Exemplo n.º 3
0
 @Override
 public void clean() {
   if (pathWindow != null) pathWindow.remove();
   pathWindow = null;
 }
Exemplo n.º 4
0
 @Override
 public boolean contains(float x, float y) {
   return pathWindow != null && pathWindow.contains(x, y);
 }