This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create label with text, font and font size | |
auto label = LabelTTF::create("Wheel of Fortune", "Marker Felt", 20); | |
// get the size of the label | |
Size labelSize = label->getDimensions(); | |
// set the position of the label | |
label->setPosition(Vec2(20,20)); | |
// set the text color of the label |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// load sound effect | |
CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect("audio/menu-click.caf"); | |
// load background sound | |
CocosDenshion::SimpleAudioEngine::getInstance()->preloadBackgroundMusic("audio/landing.mp3"); | |
// play backgorund sound | |
CocosDenshion::SimpleAudioEngine::getInstance()->playBackgroundMusic("audio/landing.mp3"); | |
// play sound effect |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------------------------Headr File------------------------------------------ | |
//---------------------------------------------------------------------------------------- | |
#ifndef __GAME_SCENE_H__ | |
#define __GAME_SCENE_H__ | |
#include "cocos2d.h" | |
class GameScene : public cocos2d::LayerColor | |
{ | |
public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (void)changeSearchBarColor:(UISearchBar *)searchBar { | |
for (UIView *subview in searchBar.subviews) { | |
for (UIView *subSubview in subview.subviews) { | |
if ([subSubview conformsToProtocol:@protocol(UITextInputTraits)]) { | |
UITextField *textField = (UITextField *)subSubview; | |
[textField setKeyboardAppearance: UIKeyboardAppearanceAlert]; | |
break; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert UnixTimeStamp Date with specified Timezone. Example "/Date(1395486890000+0530)/" as a sample value. | |
+ (NSDate *)DateFromJSONString:(NSString *)string { | |
static NSRegularExpression *dateRegEx = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
dateRegEx = [[NSRegularExpression alloc] initWithPattern:@"^\\/date\\((-?\\d++)(?:([+-])(\\d{2})(\\d{2}))?\\)\\/$" options:NSRegularExpressionCaseInsensitive error:nil]; | |
}); | |
NSTextCheckingResult *regexResult = [dateRegEx firstMatchInString:string options:0 range:NSMakeRange(0, [string length])]; | |
if (regexResult) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "API_Request.h" | |
#import "SessionDelegate.h" | |
NSMutableURLRequest * generateRequest(NSURL *URL, NSString *postString) { | |
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL]; | |
[request setHTTPMethod:@"POST"]; | |
NSData *postData = [postString dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]; | |
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; | |
[request setValue:postLength forHTTPHeaderField:@"Content-Length"]; | |
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import "_01_API_Authenticate.h" | |
#import "_02_API_Register.h" | |
#import "_03_API_RegisterSocial.h" | |
#import "_04_API_ForgotPassword.h" | |
#define kAPI_Request_email @"email" | |
#define kAPI_Request_mobile @"mobile" | |
#define kAPI_Request_password @"password" | |
#define kAPI_Request_user_id @"user_id" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "SessionDelegate.h" | |
#import "SessionConfiguration.h" | |
@interface SessionConfiguration () | |
+ (NSURLSessionConfiguration*)sessionConfig; | |
@end | |
@interface SessionDelegate () | |
+ (SessionDelegate*)sharedSessionDelegate; | |
@property (nonatomic, strong) NSMutableDictionary *dForData; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface SessionDelegate : NSObject <NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSessionTaskDelegate> | |
+ (void)invokeAPIRequest:(NSMutableURLRequest*)request completionHandler:(void (^)(NSData* data, NSError *error))completionHandler; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------------------------------------------------------------------ | |
// newSessionConfig.h | |
#import <Foundation/Foundation.h> | |
@interface SessionConfiguration : NSObject | |
@end |