Package org.newdawn.slick.geom

Examples of org.newdawn.slick.geom.Vector2f


 
  protected TiledMap fMap = null;
 
  public TiledMapEntity(TiledMap tiledMap) {
    fMap = tiledMap;
    fPosition = new Vector2f(0, 0);
  }
View Full Code Here


    fMouseMinion = new Minion<MouseEvent>() {
      @Override
      public long run(Dispatcher<MouseEvent> dispatcher, String type, MouseEvent event) {
        if (fDispatcher == null) return Minion.FINISH;
        if (type.equals("mouse.down")) focus();
        handleUIMouseEvent(type, new Vector2f(event.x(), event.y()), event);
        return Minion.CONTINUE;
      }
    };
    MouseEventDispatcher m = PointClikiGame.inputManager().mouseDispatcher();
    m.addMinion("mouse.move", fMouseMinion);
View Full Code Here

    this(text, href, font, false);
  }
 
  public Hyperlink(String text, String href, UnicodeFont font, boolean selected) {
    fText = new TextEntity(text, TextEntity.ALIGN_LEFT, font);
    fText.position(new Vector2f(5, 2 + font.getHeight(text) / 2));
    addChild(fText, 0);
    resize(new Vector2f(fText.span().getWidth() + 10, fText.span().getHeight() + 4));
    fHref = href;
    if (selected) select();
  }
View Full Code Here

  public void handleUIMouseEvent(String type, Vector2f local, MouseEvent event) {
    fDispatcher.dispatchEvent(type, event);
   
    if (type.equals("mouse.down")) {
      fStart = new Vector2f(event.x(), event.y());
      fPrev = fValue;
    } else if (type.equals("mouse.drag")) {
      // Position
      float offset = 0;
      if (fVertical) offset = event.y() - fStart.y;
View Full Code Here

      if (e.id() == -1) continue;
      // Try
      if (e instanceof UIEntity) {
        UIEntity u = (UIEntity) e;
       
        Vector2f pos = new Vector2f(local.x - u.position().x, local.y - u.position().y);
       
        if (type.equals("mouse.down")) {
          if (u.capturePoint(type, pos, event)) {
            if (clickThrough) {
              if (!u.fFocused) u.focus();
View Full Code Here

    fScale = scale;
    return this;
  }
 
  public Entity scale(float s) {
    fScale = new Vector2f(s, s);
    return this;
  }
View Full Code Here

 
  @Override
  public void setTile(GridCoordinate tile) {
    gridManager().moveObject(fTile, tile, this);
    fTile = tile;
    position(new Vector2f(tile.x() * 32f + 16f, tile.y() * 32f + 16f));
  }
View Full Code Here

   
    // Create human player
    fHuman = new HumanPlayer("human");
    fPlayerManager.add(fHuman);
               
    final MapEntity fMapViewer = new MapEntity(fMapManager.map(), new Vector2f(fGame.application().getScreenWidth(), fGame.application().getScreenHeight()));
    addChild(fMapViewer);
    fMapViewer.init();
   
    Minion<TimeEvent> scroller = new Minion<TimeEvent>() {
      public long run(com.pointcliki.event.Dispatcher<TimeEvent> dispatcher, String type, TimeEvent event) {
        if (GruntzGame.inputManager().isKeyPressed(Keyboard.KEY_RIGHT)) fMapViewer.offset(new Vector2f(Math.min(Math.max(fMapViewer.offset().x - event.delta() / 2f, -fMapViewer.map().width() * 32f + fSW), 0), fMapViewer.offset().y));
        else if (GruntzGame.inputManager().isKeyPressed(Keyboard.KEY_LEFT)) fMapViewer.offset(new Vector2f(Math.min(Math.max(fMapViewer.offset().x + event.delta() / 2f, -fMapViewer.map().width() * 32 + fSW), 0), fMapViewer.offset().y));
        if (GruntzGame.inputManager().isKeyPressed(Keyboard.KEY_DOWN)) fMapViewer.offset(new Vector2f(fMapViewer.offset().x, Math.min(Math.max(fMapViewer.offset().y - event.delta() / 2f, -fMapViewer.map().height() * 32 + fSH), 0)));
        else if (GruntzGame.inputManager().isKeyPressed(Keyboard.KEY_UP)) fMapViewer.offset(new Vector2f(fMapViewer.offset().x, Math.min(Math.max(fMapViewer.offset().y + event.delta() / 2f, -fMapViewer.map().height() * 32 + fSH), 0)));
        return Minion.CONTINUE;       
      };
    };
    timeManager().dispatcher().addMinion(TimeEvent.TYPE, scroller);
   
View Full Code Here

  @Override
  public void configureManagers() {
    super.configureManagers();
   
    fPlayerManager = new GruntzPlayerManager(this);
    fGridManager = new GridManager(this, new Vector2f(32f, 32f), new Vector2f(16f, 16f));
    fMapManager = new MapManager(this);
    fPressureManager = new PressureManager(this);
    fEffectManager = new EffectManager(this);
   
    fManagers.put(PlayerManager.class, fPlayerManager);
View Full Code Here

   * @param file The image file i.e. GAME/IMAGEZ/WAPWORLDONLY/TRIGGER
   * @param animation The optional animation file i.e. GAME/ANIZ/WATER1.ANI, null otherwise
   * @param data The byte data following these, containing e.g. smarts, health, rects
   */
  public void importFromWWD(String logic, String image, String animation, byte[] data) {
    Vector2f pos = MonolithWWD.readPosition(data);
    if (fSnapToGrid) position(new Vector2f((int) Math.round((pos.x - 16f) / 32f) * 32f + 16f, (int) Math.round((pos.y - 16f) / 32f) * 32f + 16f));
    else position(pos);
    order((int) position().y);
  }
View Full Code Here

TOP

Related Classes of org.newdawn.slick.geom.Vector2f

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.