Skip to content

General API

For more specific examples on how to use the functions you can look through the Example Plugin

Functions:

Initialize


Call this when the TygerFramework Plugin Initialize export function gets called, and before you call any other API functions.

Syntax

API::Initialize(param);

Parameters

param

Type: TygerFrameworkPluginInitializeParam*

The initialization parameter that gets passed to the plugin through the TygerFramework Plugin Initialize export function.

IsInitialized


Only in v1.1.0 or newer ↓

Call this to check if the API is initialized.
Useful if you have a shutdown event and need to check if the API is initialized, to avoid a error occurring, incase the plugin unloaded early due to the wrong version of TygerFramework being installed

Syntax

API::IsInitialize();

Return Value

bool

Returns true if the API has been initialized.

CurrentTyGame


Gets the currently running Ty Game

Syntax

API::CurrentTyGame();

Return Value

int

Returns the current Ty game that is running.

  • 0: Couldn't detect which game
  • 1: Ty 1
  • 2: Ty 2
  • 3: Ty 3

LogPluginMessage


Logs a message to the log txt file and to the console.

Syntax

API::LogPluginMessage(message, logLevel);

Parameters

message

Type: std::string

The message to be logged.

logLevel

Type: LogLevel enum

Default Value: Info

The type of message your logging. Doesn't need to be set for info

Enum Values

  • Info
  • Warning
  • Error

GetPluginDirectory


Only in v1.1.0 or newer ↓

Gets the current plugin directory (is different between debug and release versions of TygerFramework. In debug versions its "Debug Plugins", in release versions its "Plugins")

Syntax

API::GetPluginDirectory();

Return Value

std::filesystem::path

Returns the current path to the plugin directory.

SetTyInputState


Only in v1.1.0 or newer ↓

Sets the entire input flags state for the game from this plugin.

Syntax

API::SetTyInputState(flags);

Parameters

flags

Type: TyInputFlags enum

To see all the flags that can be set look at the TyInputFlags section

Return Value

bool

Returns true if the flags are successfully set.

Usage Examples

//Sets the entire state to the NoMouseClickInput flag
API::SetTyInputState(NoMouseClickInput);

//Setting multiple flags
API::SetTyInputState(NoMouseInput | NoKeyboardInput | TyShowCursor);

Remarks

The state flags from all plugins get combined together in TygerFramework to decide the state of the game. This is to avoid one plugin disabling a flag that another plugin needs enabled

SetTyInputFlag


Only in v1.1.0 or newer ↓

Function to more easily set or unset a flag(s) in some cases

Syntax

API::SetTyInputFlag(flag, enableFlag);

Parameters

flags

Type: TyInputFlags enum

To see all the flags that can be set look at the TyInputFlags section

enableFlag

Type: bool

true to enable/set the flag,
false to disable/unset the flag

Return Value

bool

Returns true if successfully set the flags.

Usage Examples

//Just setting 1 flag to be enabled, 
//without changing the state of any of the other flags that may be set
API::SetTyInputFlag(NoMouseClickInput, true);

//Unsetting/setting multiple flags
API::SetTyInputFlag(NoMouseInput | NoKeyboardInput | TyShowCursor, false);

Remarks

The state flags from all plugins get combined together in TygerFramework to decide the state of the game. This is to avoid one plugin disabling a flag that another plugin needs enabled

GetTyInputState


Only in v1.1.0 or newer ↓

Get the current input state of the game set by your plugin

Syntax

API::GetTyInputState();

Return Value

TyInputFlags enum

Returns the currently set Ty Input Flags.

Usage Examples

//Get the current flags
TyInputFlags flags = API::GetTyInputState();

//Which can then be used for something like toggling a flag with a bitwise XOR
//Each time this is run it'll alternate between setting and unsetting the flag
API::SetTyInputFlag(flags ^ NoMouseInput);

//Can also be used to check if a specific flag(s) is set with the bitwise AND
if (flags & NoKeyboardInput){

}

Remarks

Keep in mind that this doesn't get the state of other plugins, so the game could be blocked by a different plugin, which this won't say.

The state flags from all plugins get combined together in TygerFramework to decide the state of the game. This is to avoid one plugin disabling a flag that another plugin needs enabled

Variables:

TyHModule


Can be used to get the base address of the game by casting it to a DWORD.

Syntax

API::Get()->param()->TyHModule;
API::Get()->param()->tygerFrameworkModule;

Type: HMODULE

initErrorMessage


Only to be used for when you would return false in the TygerFramework Plugin Initialize export function. More info on the Error Message section on the Getting Started page

Gives more info for what went wrong during initialization of your plugin.

Syntax

API::Get()->param()->initErrorMessage = "Write what went wrong here";
Type: std::string

TyInputsFlags


Only in v1.1.0 or newer ↓

Used in the SetTyInputState, SetTyInputFlag, and GetTyInputState functions

Type: enum

Enum Values

  • None //No flags set
  • NoMouseClickInput //Only mouse clicks disabled
  • NoMouseCameraInput //Only mouse camera movement disabled
  • NoKeyboardInput //Disables all keyboard input
  • TyShowCursor //Shows and unlocks the mouse cursor
  • NoMouseInput //Disables both mouse clicks and mouse camera movement