iOS Modules: separate main platform code from modules

Moved previously builtin modules 'GameCenter', 'AppStore', 'iCloud' to separate modules to be represented as plugin.
Modified 'ARKit' and 'Camera' to not be builtin into engine and work as plugin.
Changed platform code so it's not affected by the move.
Modified Xcode project file to remove parameters that doesn't make any effect.
Added basic '.gdip' plugin config file.
This commit is contained in:
Sergey Minakov 2020-08-13 18:24:39 +03:00
parent a329de566c
commit 614f701373
43 changed files with 586 additions and 201 deletions

View File

@ -146,81 +146,6 @@
DevelopmentTeam = $team_id;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.AccessWiFi = {
enabled = $access_wifi;
};
com.apple.ApplePay = {
enabled = 0;
};
com.apple.ApplicationGroups.iOS = {
enabled = 0;
};
com.apple.AutoFillCredentialProvider = {
enabled = 0;
};
com.apple.BackgroundModes = {
enabled = 0;
};
com.apple.ClassKit = {
enabled = 0;
};
com.apple.DataProtection = {
enabled = 0;
};
com.apple.GameCenter.iOS = {
enabled = $game_center;
};
com.apple.HealthKit = {
enabled = 0;
};
com.apple.HomeKit = {
enabled = 0;
};
com.apple.HotspotConfiguration = {
enabled = 0;
};
com.apple.InAppPurchase = {
enabled = $in_app_purchases;
};
com.apple.InterAppAudio = {
enabled = 0;
};
com.apple.Keychain = {
enabled = 0;
};
com.apple.Maps.iOS = {
enabled = 0;
};
com.apple.Multipath = {
enabled = 0;
};
com.apple.NearFieldCommunicationTagReading = {
enabled = 0;
};
com.apple.NetworkExtensions.iOS = {
enabled = 0;
};
com.apple.Push = {
enabled = $push_notifications;
};
com.apple.SafariKeychain = {
enabled = 0;
};
com.apple.Siri = {
enabled = 0;
};
com.apple.VPNLite = {
enabled = 0;
};
com.apple.WAC = {
enabled = 0;
};
com.apple.Wallet = {
enabled = 0;
};
com.apple.iCloud = {
enabled = 0;
};
};
};
};

18
modules/arkit/arkit.gdip Normal file
View File

@ -0,0 +1,18 @@
[config]
name="ARKit"
binary="arkit_lib.a"
initialization="register_arkit_types"
deinitialization="unregister_arkit_types"
[dependencies]
linked=[]
embedded=[]
system=["AVFoundation.framework", "ARKit.framework"]
capabilities=["arkit"]
files=[]
[plist]
NSCameraUsageDescription="Device camera is used for some functionality"

View File

@ -1,5 +1,5 @@
/*************************************************************************/
/* register_types.cpp */
/* arkit_module.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "register_types.h"
#include "arkit_module.h"
#include "arkit_interface.h"

View File

@ -1,5 +1,5 @@
/*************************************************************************/
/* register_types.h */
/* arkit_module.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */

View File

@ -5,17 +5,7 @@ Import("env_modules")
env_camera = env_modules.Clone()
if env["platform"] == "iphone":
# (iOS) Enable module support
env_camera.Append(CCFLAGS=["-fmodules", "-fcxx-modules"])
# (iOS) Build as separate static library
modules_sources = []
env_camera.add_source_files(modules_sources, "register_types.cpp")
env_camera.add_source_files(modules_sources, "camera_ios.mm")
mod_lib = env_modules.add_library("#bin/libgodot_camera_module" + env["LIBSUFFIX"], modules_sources)
elif env["platform"] == "windows":
if env["platform"] == "windows":
env_camera.add_source_files(env.modules_sources, "register_types.cpp")
env_camera.add_source_files(env.modules_sources, "camera_win.cpp")

View File

@ -1,5 +1,5 @@
def can_build(env, platform):
return platform == "iphone" or platform == "osx" or platform == "windows"
return platform == "osx" or platform == "windows"
def configure(env):

View File

@ -33,9 +33,6 @@
#if defined(WINDOWS_ENABLED)
#include "camera_win.h"
#endif
#if defined(IPHONE_ENABLED)
#include "camera_ios.h"
#endif
#if defined(OSX_ENABLED)
#include "camera_osx.h"
#endif
@ -44,9 +41,6 @@ void register_camera_types() {
#if defined(WINDOWS_ENABLED)
CameraServer::make_default<CameraWindows>();
#endif
#if defined(IPHONE_ENABLED)
CameraServer::make_default<CameraIOS>();
#endif
#if defined(OSX_ENABLED)
CameraServer::make_default<CameraOSX>();
#endif

View File

@ -0,0 +1,15 @@
#!/usr/bin/env python
Import("env")
Import("env_modules")
env_camera = env_modules.Clone()
# (iOS) Enable module support
env_camera.Append(CCFLAGS=["-fmodules", "-fcxx-modules"])
# (iOS) Build as separate static library
modules_sources = []
env_camera.add_source_files(modules_sources, "*.cpp")
env_camera.add_source_files(modules_sources, "*.mm")
mod_lib = env_modules.add_library("#bin/libgodot_camera_module" + env["LIBSUFFIX"], modules_sources)

View File

@ -0,0 +1,18 @@
[config]
name="Camera"
binary="camera_lib.a"
initialization="register_camera_types"
deinitialization="unregister_camera_types"
[dependencies]
linked=[]
embedded=[]
system=["AVFoundation.framework"]
capabilities=[]
files=[]
[plist]
NSCameraUsageDescription="Device camera is used for some functionality"

View File

@ -0,0 +1,40 @@
/*************************************************************************/
/* camera_module.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "camera_module.h"
#include "camera_ios.h"
void register_camera_types() {
CameraServer::make_default<CameraIOS>();
}
void unregister_camera_types() {
}

View File

@ -0,0 +1,32 @@
/*************************************************************************/
/* camera_module.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
void register_camera_types();
void unregister_camera_types();

View File

@ -0,0 +1,6 @@
def can_build(env, platform):
return platform == "iphone"
def configure(env):
pass

15
modules/gamecenter/SCsub Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env python
Import("env")
Import("env_modules")
env_gamecenter = env_modules.Clone()
# (iOS) Enable module support
env_gamecenter.Append(CCFLAGS=["-fmodules", "-fcxx-modules"])
# (iOS) Build as separate static library
modules_sources = []
env_gamecenter.add_source_files(modules_sources, "*.cpp")
env_gamecenter.add_source_files(modules_sources, "*.mm")
mod_lib = env_modules.add_library("#bin/libgodot_gamecenter_module" + env["LIBSUFFIX"], modules_sources)

View File

@ -0,0 +1,6 @@
def can_build(env, platform):
return platform == "iphone"
def configure(env):
pass

View File

@ -28,8 +28,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifdef GAME_CENTER_ENABLED
#ifndef GAME_CENTER_H
#define GAME_CENTER_H
@ -72,5 +70,3 @@ public:
};
#endif
#endif

View File

@ -28,15 +28,16 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifdef GAME_CENTER_ENABLED
#include "game_center.h"
#import "app_delegate.h"
#import "view_controller.h"
#import "game_center_delegate.h"
#import "platform/iphone/app_delegate.h"
#import "platform/iphone/view_controller.h"
#import <GameKit/GameKit.h>
GameCenter *GameCenter::instance = NULL;
GodotGameCenterDelegate *gameCenterDelegate = nil;
void GameCenter::_bind_methods() {
ClassDB::bind_method(D_METHOD("authenticate"), &GameCenter::authenticate);
@ -64,7 +65,7 @@ Error GameCenter::authenticate() {
GKLocalPlayer *player = [GKLocalPlayer localPlayer];
ERR_FAIL_COND_V(![player respondsToSelector:@selector(authenticateHandler)], ERR_UNAVAILABLE);
ViewController *root_controller = (ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController;
UIViewController *root_controller = [[UIApplication sharedApplication] delegate].window.rootViewController;
ERR_FAIL_COND_V(!root_controller, FAILED);
// This handler is called several times. First when the view needs to be shown, then again
@ -298,10 +299,10 @@ Error GameCenter::show_game_center(Variant p_params) {
GKGameCenterViewController *controller = [[GKGameCenterViewController alloc] init];
ERR_FAIL_COND_V(!controller, FAILED);
ViewController *root_controller = (ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController;
UIViewController *root_controller = [[UIApplication sharedApplication] delegate].window.rootViewController;
ERR_FAIL_COND_V(!root_controller, FAILED);
controller.gameCenterDelegate = root_controller;
controller.gameCenterDelegate = gameCenterDelegate;
controller.viewState = view_state;
if (view_state == GKGameCenterViewControllerStateLeaderboards) {
controller.leaderboardIdentifier = nil;
@ -373,8 +374,12 @@ GameCenter::GameCenter() {
ERR_FAIL_COND(instance != NULL);
instance = this;
authenticated = false;
gameCenterDelegate = [[GodotGameCenterDelegate alloc] init];
};
GameCenter::~GameCenter(){};
#endif
GameCenter::~GameCenter() {
if (gameCenterDelegate) {
gameCenterDelegate = nil;
}
}

View File

@ -0,0 +1,35 @@
/*************************************************************************/
/* game_center_delegate.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#import <GameKit/GameKit.h>
@interface GodotGameCenterDelegate : NSObject <GKGameCenterControllerDelegate>
@end

View File

@ -0,0 +1,45 @@
/*************************************************************************/
/* game_center_delegate.mm */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#import "game_center_delegate.h"
#include "game_center.h"
@implementation GodotGameCenterDelegate
- (void)gameCenterViewControllerDidFinish:(GKGameCenterViewController *)gameCenterViewController {
//[gameCenterViewController dismissViewControllerAnimated:YES completion:^{GameCenter::get_singleton()->game_center_closed();}];//version for signaling when overlay is completely gone
if (GameCenter::get_singleton()) {
GameCenter::get_singleton()->game_center_closed();
}
[gameCenterViewController dismissViewControllerAnimated:YES completion:nil];
}
@end

View File

@ -0,0 +1,48 @@
/*************************************************************************/
/* game_center_module.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "game_center_module.h"
#include "core/engine.h"
#include "game_center.h"
GameCenter *game_center;
void register_gamecenter_types() {
game_center = memnew(GameCenter);
Engine::get_singleton()->add_singleton(Engine::Singleton("GameCenter", game_center));
}
void unregister_gamecenter_types() {
if (game_center) {
memdelete(game_center);
}
}

View File

@ -0,0 +1,32 @@
/*************************************************************************/
/* game_center_module.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
void register_gamecenter_types();
void unregister_gamecenter_types();

View File

@ -0,0 +1,17 @@
[config]
name="GameCenter"
binary="gamecenter_lib.a"
initialization="register_gamecenter_types"
deinitialization="unregister_gamecenter_types"
[dependencies]
linked=[]
embedded=[]
system=["GameKit.framework"]
capabilities=["gamekit"]
files=[]
[plist]

15
modules/icloud/SCsub Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env python
Import("env")
Import("env_modules")
env_icloud = env_modules.Clone()
# (iOS) Enable module support
env_icloud.Append(CCFLAGS=["-fmodules", "-fcxx-modules"])
# (iOS) Build as separate static library
modules_sources = []
env_icloud.add_source_files(modules_sources, "*.cpp")
env_icloud.add_source_files(modules_sources, "*.mm")
mod_lib = env_modules.add_library("#bin/libgodot_icloud_module" + env["LIBSUFFIX"], modules_sources)

6
modules/icloud/config.py Normal file
View File

@ -0,0 +1,6 @@
def can_build(env, platform):
return platform == "iphone"
def configure(env):
pass

View File

@ -0,0 +1,17 @@
[config]
name="iCloud"
binary="icloud_lib.a"
initialization="register_icloud_types"
deinitialization="unregister_icloud_types"
[dependencies]
linked=[]
embedded=[]
system=[]
capabilities=[]
files=[]
[plist]

View File

@ -28,8 +28,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifdef ICLOUD_ENABLED
#ifndef ICLOUD_H
#define ICLOUD_H
@ -61,5 +59,3 @@ public:
};
#endif
#endif

View File

@ -28,11 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifdef ICLOUD_ENABLED
#include "icloud.h"
#import "app_delegate.h"
#import "platform/iphone/app_delegate.h"
#import <Foundation/Foundation.h>
@ -346,6 +344,4 @@ ICloud::ICloud() {
}];
}
ICloud::~ICloud(){};
#endif
ICloud::~ICloud() {}

View File

@ -0,0 +1,48 @@
/*************************************************************************/
/* icloud_module.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "icloud_module.h"
#include "core/engine.h"
#include "icloud.h"
ICloud *icloud;
void register_icloud_types() {
icloud = memnew(ICloud);
Engine::get_singleton()->add_singleton(Engine::Singleton("ICloud", icloud));
}
void unregister_icloud_types() {
if (icloud) {
memdelete(icloud);
}
}

View File

@ -0,0 +1,32 @@
/*************************************************************************/
/* icloud_module.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
void register_icloud_types();
void unregister_icloud_types();

15
modules/inappstore/SCsub Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env python
Import("env")
Import("env_modules")
env_inappstore = env_modules.Clone()
# (iOS) Enable module support
env_inappstore.Append(CCFLAGS=["-fmodules", "-fcxx-modules"])
# (iOS) Build as separate static library
modules_sources = []
env_inappstore.add_source_files(modules_sources, "*.cpp")
env_inappstore.add_source_files(modules_sources, "*.mm")
mod_lib = env_modules.add_library("#bin/libgodot_inappstore_module" + env["LIBSUFFIX"], modules_sources)

View File

@ -0,0 +1,6 @@
def can_build(env, platform):
return platform == "iphone"
def configure(env):
pass

View File

@ -28,8 +28,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifdef STOREKIT_ENABLED
#ifndef IN_APP_STORE_H
#define IN_APP_STORE_H
@ -78,5 +76,3 @@ public:
};
#endif
#endif

View File

@ -28,8 +28,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifdef STOREKIT_ENABLED
#include "in_app_store.h"
#import <Foundation/Foundation.h>
@ -414,5 +412,3 @@ InAppStore::~InAppStore() {
[[SKPaymentQueue defaultQueue] removeTransactionObserver:transactions_observer];
transactions_observer = nil;
}
#endif

View File

@ -0,0 +1,48 @@
/*************************************************************************/
/* in_app_store_module.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "in_app_store_module.h"
#include "core/engine.h"
#include "in_app_store.h"
InAppStore *store_kit;
void register_inappstore_types() {
store_kit = memnew(InAppStore);
Engine::get_singleton()->add_singleton(Engine::Singleton("InAppStore", store_kit));
}
void unregister_inappstore_types() {
if (store_kit) {
memdelete(store_kit);
}
}

View File

@ -0,0 +1,32 @@
/*************************************************************************/
/* in_app_store_module.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
void register_inappstore_types();
void unregister_inappstore_types();

View File

@ -0,0 +1,17 @@
[config]
name="InAppStore"
binary="inappstore_lib.a"
initialization="register_inappstore_types"
deinitialization="unregister_inappstore_types"
[dependencies]
linked=[]
embedded=[]
system=["StoreKit.framework"]
capabilities=[]
files=[]
[plist]

View File

@ -9,9 +9,6 @@ iphone_lib = [
"main.m",
"app_delegate.mm",
"view_controller.mm",
"game_center.mm",
"in_app_store.mm",
"icloud.mm",
"ios.mm",
"joypad_iphone.mm",
"godot_view.mm",

View File

@ -33,9 +33,6 @@ def get_opts():
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain",
),
("IPHONESDK", "Path to the iPhone SDK", ""),
BoolVariable("game_center", "Support for game center", True),
BoolVariable("store_kit", "Support for in-app store", True),
BoolVariable("icloud", "Support for iCloud", True),
BoolVariable("ios_exceptions", "Enable exceptions", False),
("ios_triple", "Triple for ios toolchain", ""),
]
@ -205,18 +202,6 @@ def configure(env):
]
)
# Feature options
if env["game_center"]:
env.Append(CPPDEFINES=["GAME_CENTER_ENABLED"])
env.Append(LINKFLAGS=["-framework", "GameKit"])
if env["store_kit"]:
env.Append(CPPDEFINES=["STOREKIT_ENABLED"])
env.Append(LINKFLAGS=["-framework", "StoreKit"])
if env["icloud"]:
env.Append(CPPDEFINES=["ICLOUD_ENABLED"])
env.Prepend(
CPPPATH=[
"$IPHONESDK/usr/include",

View File

@ -38,9 +38,6 @@
#include "drivers/unix/os_unix.h"
#include "joypad_iphone.h"
#include "game_center.h"
#include "icloud.h"
#include "in_app_store.h"
#include "ios.h"
#include "main/input_default.h"
#include "servers/audio_server.h"
@ -57,15 +54,6 @@ private:
AudioDriverCoreAudio audio_driver;
#ifdef GAME_CENTER_ENABLED
GameCenter *game_center;
#endif
#ifdef STOREKIT_ENABLED
InAppStore *store_kit;
#endif
#ifdef ICLOUD_ENABLED
ICloud *icloud;
#endif
iOS *ios;
JoypadIPhone *joypad_iphone;

View File

@ -181,21 +181,6 @@ Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p
input = memnew(InputDefault);
#ifdef GAME_CENTER_ENABLED
game_center = memnew(GameCenter);
Engine::get_singleton()->add_singleton(Engine::Singleton("GameCenter", game_center));
#endif
#ifdef STOREKIT_ENABLED
store_kit = memnew(InAppStore);
Engine::get_singleton()->add_singleton(Engine::Singleton("InAppStore", store_kit));
#endif
#ifdef ICLOUD_ENABLED
icloud = memnew(ICloud);
Engine::get_singleton()->add_singleton(Engine::Singleton("ICloud", icloud));
//icloud->connect();
#endif
ios = memnew(iOS);
Engine::get_singleton()->add_singleton(Engine::Singleton("iOS", ios));
@ -334,24 +319,6 @@ void OSIPhone::finalize() {
memdelete(ios);
}
#ifdef GAME_CENTER_ENABLED
if (game_center) {
memdelete(game_center);
}
#endif
#ifdef STOREKIT_ENABLED
if (store_kit) {
memdelete(store_kit);
}
#endif
#ifdef ICLOUD_ENABLED
if (icloud) {
memdelete(icloud);
}
#endif
visual_server->finish();
memdelete(visual_server);
// memdelete(rasterizer);

View File

@ -28,14 +28,13 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#import <GameKit/GameKit.h>
#import <UIKit/UIKit.h>
@class GodotView;
@class GodotNativeVideoView;
@class GodotKeyboardInputView;
@interface ViewController : UIViewController <GKGameCenterControllerDelegate>
@interface ViewController : UIViewController
@property(nonatomic, readonly, strong) GodotView *godotView;
@property(nonatomic, readonly, strong) GodotNativeVideoView *videoView;

View File

@ -225,12 +225,4 @@
}
}
#ifdef GAME_CENTER_ENABLED
- (void)gameCenterViewControllerDidFinish:(GKGameCenterViewController *)gameCenterViewController {
//[gameCenterViewController dismissViewControllerAnimated:YES completion:^{GameCenter::get_singleton()->game_center_closed();}];//version for signaling when overlay is completely gone
GameCenter::get_singleton()->game_center_closed();
[gameCenterViewController dismissViewControllerAnimated:YES completion:nil];
}
#endif
@end