TextureProvider

Group
player
Methods
5
Fields
None

Getting one

client:getTextureProvider()

Methods

MethodReturnsDescription
getBrightness()numberThe brightness the client makes its textures at: lower is brighter, 0.9, 0.8, 0.7 and 0.6 for the game's four brightness steps (the client'…
getTextures(){ n: number, [number]: Texture? }The client's textures, by id: texture id is at textures[id + 1], nil where the client has no texture at that id, and n holds the leng…
setBrightness(number)()Make the client's textures at brightness from now on (lower is brighter): the client's own setter, which drops every texture's pixels, so…
load(number){number}?Texture id's pixels at the provider's brightness: size * size ARGB colours (128 x 128), made as the client makes them (it keeps 20 text…
equals(any)booleanWhether other equals this TextureProvider, as == answers it (false for a value of another class).

Returned by

MethodReturnsDescription
Client.getTextureProviderTextureProviderThe client's textures: their brightness, the textures themselves and their pixels (TextureProvider).

Method details

getBrightness

getBrightness: (TextureProvider) -> number

The brightness the client makes its textures at: lower is brighter, 0.9, 0.8, 0.7 and 0.6 for the game's four brightness steps (the client's own "Brightness" setting, 0..100, as the client applies it, 1 - v / 200, v + 10 while the client raises it, so a value between the steps reads proportionally), or what setBrightness last set. Raises on a client whose table does not place its settings, and before the client has its preferences.

getTextures

getTextures: (TextureProvider) -> { n: number, [number]: Texture? }

The client's textures, by id: texture id is at textures[id + 1], nil where the client has no texture at that id, and n holds the length (for i = 1, textures.n do). Raises before the client has made its textures (its loader makes them once, at start-up).

setBrightness

setBrightness: (TextureProvider, number) -> ()

Make the client's textures at brightness from now on (lower is brighter): the client's own setter, which drops every texture's pixels, so load makes them again at it and getBrightness answers it. The scene on screen is drawn from the renderer's own copy of the textures, which the client makes again only when its brightness option changes, so this changes what load and getBrightness answer and the pixels the client's next upload takes, not the scene now; the game's option sets its own brightness back when the player changes it; and inside a frame's draw (an overlay's render, a BeforeRender subscriber) it applies at the top of the next client cycle. Game thread only; raises before the client has made its textures.

load

load: (TextureProvider, number) -> {number}?

Texture id's pixels at the provider's brightness: size * size ARGB colours (128 x 128), made as the client makes them (it keeps 20 textures' pixels and drops the least recently used, and marks the texture used), or nil for no texture at id or one whose sprite the client has not got yet. A copy: writing it changes nothing in the client. Game thread only; raises for an id outside getTextures() and before the client has made its textures.

equals

equals: (TextureProvider, any) -> boolean

Whether other equals this TextureProvider, as == answers it (false for a value of another class).