GearLoader 1.1.0
Mod loader for GGXXACPR
Loading...
Searching...
No Matches
BaseMod::NativeFunctionsApi Class Reference
Inheritance diagram for BaseMod::NativeFunctionsApi:
BaseMod::ApiWrapper< BaseMod_NativeFunctionsApi >

Public Member Functions

void RenderCockpitFontText (std::string text, int32_t x, int32_t y, float z, uint8_t alpha, float size)
 Draws text to the screen during battle using the game's text glyph system.
void RenderMenuText (const char *text, int32_t x, int32_t y, float z, float alpha, int32_t *animCounter, int32_t animSpeed, bool ignoreSpriteMask, uint32_t color)
 Draws text to the screen such as the text seen in pause menus.
void RenderMenuTextCenterAligned (const char *text, int32_t x, int32_t y, float z, float alpha, uint32_t color, bool ignoreSpriteMask)
 Draws centered aligned text to the screen.
void RenderPopUpText (int32_t playerIndex, std::string text)
 A higher level text rendering function that triggers a text popup animation in-game (e.g. COUNTER HIT / RECOVERY).
bool PlayCommonSoundEffect (uint32_t id)
 Plays a sound effect.
void DrawSprite (GGXXACPR_DrawSpriteParams *params, bool ignoreSpriteMask)
 Draws a sprite to the screen.
void DrawArrowSprite (DrawArrowSpriteDirection direction, int32_t x, int32_t y, int32_t z, uint32_t alpha)
 DrawSprite wrapper function that draws an arrow sprite.
void DrawTriStrip (ggxxacpr::ColorVertex *vertices, uint32_t numVertices)
 Draws a triangle strip primitive.
void DrawQuad (int32_t left, int32_t top, int32_t right, int32_t bottom, int32_t z, uint32_t color)
 Draws a quad to the screen.
void RegisterSprites (uint32_t spriteId, void *textureDataArray, uint32_t count)
 Registers sprite data to a spriteId to later be rendered with BaseMod_NativeFunctionsApi::DrawSprite.
uint32_t GetActiveCommandGrabId (ggxxacpr::Player player)
 If the given player currently has an active command grab, returns its command grab id, else return 0.
Public Member Functions inherited from BaseMod::ApiWrapper< BaseMod_NativeFunctionsApi >
bool VersionError ()
bool IsValid ()
const BaseMod_NativeFunctionsApiGetCApi ()

Additional Inherited Members

Protected Attributes inherited from BaseMod::ApiWrapper< BaseMod_NativeFunctionsApi >
const BaseMod_NativeFunctionsApi_ref

Member Function Documentation

◆ DrawArrowSprite()

void BaseMod::NativeFunctionsApi::DrawArrowSprite ( DrawArrowSpriteDirection direction,
int32_t x,
int32_t y,
int32_t z,
uint32_t alpha )
inline

DrawSprite wrapper function that draws an arrow sprite.

Parameters
directionFlagsee enum BM_DrawArrowSpriteDirection
xInternal resolution screen-space coordinate (640x480). Left edge is 0, right is 640.
yInternal resolution screen-space coordinate (640x480). Top edge is 0, bottom is 480.
zThe draw order/depth buffer value. Lower values draw later / appear in front of other text and sprites.
alphaTransparency value from 1 to 255, 1 being fully opaque.
190 {
191 _ref->DrawArrowSprite(static_cast<uint32_t>(direction), x, y, z, alpha);
192 }

◆ DrawQuad()

void BaseMod::NativeFunctionsApi::DrawQuad ( int32_t left,
int32_t top,
int32_t right,
int32_t bottom,
int32_t z,
uint32_t color )
inline

Draws a quad to the screen.

A simple helper function that calls constructs four vertices from the given parameters and passes them to DrawTriStrip. The edges of the quad are given in internal resolution screen space coordinates. The top left pixel is (0, 0) and the bottom right pixel is (640, 480).

Parameters
leftedge position
topedge position
rightedge position
bottomedge position
zThe Z coordinate for each vertex
colorARGB color value (i.e. D3DCOLOR)
222 {
223 _ref->DrawQuad(left, top, right, bottom, z, color);
224 }

◆ DrawSprite()

void BaseMod::NativeFunctionsApi::DrawSprite ( GGXXACPR_DrawSpriteParams * params,
bool ignoreSpriteMask )
inline

Draws a sprite to the screen.

See GGXXACPR_DrawSpriteParams

Parameters
paramsCombined parameter struct
ignoreSpriteMaskA 4-byte boolean value. If a non-zero value is passed, ignores color and alpha params.
177 {
178 _ref->DrawSprite(params, ignoreSpriteMask ? 1 : 0);
179 }

◆ DrawTriStrip()

void BaseMod::NativeFunctionsApi::DrawTriStrip ( ggxxacpr::ColorVertex * vertices,
uint32_t numVertices )
inline

Draws a triangle strip primitive.

The coordinates of the vertices are given in internal resolution screen space coordinates. The top left pixel is (0, 0) and the bottom right pixel is (640, 480).

Parameters
verticesThe vertices making up the triangle strip.
numVerticesThe number of vertices.
203 {
204 _ref->DrawTriStrip(vertices, numVertices);
205 }

◆ GetActiveCommandGrabId()

uint32_t BaseMod::NativeFunctionsApi::GetActiveCommandGrabId ( ggxxacpr::Player player)
inline

If the given player currently has an active command grab, returns its command grab id, else return 0.

250 {
251 return _ref->GetActiveCommandGrabId(player.getRaw());
252 }
GGXXACPR_Entity * getRaw()
Returns the underlying GGXXACPR_Entity struct pointer.
Definition ggxxacpr.hpp:681

◆ PlayCommonSoundEffect()

bool BaseMod::NativeFunctionsApi::PlayCommonSoundEffect ( uint32_t id)
inline

Plays a sound effect.

An internal array is indexed with the id parameter without validity checks. Invalid values can cause invalid memory access.

Parameters
idThe given id maps to the "COMMON SE" sound effect in the Sound menu. See github.com/youknow232/gearloader/tree/main/docs/SoundEffectIdMap.txt for the id mappings.
Returns
true if id param is zero
164 {
165 return _ref->PlayCommonSoundEffect(id);
166 }

◆ RegisterSprites()

void BaseMod::NativeFunctionsApi::RegisterSprites ( uint32_t spriteId,
void * textureDataArray,
uint32_t count )
inline

Registers sprite data to a spriteId to later be rendered with BaseMod_NativeFunctionsApi::DrawSprite.

When registering multiple sprites, each sprite will be sequentially registered with spriteIds starting with the given spriteId parameter. Example: Registering 4 sprites at spriteId 100 registers ids 100,101,102,103.

See tutorial on registering and using custom sprites for more information.

Parameters
spriteIdThe slot sprite data will be loaded into
textureDataArrayThe raw sprite data.
countThe number of sprites to register. If 0, sprites will be registered until a null pointer is found in the given array.
Returns
The number of sprites registered
242 {
243 _ref->RegisterSprites(spriteId, textureDataArray, count);
244 }

◆ RenderCockpitFontText()

void BaseMod::NativeFunctionsApi::RenderCockpitFontText ( std::string text,
int32_t x,
int32_t y,
float z,
uint8_t alpha,
float size )
inline

Draws text to the screen during battle using the game's text glyph system.

This function must be called before the game begins its drawing process. It is recommend to call this function in the AfterGameUpdate hook.

Example input/output. Font type depends on game setting.
Parameters
textA pointer to the text string to be displayed. The string format is a subset of ASCII. The character set is limited to upper case letters, numbers, and the following special symbols: "-+.!?/():&" The following characters map to additional special characters: ",~acegiwxyz" maps to "•±on•utabyx". '>' = END character from the highscore initials screen. "bdfh" = down/left/right/up arrows
xInternal resolution screen-space coordinate (640x480). Left edge is 0, right is 640.
yInternal resolution screen-space coordinate (640x480). Top edge is 0, bottom is 480.
zThe draw order/depth buffer value. Lower values draw later / appear in front of other text and sprites.
alphaTransparency value [0-255].
sizeScaling value, standard size is 1.0f which results in a text glyph of size 12x15px (internal resolution).
96 {
97 _ref->RenderCockpitFontText(text.c_str(), x, y, z, alpha, size);
98 }

◆ RenderMenuText()

void BaseMod::NativeFunctionsApi::RenderMenuText ( const char * text,
int32_t x,
int32_t y,
float z,
float alpha,
int32_t * animCounter,
int32_t animSpeed,
bool ignoreSpriteMask,
uint32_t color )
inline

Draws text to the screen such as the text seen in pause menus.

This function must be called before the game begins its drawing process. It is recommend to call this function in the AfterGameUpdate hook. Max string size is 512 characters. This function can handle '
' characters.

Parameters
textA pointer to the text string to be displayed.
xInternal resolution screen-space coordinate (640x480). Left edge is 0, right is 640.
yInternal resolution screen-space coordinate (640x480). Top edge is 0, bottom is 480.
zThe draw order/depth buffer value. Lower values draw later / appear in front of other text and sprites.
alphaTransparency value from 0 to 1, 1 being fully opaque.
animCounterOptional pointer to an animation counter. If defined, the text will perform a 'typewriter' animation drawing an additional letter at a time until fully rendered. One letter will be rendered per 128 units on this counter. When the animation is complete, this value will be set to -1 and will no longer increment.
animSpeedThe amount to increment the animCounter if it is defined. Set to 128 for 1 letter per frame.
ignoreSpriteMaskIf true, ignores color and alpha params and draws as fully opaque white text.
colorThe color of the text string (0xRRGGBB)
121 {
122 _ref->RenderMenuText(text, x, y, z, alpha, animCounter, animSpeed, ignoreSpriteMask, color);
123 }

◆ RenderMenuTextCenterAligned()

void BaseMod::NativeFunctionsApi::RenderMenuTextCenterAligned ( const char * text,
int32_t x,
int32_t y,
float z,
float alpha,
uint32_t color,
bool ignoreSpriteMask )
inline

Draws centered aligned text to the screen.

A wrapper of RenderMenuText that draws the text centered around the x parameter. y position is unchanged. This function handles multi-line strings but centers based on the longest line only (i.e. each line is NOT individually centered).

Parameters
textA pointer to the text string to be displayed.
xInternal resolution screen-space coordinate (640x480). Left edge is 0, right is 640.
yInternal resolution screen-space coordinate (640x480). Top edge is 0, bottom is 480.
zThe draw order/depth buffer value. Lower values draw later / appear in front of other text and sprites.
alphaTransparency value from 0 to 1, 1 being fully opaque.
colorThe color of the text string (0xRRGGBB)
ignoreSpriteMaskIf true, ignores color and alpha params and draws as fully opaque white text.
141 {
142 _ref->RenderMenuTextCenterAligned(text, x, y, z, alpha, color, ignoreSpriteMask);
143 }

◆ RenderPopUpText()

void BaseMod::NativeFunctionsApi::RenderPopUpText ( int32_t playerIndex,
std::string text )
inline

A higher level text rendering function that triggers a text popup animation in-game (e.g. COUNTER HIT / RECOVERY).

Parameters
playerIndexWhich side of the screen to display the pop up.
textThe text to be displayed. See RenderCockpitFontText for format and available characters.
150 {
151 _ref->RenderPopUpText(playerIndex, text.c_str());
152 }

The documentation for this class was generated from the following file: