summaryrefslogtreecommitdiff
path: root/platform/iphone
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-09-02 23:13:40 -0300
committerDana Olson <dana@shineuponthee.com>2014-09-15 17:43:28 -0400
commit247e7ed716a4c0bd5140c2b2a938f7118e84fb14 (patch)
tree2487f84d19ea60c4140c085164219a893a4f8566 /platform/iphone
parentdbae857b293231882307c52217e9569a17da0f23 (diff)
3D Physics and Other Stuff
-=-=-=-=-=-=-=-=-=-=-=-=-= -New Vehicle (Based on Bullet's RaycastVehicle) - Vehiclebody/VehicleWheel. Demo will come soon, old vehicle (CarBody) will go away soon too. -A lot of fixes to the 3D physics engine -Added KinematicBody with demo -Fixed the space query API for 2D (demo will come soon). 3D is WIP. -Fixed long-standing bug with body_enter/body_exit for Area and Area2D -Performance variables now includes physics (active bodies, collision pairs and islands) -Ability to see what's inside of instanced scenes! -Fixed Blend Shapes (no bs+skeleton yet) -Added an Android JavaClassWrapper singleton for using Android native classes directly from GDScript. This is very Alpha!
Diffstat (limited to 'platform/iphone')
-rw-r--r--platform/iphone/app_delegate.mm4
-rw-r--r--platform/iphone/in_app_store.h2
-rw-r--r--platform/iphone/in_app_store.mm31
3 files changed, 36 insertions, 1 deletions
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index 9ba95ff0c5..9877e09ade 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -257,18 +257,21 @@ static int frame_count = 0;
- (void)applicationDidEnterBackground:(UIApplication *)application
{
printf("********************* did enter background\n");
+ OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
[view_controller.view stopAnimation];
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
printf("********************* did enter foreground\n");
+ //OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
[view_controller.view startAnimation];
}
- (void) applicationWillResignActive:(UIApplication *)application
{
printf("********************* will resign active\n");
+ //OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
[view_controller.view stopAnimation]; // FIXME: pause seems to be recommended elsewhere
}
@@ -279,6 +282,7 @@ static int frame_count = 0;
printf("********************* mobile app tracker found\n");
[MobileAppTracker measureSession];
#endif
+ OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
[view_controller.view startAnimation]; // FIXME: resume seems to be recommended elsewhere
}
diff --git a/platform/iphone/in_app_store.h b/platform/iphone/in_app_store.h
index dba1a1a5a1..656d126ead 100644
--- a/platform/iphone/in_app_store.h
+++ b/platform/iphone/in_app_store.h
@@ -49,6 +49,8 @@ public:
int get_pending_event_count();
Variant pop_pending_event();
+ void finish_transaction(String product_id);
+ void set_auto_finish_transaction(bool b);
void _post_event(Variant p_event);
void _record_purchase(String product_id);
diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm
index 9b932d147b..f3640c3076 100644
--- a/platform/iphone/in_app_store.mm
+++ b/platform/iphone/in_app_store.mm
@@ -32,8 +32,12 @@
extern "C" {
#import <StoreKit/StoreKit.h>
+#import <Foundation/Foundation.h>
};
+bool auto_finish_transactions = true;
+NSMutableDictionary* pending_transactions = [NSMutableDictionary dictionary];
+
@interface SKProduct (LocalizedPrice)
@property (nonatomic, readonly) NSString *localizedPrice;
@end
@@ -63,6 +67,8 @@ void InAppStore::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_pending_event_count"),&InAppStore::get_pending_event_count);
ObjectTypeDB::bind_method(_MD("pop_pending_event"),&InAppStore::pop_pending_event);
+ ObjectTypeDB::bind_method(_MD("finish_transaction"),&InAppStore::finish_transaction);
+ ObjectTypeDB::bind_method(_MD("set_auto_finish_transaction"),&InAppStore::set_auto_finish_transaction);
};
@interface ProductsDelegate : NSObject<SKProductsRequestDelegate> {
@@ -162,11 +168,13 @@ Error InAppStore::request_product_info(Variant p_params) {
case SKPaymentTransactionStatePurchased: {
printf("status purchased!\n");
String pid = String::utf8([transaction.payment.productIdentifier UTF8String]);
+ String transactionId = String::utf8([transaction.transactionIdentifier UTF8String]);
InAppStore::get_singleton()->_record_purchase(pid);
Dictionary ret;
ret["type"] = "purchase";
ret["result"] = "ok";
ret["product_id"] = pid;
+ ret["transaction_id"] = transactionId;
NSData* receipt = nil;
int sdk_version = 6;
@@ -207,7 +215,13 @@ Error InAppStore::request_product_info(Variant p_params) {
ret["receipt"] = receipt_ret;
InAppStore::get_singleton()->_post_event(ret);
- [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
+
+ if (auto_finish_transactions){
+ [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
+ }
+ else{
+ [pending_transactions setObject:transaction forKey:transaction.payment.productIdentifier];
+ }
} break;
case SKPaymentTransactionStateFailed: {
printf("status transaction failed!\n");
@@ -290,11 +304,26 @@ InAppStore* InAppStore::get_singleton() {
InAppStore::InAppStore() {
ERR_FAIL_COND(instance != NULL);
instance = this;
+ auto_finish_transactions = false;
TransObserver* observer = [[TransObserver alloc] init];
[[SKPaymentQueue defaultQueue] addTransactionObserver:observer];
+ //pending_transactions = [NSMutableDictionary dictionary];
};
+void InAppStore::finish_transaction(String product_id){
+ NSString* prod_id = [NSString stringWithCString:product_id.utf8().get_data() encoding:NSUTF8StringEncoding];
+
+ if ([pending_transactions objectForKey:prod_id]){
+ [[SKPaymentQueue defaultQueue] finishTransaction:[pending_transactions objectForKey:prod_id]];
+ [pending_transactions removeObjectForKey:prod_id];
+ }
+};
+
+void InAppStore::set_auto_finish_transaction(bool b){
+ auto_finish_transactions = b;
+}
+
InAppStore::~InAppStore() {
};