Class EmiScreenshotRecorder

java.lang.Object
emi.dev.emi.emi.runtime.EmiScreenshotRecorder

public class EmiScreenshotRecorder extends Object
  • Constructor Details

    • EmiScreenshotRecorder

      public EmiScreenshotRecorder()
  • Method Details

    • saveScreenshot

      public static void saveScreenshot(String path, int width, int height, Runnable renderer)
      Saves a screenshot to the game's `screenshots` directory, doing the appropriate setup so that anything rendered in renderer will be captured and saved.

      Note: the path can have / characters, indicating subdirectories. Java handles these correctly on Windows. The path should not contain the .png extension, as that will be added after checking for duplicates. If a file with this path already exists, then path will be suffixed with a _#, before adding the .png extension, where # represents an increasing number to avoid conflicts.

      Note 2: The width and height parameters are reflected in the viewport when rendering. But the EMI-config ui.recipe-screenshot-scale value causes the resulting image to be scaled.

      Parameters:
      path - the path to save the screenshot to, without extension.
      width - the width of the screenshot, not counting EMI-config scale.
      height - the height of the screenshot, not counting EMI-config scale.
      renderer - a function to render the things being screenshotted.