Skip to content

C# and C++ wrappers to develop Gamemaker DLL extensions easily

Notifications You must be signed in to change notification settings

zeokku/gamemaker-dll-extension-wrappers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Gamemaker DLL extension wrappers

C# and C++ wrappers to develop Gamemaker DLL extensions easily

Don't forget to define RegisterCallbacks(int, int, int, int) in your extension's functions in Gamemaker Studio.

C#

Just drop .cs file into project, then import namespace using Gamemaker.Internal;

Map can be edited with [] notation or via AddKeyValuePair() method. Brackets allow any value type (incl. other DsMaps), floating and integral (up to 32-bit) types will be stored as doubles, booleans will turn into 0/1, null will be empty string, other DsMaps will be stored as their ID number (double), everything else, the ToString() method will be called on, including 64-bit integers. So for complex object types it's handy to define ToString() method which results with a JSON representation which can be then parsed back in Gamemaker if needed.

DsMap.Dispatch has several overloads, so you can not only define callback type but also result type (default is _type_ key) as string or number, which can be useful for determining what kind of information is returned.

In the end use DLLExport to generate export signatures.

Example:

DsMap result = new DsMap((int)EAsyncSteamType.leaderboardDownload);

result["success"] = true;

DsMap entries = new DsMap();
result["entries"] = entries;

result.Dispatch(EGmsEventType.EVENT_ASYNC_STEAM);

C++

Add gamemaker.cpp and gamemaker.h to your project, then #include "gamemaker.h" in your project and using namespace gamemaker;

It's pretty similar to C# version but being a little outdated, so there's some inconsistency, so result types are defined in constructor and there're no brackets editing, only set() method

Example:

ds_map report("_result_", result_status);
report.set("value", (double)10);
bool dispatch_res = report.dispatch(gml_event_type::social);

About

C# and C++ wrappers to develop Gamemaker DLL extensions easily

Topics

Resources

Stars

Watchers

Forks