Jazz2::Scripting::Legacy::jjCANVAS struct

Drawing surface used by scripts to render onto the HUD.

Short-lived surface handed to draw callbacks, bound to a UI::HUD and a view rectangle. Its methods draw pixels, rectangles, tiles, sprites (plain, resized, rotated, vine) and text into that frame's HUD layer. Mirrors the original JJ2+ jjCANVAS passed to onDraw* hooks.

Public static functions

static void jjDrawString(float xPixel, float yPixel, const String& text, const jjANIMATION& animation, std::uint32_t mode, std::uint8_t param, std::int8_t layerZ, std::uint8_t layerXY, std::int8_t playerID)
Draws text directly into the level using the given animation as a font.
static void jjDrawStringEx(float xPixel, float yPixel, const String& text, const jjANIMATION& animation, const jjTEXTAPPEARANCE& appearance, std::uint8_t param1, std::uint32_t spriteMode, std::uint8_t param2, std::int8_t layerZ, std::uint8_t layerXY, std::int8_t playerID)
Draws text with a custom appearance directly into the level using the given animation as a font.
static auto jjGetStringWidth(const String& text, const jjANIMATION& animation, const jjTEXTAPPEARANCE& style) -> int
Returns the rendered width of the text in pixels.

Constructors, destructors, conversion operators

jjCANVAS(UI::HUD* hud, const Rectf& view)
Creates a new instance bound to the given HUD and view.

Public functions

void DrawPixel(std::int32_t xPixel, std::int32_t yPixel, std::uint8_t color, std::uint32_t mode, std::uint8_t param)
Draws a single colored pixel.
void DrawRectangle(std::int32_t xPixel, std::int32_t yPixel, std::int32_t width, std::int32_t height, std::uint8_t color, std::uint32_t mode, std::uint8_t param)
Draws a filled colored rectangle.
void DrawSprite(std::int32_t xPixel, std::int32_t yPixel, std::int32_t setID, std::uint8_t animation, std::uint8_t frame, int8_t direction, std::uint32_t mode, std::uint8_t param)
Draws a sprite frame from an animation set.
void DrawCurFrameSprite(std::int32_t xPixel, std::int32_t yPixel, std::uint32_t sprite, int8_t direction, std::uint32_t mode, std::uint8_t param)
Draws the current frame of the given sprite.
void DrawResizedSprite(std::int32_t xPixel, std::int32_t yPixel, std::int32_t setID, std::uint8_t animation, std::uint8_t frame, float xScale, float yScale, std::uint32_t mode, std::uint8_t param)
Draws a sprite frame scaled by the given factors.
void DrawResizedCurFrameSprite(std::int32_t xPixel, std::int32_t yPixel, std::uint32_t sprite, float xScale, float yScale, std::uint32_t mode, std::uint8_t param)
Draws the current frame of the given sprite scaled by the given factors.
void DrawTransformedSprite(std::int32_t xPixel, std::int32_t yPixel, std::int32_t setID, std::uint8_t animation, std::uint8_t frame, std::int32_t angle, float xScale, float yScale, std::uint32_t mode, std::uint8_t param)
Draws a sprite frame rotated and scaled.
void DrawTransformedCurFrameSprite(std::int32_t xPixel, std::int32_t yPixel, std::uint32_t sprite, std::int32_t angle, float xScale, float yScale, std::uint32_t mode, std::uint8_t param)
Draws the current frame of the given sprite rotated and scaled.
void DrawSwingingVine(std::int32_t xPixel, std::int32_t yPixel, std::uint32_t sprite, std::int32_t length, std::int32_t curvature, std::uint32_t mode, std::uint8_t param)
Draws a swinging vine sprite.
void ExternalDrawTile(std::int32_t xPixel, std::int32_t yPixel, std::uint16_t tile, std::uint32_t tileQuadrant)
Draws a single tile from the tileset.
void DrawTextBasicSize(std::int32_t xPixel, std::int32_t yPixel, const String& text, std::uint32_t size, std::uint32_t mode, std::uint8_t param)
Draws text using the given built-in font size.
void DrawTextExtSize(std::int32_t xPixel, std::int32_t yPixel, const String& text, std::uint32_t size, const jjTEXTAPPEARANCE& appearance, std::uint8_t param1, std::uint32_t mode, std::uint8_t param)
Draws text with a custom appearance using the given built-in font size.
void drawString(std::int32_t xPixel, std::int32_t yPixel, const String& text, const jjANIMATION& animation, std::uint32_t mode, std::uint8_t param)
Draws text using the given animation as a font.
void drawStringEx(std::int32_t xPixel, std::int32_t yPixel, const String& text, const jjANIMATION& animation, const jjTEXTAPPEARANCE& appearance, std::uint8_t param1, std::uint32_t spriteMode, std::uint8_t param2)
Draws text with a custom appearance using the given animation as a font.

Public variables

UI::HUD* Hud
The HUD this canvas draws onto.
Rectf View
The visible view rectangle.