pub struct EnvVariable {
name: text,
value: text
}
Types and functions for reading and writing files. A File value is obtained via file() and carries the path, format, and an internal reference. An environment variable as a name/value pair.
pub struct Pixel {
r: integer limit(0, 255) not null,
g: integer limit(0, 255) not null,
b: integer limit(0, 255) not null
}
pub struct Image {
name: text,
width: integer,
height: integer,
data: vector < Pixel >
}
pub enum Format {
TextFile,
LittleEndian,
BigEndian,
Directory,
NotExists
}
pub struct File {
path: text,
size: long,
format: Format,
ref: i32,
current: long,
next: long
}
pub fn value(self: Pixel) -> integer
Returns the pixel colour as a packed 24-bit integer (0xRRGGBB). Use for fast colour comparison or storage.
pub fn content(self: File) -> text
pub fn lines(self: File) -> vector < text >
Returns the platform path separator character: '\' on Windows, '/' elsewhere. Detected once at startup from the runtime filesystem.
pub fn path_sep() -> character
pub fn file(path: text) -> File
pub fn exists(path: text) -> boolean
pub fn delete(path: text) -> boolean
pub fn move(from: text, to: text) -> boolean
pub fn mkdir(path: text) -> boolean
pub fn mkdir_all(path: text) -> boolean
pub fn set_file_size(self: File, size: long) -> boolean
pub fn files(self: File) -> vector < File >
pub fn write(self: File, v: text)
pub fn png(self: File) -> Image
Decodes a PNG file and returns an Image. Returns null if the file is not in text format. Use to load sprite sheets or textures.