Skip to content

Commit b4d0d0b

Browse files
authored
Merge pull request #34 from GameAnalytics/v3.0.0
[WIP] Major Release v3.0.0
2 parents eb0670c + 1d01fa5 commit b4d0d0b

File tree

221 files changed

+22906
-3900
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+22906
-3900
lines changed

.gitignore

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
*.d
77
*.apk
88
*.bc
9+
/.vscode
910

1011
/builds
1112
.project
1213
.settings
1314

1415
# Godot 4+ specific ignores
1516
.godot/
17+
*.dblite
1618

1719
# Godot-specific ignores
1820
.import/
@@ -25,4 +27,40 @@ export_presets.cfg
2527
# Mono-specific ignores
2628
.mono/
2729
data_*/
28-
mono_crash.*.json
30+
mono_crash.*.json
31+
32+
# android
33+
# Gradle files
34+
.gradle/
35+
build/
36+
37+
# Local configuration file (sdk path, etc)
38+
local.properties
39+
40+
# Log/OS Files
41+
*.log
42+
43+
# Android Studio generated files and folders
44+
captures/
45+
.externalNativeBuild/
46+
.cxx/
47+
*.aab
48+
*.apk
49+
output-metadata.json
50+
51+
# IntelliJ
52+
*.iml
53+
.idea/
54+
misc.xml
55+
deploymentTargetDropDown.xml
56+
render.experimental.xml
57+
58+
# Keystore files
59+
*.jks
60+
*.keystore
61+
62+
# Google Services (e.g. APIs or Firebase)
63+
google-services.json
64+
65+
# Android Profiling
66+
*.hprof

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "godot-cpp"]
2+
path = godot-cpp
3+
url = https://github.com/godotengine/godot-cpp/
4+
branch = 4.5

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 GameAnalytics
3+
Copyright (c) 2026 GameAnalytics
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 72 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,85 @@
11
# GA-SDK-GODOT
22
GameAnalytics SDK for Godot.
33

4-
For Android, iOS and OSX you can also get the SDK via Nativelib like described [here](https://github.com/GameAnalytics/godot-gameanalytics).
5-
64
Documentation is located [here](https://gameanalytics.com/docs/item/godot-sdk).
75

86
If you have any issues or feedback regarding the SDK, please contact our friendly support team [here](https://gameanalytics.com/contact).
97

10-
> :information_source:
11-
>
12-
> The Godot SDK include support for **iOS**, **Android**, **Web**, **Windows**, **Mac** and **Linux** platforms
13-
>
14-
> Requirements:
15-
> * **Godot:** 4.0+  
8+
## Supported Platforms
9+
10+
- Windows
11+
- MacOS
12+
- Linux
13+
- Android
14+
- iOS
15+
- Web
16+
17+
## Requirements
18+
19+
- Godot 4.5 or newer
20+
- SCons
21+
- Python 3.6 or newer
22+
23+
## Compilation
24+
25+
Run the following command in the trunk of the cloned repository with the desired platform and configuration:
26+
27+
```sh
28+
python ./build.py [platform] [debug or release]
29+
```
30+
31+
Afterwards, you can open the `example/project.godot` project. The resulting `.gdextension` can be found in `example/addons/GameAnalytics`.
32+
33+
## Usage
34+
35+
After building the gdextension for your platform, you can copy the `example/addons/GameAnalytics` folder to your own project `your_project/addons/GameAnalytics`.
36+
37+
Inisde `Project Settings -> Plugins` enable the `GameAnalytics` plugin.
1638

17-
Changelog
39+
### Windows, Linux and MacOS
40+
41+
No additional steps are necessary, the plugin can also be used directly from within the editor.
42+
43+
### iOS
44+
45+
Export the project for iOS.
46+
47+
### Android
48+
49+
In the `Project` menu run `Install Android Build Template...`. Afterwards you will be able to export the plugin to Android.
50+
51+
### Web
52+
53+
In the `Export` dialog, add the following line in `HTML -> Head Include`:
54+
55+
```js
56+
<script src="GameAnalytics.js"></script>
57+
```
58+
59+
<br/>
60+
61+
## Changelog
1862
---------
1963
<!--(CHANGELOG_TOP)-->
64+
**3.0.0**
65+
* support for Godot 4.5
66+
* migrate plugin to .gdextension
67+
* add Health Event functionality for Desktop (Windows, Linux, MacOS), Android and iOS platforms
68+
* add support for Remote Configurations v2 with json support
69+
* add functionality to set/retrieve external user id (getExternalUserId, setExternalUserid)
70+
* add missing A/B test functions: getABTestingId, getABTestingVariantId
71+
* add possibility to set a custom writable path for Desktop platforms
72+
* add playtime tracking support
73+
* add option to enable/disable randomized user id on platform that support it
74+
* update GameAnalytics dependencies for Desktop (v5.1.0), iOS (v5.0.0) and Android (v7.0.1)
75+
* add mandatory arguments for addEvent functions, keep dictionary argument for optional values
76+
* expose all functions to gdscript
77+
* use GAWrapper to handle different platforms (keep it in line with GameAnalytics Unreal SDK)
78+
* rewritten the whole Android plugin implementation
79+
* remove requirement to manually call onQuit
80+
* update dependency management
81+
* various bug fixes
82+
2083
**2.4.0**
2184
* support for godot 4.0+
2285

SConstruct

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
from glob import glob
5+
6+
env = SConscript("godot-cpp/SConstruct")
7+
8+
sources = Glob("src/gameanalytics/*.cpp")
9+
10+
platform_path = 'src'
11+
libname = ''
12+
13+
target = 'debug'
14+
15+
if env['target'] == 'template_release':
16+
target = 'release'
17+
18+
binpath = 'bin/{}/{}'.format(env['platform'], target)
19+
libpath = "src/libs"
20+
21+
################################
22+
23+
# iphone
24+
if env['platform'] == 'ios':
25+
sources.append("src/ios/GAWrapperIOS.mm")
26+
platform_path = os.path.join(platform_path, 'ios')
27+
28+
framework_path = "src/libs/iOS/GameAnalytics.xcframework/ios-arm64"
29+
framework_headers = os.path.join(framework_path, "GameAnalytics.framework", "Headers")
30+
env.Append(CCFLAGS=["-I{}".format(framework_headers)])
31+
env.Append(LINKFLAGS=[
32+
"-ObjC",
33+
"-framework", "AdSupport",
34+
"-framework", "SystemConfiguration",
35+
"-framework", "AppTrackingTransparency",
36+
"-framework", "GameAnalytics",
37+
"-l", "sqlite3",
38+
"-l", "z"
39+
])
40+
41+
# android
42+
if env['platform'] == 'android':
43+
sources.append("src/android/GAWrapperAndroid.cpp")
44+
libname = '{}/libGodotGameAnalytics{}'.format(binpath, env["SHLIBSUFFIX"])
45+
platform_path = os.path.join(platform_path, 'android')
46+
env.Append(LINKFLAGS=["-llog"])
47+
48+
# desktop
49+
if env["platform"] == "windows" or env["platform"] == "macos" or env["platform"] == "osx" or env["platform"] == "linux":
50+
sources.append("src/desktop/GAWrapperCpp.cpp")
51+
libname = '{}/libGodotGameAnalytics{}'.format(binpath, env["SHLIBSUFFIX"])
52+
platform_path = os.path.join(platform_path, 'desktop')
53+
54+
env.Append(LIBS=["GameAnalytics", "curl", "ssl"])
55+
56+
libpath = os.path.join(libpath, env['platform'])
57+
58+
if(env["platform"] == "windows"):
59+
env.Append(LIBS=[
60+
"user32",
61+
"kernel32",
62+
"advapi32",
63+
"ws2_32",
64+
"bcrypt",
65+
"crypt32",
66+
"secur32",
67+
"shell32",
68+
"Ole32",
69+
"eay32",
70+
"ssleay32"
71+
])
72+
73+
if(env['platform'] == 'linux'):
74+
env.Append(LIBS=["crypto"])
75+
76+
if(env["platform"] == "macos"):
77+
env.Append(LINKFLAGS=[
78+
"-framework", "CoreFoundation",
79+
"-framework", "Foundation",
80+
"-framework", "CoreServices",
81+
"-framework", "SystemConfiguration",
82+
"-framework", "Metal",
83+
"-framework", "MetalKit"
84+
])
85+
env.Append(LIBS=["crypto"])
86+
87+
# web
88+
if env["platform"] == "web":
89+
sources.append("src/web/GAWrapperWeb.cpp")
90+
libname = '{}/libGodotGameAnalytics{}'.format(binpath, env["SHLIBSUFFIX"])
91+
platform_path = os.path.join(platform_path, 'web')
92+
93+
#################################
94+
95+
env.Append(CPPPATH=["src/gameanalytics",
96+
platform_path,
97+
'godot-cpp/godot_headers/',
98+
'godot-cpp/include/',
99+
'godot-cpp/include/core/',
100+
'godot-cpp/include/gen/'])
101+
102+
env.Append(LIBPATH=[libpath, os.path.join(libpath, '3rdParty')])
103+
104+
if env['platform'] == 'ios':
105+
library = env.StaticLibrary(
106+
"lib/libgameanalytics.{}.{}.a".format(
107+
env["platform"], env["target"]),
108+
source=sources,
109+
)
110+
else:
111+
library = env.SharedLibrary(
112+
libname,
113+
source=sources,
114+
)
115+
116+
Default(library)

android/.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

android_godot_3_2/godotgameanalytics/.gitignore renamed to android/app/.gitignore

File renamed without changes.

android/app/build.gradle

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
plugins {
2+
alias(libs.plugins.android.application)
3+
}
4+
5+
android {
6+
namespace 'com.gameanalytics.godotapp'
7+
compileSdk 34
8+
9+
defaultConfig {
10+
applicationId "com.gameanalytics.godotapp"
11+
minSdk 24
12+
targetSdk 34
13+
versionCode 1
14+
versionName "1.0"
15+
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17+
}
18+
19+
buildTypes {
20+
21+
debug {
22+
minifyEnabled false
23+
debuggable true
24+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
25+
}
26+
27+
release {
28+
minifyEnabled false
29+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
30+
}
31+
}
32+
compileOptions {
33+
sourceCompatibility JavaVersion.VERSION_1_8
34+
targetCompatibility JavaVersion.VERSION_1_8
35+
}
36+
}
37+
38+
dependencies {
39+
40+
implementation libs.appcompat
41+
implementation libs.material
42+
testImplementation libs.junit
43+
androidTestImplementation libs.ext.junit
44+
androidTestImplementation libs.espresso.core
45+
}

android_godot_3_2/godotgameanalytics/proguard-rules.pro renamed to android/app/proguard-rules.pro

File renamed without changes.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.gameanalytics.godotapp;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.platform.app.InstrumentationRegistry;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24+
assertEquals("com.gameanalytics.godotapp", appContext.getPackageName());
25+
}
26+
}

0 commit comments

Comments
 (0)