Skip to main content

Screenshot

A class in Root.Township, Alta.Utilities.

Takes a photo through a hand camera into a texture and saves it as a PNG (Windows) or to the gallery (Android). Client only.

Constructors​

MemberWhat it is
Screenshot(HandCamera camera, int width = 1920, int height = 1080)Creates a Screenshot from camera, width and height.

Fields​

1 private and internal field
MemberWhat it is
private static Logger loggerClass logger.

Properties​

MemberWhat it is
HandCamera Camera { get; }The hand camera the photo is taken through.
int Height { get; }Photo height in pixels (1080 by default).
bool IsTransparent { get; set; }Meant to pick a transparent texture format, but the texture is made in the constructor, so setting it later has no effect.
Texture2D LastPhoto { get; }Texture holding the last photo taken.
int Width { get; }Photo width in pixels (1920 by default).
string WindowsPath { get; }Folder photos are saved to: the launcher's camera photos path, or a Screenshots folder in storage if that is empty or missing.

Methods​

MemberWhat it is
bool Take()Renders the camera into a temporary texture, reads it into LastPhoto and saves it. A blocked camera reads its current texture and skips saving.
5 private and internal methods
MemberWhat it is
private bool SavePhoto()Saves LastPhoto the right way for the platform. Logs an error on other platforms.
private bool SavePhotoAndroid()Saves the photo to the Android gallery, or to the Windows path in the editor.
private bool SavePhotoWindows()Writes the photo as a PNG to WindowsPath, making the folder if needed.
private string ScreenShotName()File name with size and local date and time, like screenshot_1920x1080_2024-01-01_12-00-00.png.
private string WindowsPathWithScreenShotName()Full file path for a new photo.

Used in​

Members of other types that take, return or hold a Screenshot: