コード例 #1
0
ファイル: GUI.java プロジェクト: theoutsider24/JORTS
  public void init() {
    errorMessage = new TextField();
    errorMessage.text.setColor(Color.RED);
    errorMessage.text.setCharacterSize(10);
    errorMessage.setFillColor(Color.TRANSPARENT);
    errorMessage.setOutlineColor(Color.TRANSPARENT);
    errorMessage.setPosition((RESOLUTION_X / 2) - 50, RESOLUTION_Y - LOWER_GUI_HEIGHT - 80);
    errorMessage.setSize(new Vector2f(200, 15));

    drawables = new ArrayList<Drawable>();
    this.view = window.uiView;
    minimap = new Minimap(window);
    minimap.setPosition(
        RESOLUTION_X - minimap.getSize().x - 20, RESOLUTION_Y - minimap.getSize().y - 20);
    // buttons = new ArrayList<uiButton>();

    lowerBackground = new GuiRectangle();
    lowerBackground.setPosition(0, RESOLUTION_Y - LOWER_GUI_HEIGHT);
    lowerBackground.setSize(new Vector2f(RESOLUTION_X, LOWER_GUI_HEIGHT));
    lowerBackground.setFillColor(new Color(50, 50, 50));

    topBackground = new GuiRectangle();
    topBackground.setPosition(0, 0);
    topBackground.setSize(new Vector2f(RESOLUTION_X, UPPER_GUI_HEIGHT));
    topBackground.setFillColor(new Color(50, 50, 50));

    buildingStatusLayout = new BuildingStatusLayout(this);
    unitStatusLayout = new UnitStatusLayout(this);

    playerList = new PlayerList(window);
    exit = new ExitButton("", window);
    console = new Console();

    clock = new GameClock();
    fpsTimer = new FPSTimer();

    unitCapCounter = new UnitCapCounter(window);
    resourceList = new ResourceList(window);

    selectionRect = new SelectionRect(window);
    cursor = new Cursor(window);
    cursor.setColor(Color.RED);

    mapEditorGui = new MapEditorGui(this);
    mapEditorGui.disable();

    cursorState =
        new UpdatableTextField() {
          @Override
          public void update() {
            setText(cursor.state);
          }
        };
    cursorState.setPosition(new Vector2f(10, RESOLUTION_Y - LOWER_GUI_HEIGHT - 70));

    // grid1 = new StandardButtonGrid(1, 7, new Vector2f(10,100),this);
    controlGroupButtonGrid =
        new ControlGroupButtonGrid(
            1, 9, new Vector2f(RESOLUTION_X / 2, RESOLUTION_Y - LOWER_GUI_HEIGHT - 40), this);
    actionButtonGrid =
        new ActionButtonGrid(0, 0, new Vector2f(20, RESOLUTION_Y - LOWER_GUI_HEIGHT + 20), this);

    // controlGroupButtonGrid.setOutlineThickness(0);
    // initButtons();

    pauseOverlay = new PauseOverlay();

    rects.add(minimap);
    // rects.add(grid1);
    rects.add(controlGroupButtonGrid);
    rects.add(actionButtonGrid);

    rects.add(buildingStatusLayout.currentSlot);
    rects.add(buildingStatusLayout.slots);

    rects.add(clock);
    rects.add(fpsTimer);
    rects.add(unitCapCounter);
    rects.add(exit);
    rects.add(lowerBackground);
    rects.add(topBackground);
  }
コード例 #2
0
ファイル: GUI.java プロジェクト: theoutsider24/JORTS
  @Override
  public void draw(RenderTarget window, RenderStates arg1) {
    window.setView(view);
    window.draw(topBackground);
    window.draw(lowerBackground);
    // window.draw(grid1);
    ((ControlGroupButtonGrid) controlGroupButtonGrid).update();
    window.draw(controlGroupButtonGrid);

    window.draw(errorMessage);

    ((ActionButtonGrid) actionButtonGrid).update();
    window.draw(actionButtonGrid);
    if (MINIMAP_ON) {
      minimap.update();
      window.draw(minimap);
    }

    buildingStatusLayout.update(this.window.activePlayer.getSelectedBuildings());
    if (this.window.activePlayer.getSelectedBuildings().size() > 0) {
      window.draw(buildingStatusLayout);
    }
    buildingStatusLayout.progressBar.update();

    if (this.window.activePlayer.getSelectedUnits().size() > 0) {
      unitStatusLayout.update(this.window.activePlayer.getSelectedUnits());
      window.draw(unitStatusLayout);
    }

    if (EDITING_MAP) window.draw(mapEditorGui);

    clock.update();
    window.draw(clock);

    fpsTimer.update();
    window.draw(fpsTimer);

    unitCapCounter.update();
    window.draw(unitCapCounter);

    resourceList.update();
    window.draw(resourceList);

    window.draw(exit);

    window.draw(playerList);

    console.lineTimerTick();
    CommandQueue.tick();
    window.draw(console);
    // cursor.setPosition(new
    // Vector2f(Mouse.getPosition((RenderWindow)window).x,Mouse.getPosition((RenderWindow)window).y));
    // cursor.update();
    window.draw(selectionRect);
    window.draw(cursor);
    cursorState.update();
    window.draw(cursorState);
    if (PAUSED) window.draw(pauseOverlay);
    // for(Drawable d:drawables)
    //	window.draw(d);
  }