Package dwlab.shapes.maps.tilemaps

Examples of dwlab.shapes.maps.tilemaps.TileMap


    waitForKey();

    clearScreen();
    World.fromFile( "res/tileset.lw" );
    TileSet tileSet = World.editorData.tilesets.getFirst();
    TileMap tileMap = TileMap.create( tileSet, mapSize, mapSize );
    tileMap.setSize( 400d / 25d, 400d / 25d );
    Project.printText( "Step 3: loading world, extract tileset from there and" );
    Project.printText( "creating tilemap with same size and this tileset", 1 );
    drawDoubleMap( doubleMap );
    swapBuffers();
    waitForKey();

    clearScreen();
    doubleMap.extractTo( tileMap, 0.5d, 1d, filledTileNum );
    Project.printText( "Step 4: setting tiles number of tilemap to FilledTileNum" );
    Project.printText( "if corresponding value of Double map is higher than 0.5", 1 );
    tileMap.draw();
    drawSignature();
    swapBuffers();
    waitForKey();

    clearScreen();
    for( int y = 0; y < mapSize; y++ ) {
      for( int x = 0; x < mapSize; x++ ) {
        fix( tileMap, x, y );
      }
    }
    printText( "Step 5: preparing tilemap by fixing some unmanaged cell positions" );
    tileMap.draw();
    drawSignature();
    swapBuffers();
    waitForKey();

    clearScreen();
    tileMap.enframe();
    printText( "Step 6a: enframing tile map" );
    tileMap.draw();
    drawSignature();
    swapBuffers();
    waitForKey();

    clearScreen();
    TileSet.prolongTiles = false;
    tileMap.enframe() ;
    printText( "Step 6b: enframing tile map with prolonging tiles off" );
    tileMap.draw();
    drawSignature();
    swapBuffers();
    waitForKey();

View Full Code Here


          if( tileX < minTileX ) break;
        }

        if( shapes != null ) {
          for( Shape shape: shapes ) {
            TileMap childTileMap = shape.toTileMap();
            if( childTileMap != null ) {
              drawTile( childTileMap, x, y, serviceSizes.x, serviceSizes.y, tileX, tileY, color );
            } else {
              drawSpriteMapTile( shape.toSpriteMap(), x, y, color );
            }
View Full Code Here

    main();
  }
 
  public static void main() {
    TileSet tileSet = new TileSet( new Image( "res/tiles.png", 8, 4 ) );
    TileMap tileMap = TileMap.create( tileSet, tileMapWidth, tileMapHeight );

    tileMap.setSize( tileMapWidth * 2, tileMapHeight * 2 );
    for( int y = 0; y < tileMapHeight; y++ ) {
      for( int x = 0; x < tileMapWidth; x++ ) {
        tileMap.setTile( x, y, (int) Service.random( 1, 31 ) );
      }
    }

    for( int n = 1; n <= 3; n++ ) {
      clearScreen();
      tileMap.draw();
      printText( "Press any Key to stretch tilemap by 2 times" );
      printText( "Stretch example", Align.TO_CENTER, Align.TO_BOTTOM );
      swapBuffers();
      waitForKey();
      tileMap.stretch( 2, 2 );
      tileMap.alterSize( 2, 2 );
    }
  }
View Full Code Here

  public void drawUsingVisualizer( Visualizer vis, Color drawingColor ) {
    if( ! visible ) return;

    if( mixContent ) {
      LinkedList shapes = new LinkedList();
      TileMap mainTileMap = null;
      for( Shape shape : children ) {
        TileMap tileMap = shape.toTileMap();
        if( tileMap != null ) {
          if( tileMap.tileSet.image != null ) {
            mainTileMap = tileMap;
            shapes.addLast( shape );
          }
View Full Code Here

TOP

Related Classes of dwlab.shapes.maps.tilemaps.TileMap

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.