示例#1
0
  /**
   * Takes the map data are returns a Texture that can be drawn from a sprite.
   *
   * @param width How wide in pixels you want the returned Texture to be.
   * @param height How high in pixels you want the returned Texture to be.
   * @return a Texture that is width x height big that can then be drawn to the screen
   * @throws TextureCreationException
   */
  ConstTexture drawMap() {
    int currentSlot = 0;
    screen.clear();
    for (int x = 0; x < XSize; x++) {
      for (int y = 0; y < YSize; y++) {
        currentTile.setPosition(x * 16, y * 16);
        currentTile.setTexture(textures.tiles.get(textureMap.get(currentSlot)));
        screen.draw(currentTile);
        currentSlot++;
      }
    }
    screen.display();

    return screen.getTexture();
  }
示例#2
0
 OSprite(Texture texture) {
   sprite = new Sprite();
   sprite.setTexture(texture);
 }