https://github.com/gameanalytics/gameanalytics-sdk-cpp
Repository for the new C++ SDK refactor
https://github.com/gameanalytics/gameanalytics-sdk-cpp
Last synced: 10 months ago
JSON representation
Repository for the new C++ SDK refactor
- Host: GitHub
- URL: https://github.com/gameanalytics/gameanalytics-sdk-cpp
- Owner: GameAnalytics
- License: mit
- Created: 2024-08-05T12:05:37.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-24T08:10:34.000Z (10 months ago)
- Last Synced: 2025-06-24T08:33:10.467Z (10 months ago)
- Language: C
- Size: 23.9 MB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
GA-SDK-CPP
==========
GameAnalytics C++ SDK
Documentation can be found [here](https://gameanalytics.com/docs/cpp-sdk).
Supported platforms:
* Mac OSX
* Windows 32-bit and 64-bit
* Linux
Dependencies
------------
* python 3.6 or higher
* cmake 3.20 or higher
* **Mac:** XCode
* **Windows:** Visual Studio 2017 or later
* **Linux:** clang or gcc
Changelog
------------
See the full [CHANGELOG](./CHANGELOG) for detailed version history.
How to build
------------
Run `setup.py` with the required argument for your platform:
```sh
python setup.py --platform {linux_x64,linux_x86,osx,win32,win64,uwp} [--cfg {Release,Debug}] [--build] [--test] [--coverage]
```
The following arguments are supported:
* `linux_x64`
* `linux_x86`
* `osx`
* `win32`
* `win64`
The generated project can be found inside the `build` folder.
Lib Dependencies
----------------
* **crossguid** (*as source*) - Cross platform library to generate a Guid.
* **cryptoC++** (*as source*) - collection of functions and classes for cryptography related tasks.
* **curl** (*as binary*) - library used to make HTTP requests.
* **nlohmann json** (*as source*) - lightweight C++ library for manipulating JSON values including serialization and deserialization.
* **openssl** (*as binary*) - used by **curl** to make HTTPS requests.
* **SQLite** (*as source*) - SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.
*as source* means the dependency will be compiled with the project itself, *as binary* means the dependency is prebuild and will be linked to the project
Usage of the SDK
----------------
Remember to include the GameAnalytics header file wherever you are using the SDK:
``` c++
#include "GameAnalytics/GameAnalytics.h"
```
### Custom log handler
If you want to use your own custom log handler here is how it is done:
``` c++
void logHandler(const char *message, gameanalytics::EGALoggerMessageType type)
{
// add your logging in here
}
gameanalytics::GameAnalytics::configureCustomLogHandler(logHandler);
```
### Configuration
Example:
``` c++
gameanalytics::GameAnalytics::setEnabledInfoLog(true);
gameanalytics::GameAnalytics::setEnabledVerboseLog(true);
gameanalytics::GameAnalytics::configureBuild("0.10");
{
std::vector list;
list.push_back("gems");
list.push_back("gold");
gameanalytics::GameAnalytics::configureAvailableResourceCurrencies(list);
}
{
std::vector list;
list.push_back("boost");
list.push_back("lives");
gameanalytics::GameAnalytics::configureAvailableResourceItemTypes(list);
}
{
std::vector list;
list.push_back("ninja");
list.push_back("samurai");
gameanalytics::GameAnalytics::configureAvailableCustomDimensions01(list);
}
{
std::vector list;
list.push_back("whale");
list.push_back("dolphin");
gameanalytics::GameAnalytics::configureAvailableCustomDimensions02(list);
}
{
std::vector list;
list.push_back("horde");
list.push_back("alliance");
gameanalytics::GameAnalytics::configureAvailableCustomDimensions03(list);
}
```
### Initialization
Example:
``` c++
gameanalytics::GameAnalytics::initialize("", "