Skip to content

CallNativeFunction

Description

Sends a callback to the engine to run a native function. There are three versions of the function that can be used depending on the amount of parameters needed for the callback:

  • CallNativeFunction (no parameters)
  • CallNativeFunction2 (two parameters)
  • CallNativeFunction4 (four parameters)

In order to call a native function by name, a global variable named after the function must be added to the GameConfig. Once added, the engine will automatically set the value of the global variable to the ID of the native function.

Parameters

callback

The index value of the callback.

param1, param2, param3, param4

Parameters to use for the callback.

Return Value

Depends on the callback used.

Syntax

CallNativeFunction(int callback)
CallNativeFunction2(int callback, param1, param2)
CallNativeFunction4(int callback, param1, param2, param3, param4)

Examples

CallNativeFunction(Disconnect2PVS)
CallNativeFunction2(TransmitGlobal, "vs.randomValue", vs.randomValue)
CallNativeFunction4(NotifyCallback, NOTIFY_STATS_ENEMY, StageStatsUsabilityParam1, StageStatsUsabilityParam2, StageStatsUsabilityParam3)

Native Functions

General

Function Description
SetAchievement Sets the status of the given achievement.
SetLeaderboard Submits the given score to the given leaderboard.
HapticEffect Queues/Plays a haptic effect, if the engine build and device support it.
Connect2PVS Opens the menu for connecting to an opponent for 2P VS.
Disconnect2PVS Disconnects from a 2P VS game.
SendEntity Sends the data for an object to the opponent in 2P VS.
SendValue Sends a value to the opponent in 2P VS.
ReceiveEntity Recieves an object sent from the opponent in 2P VS.
ReceiveValue Sets a variable to a value sent from the opponent in 2P VS.
TransmitGlobal Sets a global variable for the opponent in 2P VS.
ShowPromoPopup Shows a promo popup.
NativePlayerWaitingAds Creates a RewardAds native object, prompting the player to watch an ad.
NativeWaterPlayerWaitingAds Creates a RewardAds native object, prompting the player to watch an ad.
NotifyCallback Sends the given callback to communicate to Hedgehog Engine 2.

Decomp Only

Function Description
SetNetworkGameName Sets the name of the game to find 2P VS opponents for.
ExitGame Closes the engine.
FileExists Checks if a file exists in the assets.
OpenModMenu Opens the Mods List.
AddAchievement Adds an achievement to the backend with the given name.
SetAchievementDescription Sets the description for an achievement.
ClearAchievements Removes all achievements from the backend.
GetAchievementCount Gets the number of achievements in the backend.
GetAchievement Gets the status of an achievement.
GetAchievementName Adds a text entry to menu with an achievement's name as the text.
GetAchievementDescription Adds a text entry to menu with an achievement's description as the text.
GetScreenWidth Gets the screen width.
SetScreenWidth Sets the screen width.
GetWindowScale Gets the window scale.
SetWindowScale Sets the window scale.
GetWindowScaleMode Gets the window scale mode.
SetWindowScaleMode Sets the window scale mode.
GetWindowFullScreen Gets if fullscreen is enabled.
SetWindowFullScreen Sets if fullscreen is enabled.
GetWindowBorderless Gets if the window is borderless.
SetWindowBorderless Sets if the window is borderless.
GetWindowVSync Gets if VSync is enabled.
SetWindowVSync Sets if VSync is enabled.
ApplyWindowChanges Applies any window changes.
GetModCount Gets the number of mods in the mods list.
GetModName Adds a text entry to menu with a mod's name as the text.
GetModDescription Adds a text entry to menu with a mod's description as the text.
GetModAuthor Adds a text entry to menu with a mod's author as the text.
GetModVersion Adds a text entry to menu with a mod's version as the text.
GetModActive Gets if a mod is enabled.
SetModActive Sets if a mod is enabled.
MoveMod Shifts a mod up or down in the mods list.
RefreshEngine Reloads the engine, the game, and all mods.