Skip to content
This repository was archived by the owner on Sep 21, 2022. It is now read-only.

Getting Started

Ahmed Castro edited this page Sep 12, 2017 · 38 revisions

This page explains how to link, include and initialize the SDK.

Before starting this guide, download the ModworksSDK, it provides all the files needed to integrate Modworks into your game or modding tool. MinGW and Visual C++ are supported for Windows and GCC for Linux.

Step 1: Linking the Libraries

Windows Visual C++

Link the provided import library modworks.lib and place all the provided DLL files next to your executable. The import library is located at /lib/visualc++ and the DLLs at /bin/visualc++.

Windows MinGW

Link the provided import library modworks.a and place all the provided DLL files next to your executable. The import library is located at /lib/mingw and the DLLs at /bin/mingw.

Note: Modworks is compiled using C++11 so you will need to add the -std=c++11 compiler flag.

Linux GCC

ModworksSDK uses LibCurl, Zlib, Minizip and Pthread. Usually, they are already present on your Linux distribution. If it's not the case, install them using your package manager:

apt-get install libcurl4-openssl-dev zlib1g-dev libpthread-stubs0-dev

Link the the provided shared library libmodworks.so provided by the SDK located in the /lib/linux directory.

Note: Modworks is built using C++11 so you will need to add the -std=c++11 compiler flag.

Step 2: Including the Headers

Add the provided /include/ directory to your include path.

Step 3: Initializing ModworksSDK

That's it! You should be able to use the ModworksSDK on your project.

#include <ModworksSDK.h>
int main()
{
  modworks::init(/*your game id*/7, "YOUR-API-KEY");
  return 0;
}

Compliation Examples

The following are complete Makefile examples that shows how to implement.

Visual C++

#Makefile
#run with the 'nmake' command

CC = cl.exe
CFLAGS = /EHsc /MD
SOURCES = Example.cpp
LIBRARIES = ../src/modworks.lib

build:
 $(CC) $(CFLAGS) $(SOURCES) /I ../include /link $(LIBRARIES) /SUBSYSTEM:CONSOLE

MinGW

#Makefile
#run with the 'MinGW32-make.exe' command

CC=g++
CFLAGS=-c -Wall -std=c++11
SOURCES=Example.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=Example
LIBRARIES=../src/modworks.a

all: $(SOURCES) $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS)
	$(CC) $(OBJECTS) $(LIBRARIES) -o $@

.cpp.o:
	$(CC) $(CFLAGS) $< -o $@ -I ../include

GCC

#Makefile
#run with the 'make' command

CC=g++
CFLAGS=-c -Wall -std=c++11
LDFLAGS=-lcurl -pthread -lz
SOURCES=Example.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=Example
LIBRARIES=../src/libmodworks.so

all: $(SOURCES) $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS)
	$(CC) $(LDFLAGS) $(OBJECTS) $(LIBRARIES) -o $@

.cpp.o:
	$(CC) $(CFLAGS) $< -o $@ -I ../include

Contents

Clone this wiki locally