Package com.googlecode.jumpnevolve.math

Examples of com.googlecode.jumpnevolve.math.Vector


    // world.add(new Follower(world, e2, 1000));
    // world.add(new Follower(world, e3, 1000));
    //
    // world.setZoom(200, 200);

    ElectronEmitter emit = new ElectronEmitter(world, new Vector(0, 100),
        0.1f);
    HomogenEField eF1 = new HomogenEField(world,
        ShapeFactory.createRectangle(new Vector(100, 100), 200, 200),
        Vector.RIGHT.mul(15.0f), false), eF2 = new HomogenEField(
        world,
        ShapeFactory.createRectangle(new Vector(4200, 100), 8000, 1000),
        Vector.UP.mul(5.0f), false);
    HomogenBField bF1 = new HomogenBField(
        world,
        ShapeFactory.createRectangle(new Vector(4200, 100), 8000, 1000),
        0.363f, false);
    world.add(emit);
    world.add(eF1);
    world.add(eF2);
    world.add(bF1);
    world.setCamera(new Camera() {

      @Override
      public Vector getPosition() {
        return new Vector(400, 100);
      }
    });

    // engine.setTargetFrameRate(Parameter.GAME_FPS_TARGET);
    engine.switchState(world);
View Full Code Here


    this.curState.draw(g);
  }

  public void drawBackground(Graphics g) {
    GraphicUtils.drawImage(g, ShapeFactory.createRectangle(
        new Vector(this.getWidth() / 2.0f, this.getHeight() / 2.0f),
        this.getWidth(), this.getHeight()), ResourceManager
        .getInstance().getImage(this.getBackgroundFile()));
  }
View Full Code Here

    return new Camera() {
      private static final long serialVersionUID = -8443861917665677557L;

      @Override
      public Vector getPosition() {
        return new Vector(Engine.getInstance().getWidth() / 2.0f,
            Engine.getInstance().getHeight() / 2.0f);
      }
    };
  }
View Full Code Here

  private Camera camera;
  private Campaign parent;
  private LevelMarker currentLevel;

  public CampaignMap(int width, int height, String background) {
    this.size = ShapeFactory.createRectangle(new Vector(width / 2,
        height / 2), width, height);
    this.mapImage = background;
    // FIXME: camera muss initialisiert werden
  }
View Full Code Here

  @Override
  public void poll(Input input, float secounds) {
    if (input.isKeyPressed(Input.KEY_ENTER)) {
      this.startLevel();
    } else {
      Vector mousePos = new Vector(input.getMouseX(), input.getMouseY())
          .add(this.camera.getPosition()).add(
              Engine.getInstance().getWidth() / 2.0f,
              Engine.getInstance().getHeight() / 2.0f);
      if (input.isMousePressed(Input.MOUSE_LEFT_BUTTON)) {
        LevelMarker newLevel = this.currentLevel
            .getLevelInDirection(mousePos
                .sub(this.currentLevel.position));

        this.currentLevel = newLevel;
      }
    }
View Full Code Here

  }

  @Override
  public void draw(Graphics g) {
    g.scale(1.0f, 1.0f);
    Vector cameraPosition = this.camera.getPosition();
    g.translate(Engine.getInstance().getWidth() / zoomX / 2.0f
        - cameraPosition.x, Engine.getInstance().getHeight() / zoomY
        / 2.0f - cameraPosition.y);
    this.drawBackground(g);
    for (LevelMarker marker : this.levels.values()) {
View Full Code Here

  private void drawRemainingTime(Graphics g) {
    GraphicUtils.drawString(
        g,
        this.getCamera()
            .getPosition()
            .sub(new Vector(Engine.getInstance().getWidth(), Engine
                .getInstance().getHeight() * 1.5f).div(3.0f)),
        "Verbleibende Zeit: " + (int) this.timer.getRemainingTime());
  }
View Full Code Here

    this.failedEffect.draw(g);
    GraphicUtils.drawString(
        g,
        this.getCamera()
            .getPosition()
            .sub(new Vector(Engine.getInstance().getWidth(), Engine
                .getInstance().getHeight()).div(4.0f)),
        "Die Zeit ist abgelaufen: Das Level wird in "
            + (int) this.timer.getRemainingTime()
            + " Sekunden neugestartet");
  }
View Full Code Here

    this.finishedEffect.draw(g);
    GraphicUtils.drawString(
        g,
        this.getCamera()
            .getPosition()
            .sub(new Vector(Engine.getInstance().getWidth(), Engine
                .getInstance().getHeight()).div(4.0f)),
        "Level erfolgreich beendet");
  }
View Full Code Here

   */
  @Override
  public Vector limitPosition(Vector position, World world) {
    int halfScreenWidth = Engine.getInstance().getWidth() / 2, halfScreenHeight = Engine
        .getInstance().getHeight() / 2;
    Vector re = position;
    if (position.x < halfScreenWidth) {
      re = re.modifyX(halfScreenWidth);
    }
    if (position.y < halfScreenHeight) {
      re = re.modifyY(halfScreenHeight);
    }
    if (position.x > world.width - halfScreenWidth) {
      re = re.modifyX(world.width - halfScreenWidth);
    }
    if (position.y > world.height - halfScreenHeight) {
      re = re.modifyY(world.height - halfScreenHeight);
    }
    return re;
  }
View Full Code Here

TOP

Related Classes of com.googlecode.jumpnevolve.math.Vector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.