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
// Inspired by: http://stackoverflow.com/a/5314634/9849 | |
// Simplified if-statements | |
// Updated to "modern" syntax | |
// Support optional CLHeading | |
// Support degree-of-precision | |
// | |
// This dictionary should then be added to the normal | |
// metadata using the kCGImagePropertyGPSDictionary key | |
- (NSDictionary *)GPSDictionaryForLocation:(CLLocation *)location heading:(CLHeading *)heading | |
{ |
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
#include "MawKit/Device.hpp" | |
std::map<std::string, std::map<std:string, std::string>> languages; | |
std::string translate( const std::string &key ) | |
{ | |
std::map<std::string, std::string> &translations = languages[MK::Device::language()]; | |
if ( translations.find( key ) == translations.end() ) { | |
translations[key] = key; |
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
#include "MawKit/FiniteTimeActions.hpp" | |
void runPickupCoinAnimation( cocos2d::Node *coin, cocos2d::Node *chest ) { | |
// Move coin to chest. | |
auto moveCoinToChest = MK::Actions::MoveToNode::create( 0.25, chest ); | |
// Bounces chest. | |
std::function<void( void )> bounceChest = [=]() { chest->bounce(); }; | |
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
#include "MawKit/Range.hpp" | |
#include "MawKit/Random.hpp" | |
#include <vector> | |
long long throw20FacesDice() { | |
return MK::LLRange( 1, 20 ).randomInteger(); | |
} | |
double getRandomNumberFrom0UpTo100() { |
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
#include "MawKit/AdKit.hpp" | |
constexpr const char*ADMOB_INTERSTITIAL_ID = ""; | |
void prepareAds() { | |
MK::AdKit::init( ADMOB_INTERSTITIAL_ID ); | |
} | |
void showMyInterstitial() { | |
MK::AdKit::showInterstitial( ADMOB_INTERSTITIAL_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
#include "MawKit/GameKit.hpp" | |
void getSecretAchievementInfo() | |
{ | |
MK::GameKit::requestAchievement( | |
MK::GameKit::AchievementIndex::SECRET_ACHIEVEMENT, | |
[]( float progress, bool success ) { | |
if ( success ) { | |
if ( progress == 1 ) { | |
// Achievement unlocked! |
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
#include "MawKit/GameKit.hpp" | |
MK::GameKit::submitScore( 42, MK::GameKit::LeaderboardIndex::SCORE ); |
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
#include "MawKit/KVDatabase.hpp" | |
bool buyIfPossible( long long price ) | |
{ | |
constexpr const char *moneyKey = "money"; | |
if ( MK::KVDatabase::getLongValueForKey( moneyKey ) > price ) { | |
MK::KVDatabase::decreaseLongValueForKey( moneyKey, price ); | |
return true; | |
} |
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
cocos2d::Texture2D::TexParams texParams = { | |
GL_NEAREST, // TextureMinFilter | |
GL_NEAREST, // TextureMagFilter | |
GL_CLAMP_TO_EDGE, // TextureWrapMode Horizontal | |
GL_CLAMP_TO_EDGE // TextureWrapMode Vertical | |
}; | |
this->getTexture()->setTexParameters( texParams ); |
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
#!/bin/bash | |
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE") | |
buildNumber=$(($buildNumber + 1)) | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE" |
NewerOlder