Пример #1
0
  @Override
  public void render(Screen screen) {

    screen.clear(0);
    screen.blit(Art.emptyBackground, 0, 0);
    Font.defaultFont().draw(screen, MojamComponent.texts.getStatic("mp.enterIP"), 100, 100);
    Font.defaultFont().draw(screen, TitleMenu.ip + "-", 100, 120);

    super.render(screen);
  }
Пример #2
0
  public void render(Screen screen) {

    screen.clear(0);
    //        screen.blit(Art.titles[1], 0, 10);
    screen.blit(Art.titleScreen, 0, 0);

    super.render(screen);

    screen.blit(Art.lordLard[0][6], (gameWidth - 128) / 2 - 40, 180 + selectedItem * 40);
  }
Пример #3
0
  @Override
  public void tick(MouseButtons mouseButtons) {
    super.tick(mouseButtons);

    // show/hide save menu buttons
    if (updateButtons) {
      updateSaveButtons();
      updateButtons = false;
    }

    // lock buttons when save menu is visible
    if (saveMenuVisible) return;

    // update pencil location
    pencilX = (mouseButtons.getX() / 2) - (TILE_WIDTH / 2);
    pencilY = (mouseButtons.getY() / 2) - (TILE_HEIGHT / 2);

    // move level x with mouse
    if (mouseButtons.getX() - MENU_WIDTH > MENU_WIDTH) {
      if (pencilX + TILE_WIDTH > MojamComponent.GAME_WIDTH
          && -(mapX - MENU_WIDTH) < mapW - (MojamComponent.GAME_WIDTH - MENU_WIDTH) + TILE_HEIGHT) {
        mapX -= TILE_WIDTH / 2;
      } else if (pencilX < MENU_WIDTH && mapX < MENU_WIDTH + 32) {
        mapX += TILE_WIDTH / 2;
      }
    }

    // move level y with mouse
    if (pencilY + TILE_HEIGHT > MojamComponent.GAME_HEIGHT
        && -mapY < mapH - MojamComponent.GAME_HEIGHT + TILE_HEIGHT) {
      mapY -= TILE_HEIGHT / 2;
    } else if (pencilY < 0 && mapY < TILE_HEIGHT) {
      mapY += TILE_HEIGHT / 2;
    }

    // draw
    if (drawing || editorComponent.isPressed()) {
      int x = (((pencilX + TILE_WIDTH / 2) - mapX) / TILE_WIDTH);
      int y = (((pencilY + TILE_HEIGHT / 2) - mapY) / TILE_HEIGHT);
      draw(selectedButton.getTile(), x, y);
    }
  }
Пример #4
0
  @Override
  public void render(Screen screen) {
    screen.clear(0);

    // level floor
    screen.blit(mapFloor, mapX, mapY);

    // level tiles
    for (int x = 0; x < LEVEL_HEIGHT; x++) {
      for (int y = 0; y < LEVEL_WIDTH; y++) {

        if (map[x][y] == null) continue;

        if (map[x][y].h == TILE_HEIGHT) {
          if (mapTile[x][y] == HoleTile.COLOR) {
            if (y > 0 && !(mapTile[x][y - 1] == HoleTile.COLOR)) {
              screen.blit(map[x][y], TILE_HEIGHT * x + mapX, TILE_HEIGHT * y + mapY);
            } else {
              screen.fill(
                  TILE_HEIGHT * x + mapX, TILE_HEIGHT * y + mapY, TILE_WIDTH, TILE_HEIGHT, 0);
            }
          } else {
            screen.blit(map[x][y], TILE_HEIGHT * x + mapX, TILE_HEIGHT * y + mapY);
          }
        } else {
          // tile real height
          int tileH = (int) (Math.ceil(map[x][y].h / (float) TILE_HEIGHT)) * TILE_WIDTH;
          int tileY = TILE_HEIGHT - (tileH - map[x][y].h);

          if (mapTile[x][y] == UnbreakableRailTile.COLOR) {
            boolean n = y > 0 && mapTile[x][y - 1] == UnbreakableRailTile.COLOR;
            boolean s = y < 47 && mapTile[x][y + 1] == UnbreakableRailTile.COLOR;
            boolean w = x > 0 && mapTile[x - 1][y] == UnbreakableRailTile.COLOR;
            boolean e = x < 47 && mapTile[x + 1][y] == UnbreakableRailTile.COLOR;

            int c = (n ? 1 : 0) + (s ? 1 : 0) + (w ? 1 : 0) + (e ? 1 : 0);
            int img;

            if (c <= 1) {
              img = (n || s) ? 1 : 0; // default is horizontal
            } else if (c == 2) {
              if (n && s) {
                img = 1; // vertical
              } else if (w && e) {
                img = 0; // horizontal
              } else {
                img = n ? 4 : 2; // north turn
                img += e ? 0 : 1; // south turn
              }
            } else { // 3 or more turning disk
              img = 6;
            }
            screen.blit(Art.rails[img][0], mapX + TILE_HEIGHT * x, mapY + TILE_HEIGHT * y - tileY);
          } else {
            screen.blit(map[x][y], mapX + TILE_HEIGHT * x, mapY + TILE_HEIGHT * y - tileY);
          }
        }
      }
    }

    // pencil position indicator
    for (int x = 0; x < LEVEL_HEIGHT; x++) {
      for (int y = 0; y < LEVEL_WIDTH; y++) {
        if (x == (((pencilX + TILE_WIDTH / 2) - mapX) / TILE_WIDTH)
            && y == (((pencilY + TILE_HEIGHT / 2) - mapY) / TILE_HEIGHT)) {
          screen.blit(pencil, TILE_HEIGHT * x + mapX, TILE_HEIGHT * y + mapY);
          break;
        }
      }
    }

    super.render(screen);

    // minimap
    screen.blit(minimap, screen.w - minimap.w - 6, 6);

    // title
    // Font.defaultFont().drawCentered(screen, MojamComponent.texts.getStatic("leveleditor.title"),
    // MENU_WIDTH / 2, 10);
  }
Пример #5
0
 private void addMenu(GuiMenu menu) {
   menuStack.add(menu);
   menu.addButtonListener(this);
 }