Package com.pointcliki.map

Source Code of com.pointcliki.map.TiledMapEntity

package com.pointcliki.map;


import org.newdawn.slick.Graphics;
import org.newdawn.slick.geom.Vector2f;
import org.newdawn.slick.tiled.TiledMap;

import com.pointcliki.core.Entity;
import com.pointcliki.core.Viewport;

public class TiledMapEntity extends Entity {

  /**
   * Serial Key
   */
  private static final long serialVersionUID = 8175683365734838012L;
 
  protected TiledMap fMap = null;
 
  public TiledMapEntity(TiledMap tiledMap) {
    fMap = tiledMap;
    fPosition = new Vector2f(0, 0);
  }

  @Override
  public Entity snapshot() throws CloneNotSupportedException {
    // TODO Auto-generated method stub
    return null;
  }

  @Override
  public void cleanup() {
    // TODO Auto-generated method stub
   
  }

  @Override
  public void render(Graphics graphics, Viewport view, long currentTime) {
    if (fMap == null) return;
   
    //int x = (int) Math.floor(fPosition.getX() + Math.max(0, bounds.getX()));
    //int y = (int) Math.floor(fPosition.getY() + Math.max(0, bounds.getY()));
   
    // Render the map
    fMap.render((int) fPosition.getX(), (int) fPosition.getY());
  }
 
  public TiledMap getMap() {
    return fMap;
  }
}
TOP

Related Classes of com.pointcliki.map.TiledMapEntity

TOP
Copyright © 2018 www.massapi.com. 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.