Skip to content

Latest commit

 

History

History
222 lines (144 loc) · 8.4 KB

File metadata and controls

222 lines (144 loc) · 8.4 KB

Latite Scripting Documentation (Exports)


Exports > gfx/graphics > Graphics

Graphics

Interface

Source: gfx/graphics.d.ts:112

Methods

drawItem()

drawItem( item: ItemStack, pos: Vector2, sizeModifier: number, opacity: number): void

Draw an item instance.

Source: gfx/graphics.d.ts:163

Parameters

Parameter Type Description
item ItemStack The item to draw
pos Vector2 The position in pixels to draw the texture
sizeModifier number The relative size modifier (defualt: 1.0, aka 16 pixels)
opacity number The opacity of the item

Returns

void

drawRect()

drawRect( rect: Rect, color: Color, thickness: number, radius?: number): void

Source: gfx/graphics.d.ts:118

Parameters

Parameter Type
rect Rect
color Color
thickness number
radius? number

Returns

void

drawText()

drawText( pos: Vector2, text: string, size: number, color: Color): void

Draws text on the position specified

Source: gfx/graphics.d.ts:133

Parameters

Parameter Type Description
pos Vector2 The position to draw the text
text string The text to draw
size number The size of the text in pixels
color Color The color of the text

Returns

void

drawTextFull()

drawTextFull( area: Rect, text: string, size: number, color: Color, alignment: TextAlignment, verticalAlignment: VerticalAlignment): void

A full verison of drawText, where you can specify the bounds of the text and the alignment

Source: gfx/graphics.d.ts:144

Parameters

Parameter Type Description
area Rect The place to render the text
text string The text to render
size number The size of the text
color Color The color of the text
alignment TextAlignment The horizontal alignment
verticalAlignment VerticalAlignment The vertical alignment

Returns

void

drawTexture()

drawTexture( texture: Texture, pos: Vector2, sizeX: number, sizeY: number, color?: Color): void

Draws a texture.

Source: gfx/graphics.d.ts:154

Parameters

Parameter Type Description
texture Texture The texture to draw
pos Vector2 The position to draw the texture
sizeX number The size of the texture in pixels
sizeY number The size of the texture in pixels
color? Color The overlay color of the texture (defaults to white)

Returns

void

fillRect()

fillRect( rect: Rect, color: Color, radius?: number): void

Source: gfx/graphics.d.ts:119

Parameters

Parameter Type
rect Rect
color Color
radius? number

Returns

void

getTextSize()

getTextSize(text: string, textSize: number): Vector2

Source: gfx/graphics.d.ts:121

Parameters

Parameter Type
text string
textSize number

Returns

Vector2

restoreClippingRect()

restoreClippingRect(): void

Source: gfx/graphics.d.ts:124

Returns

void

setClippingRect()

setClippingRect(rect: Rect): void

Source: gfx/graphics.d.ts:123

Parameters

Parameter Type
rect Rect

Returns

void

use()

use(renderer: "dx" | "minecraft"): void

Source: gfx/graphics.d.ts:117

Parameters

Parameter Type Description
renderer "dx" | "minecraft" "dx": uses Direct2D/DirectWrite, "minecraft": use the Minecraft renderer

Returns

void