コード例 #1
0
  private void drawTitleImage(Painter p, Color4f color) {
    TextureQuad titleScreen = TexturesLoader.getQuad(GameRessources.PATH_TITLE_SCREEN);

    double scale = this.theTextPainter.getRealScale() * 1d / 3d;

    double width = theWindow.getWidthOnGLOrtho(titleScreen.getWidth()) * scale;
    double height = theWindow.getHeightOnGLOrtho(titleScreen.getHeight()) * scale;

    final double hOffset = 0.2 * scale;

    p.setColor(color);
    p.setTexture(titleScreen);
    GLUtil.drawQuad2D(-width / 2, height / 2 + hOffset, width / 2, -height / 2 + hOffset, p);
  }
コード例 #2
0
  @Override
  protected void drawComponentAppearing(Painter painter) {
    switch (appearSelector) {
      case FIRST_APPEARING:
        TextureQuad tex1 =
            TexturesLoader.getQuad(
                String.format(GameRessources.SPEC_PATH_TERRAIN, 1) + GameRessources.TEX_SOL);
        float colorUnit = (float) ((double) getAppearCount() / timeToAppear() * 0.5);
        Color4f color = new Color4f(colorUnit, colorUnit, colorUnit);
        Color4f buttonColor = new Color4f(colorUnit * 2, colorUnit * 2, colorUnit * 2);

        painter.setColor(color);
        tex1.fillScreen2D(0.5, 0.5, true, painter);

        drawTitleImage(painter, buttonColor);

        newPart.setColor(buttonColor);
        loadPart.setColor(buttonColor);
        break;

      default:
        super.drawComponentAppearing(painter);
    }
  }