![]() |
AppEasy Core SDK
1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
|
00001 // 00002 // 00003 // AppEasy SDK - Cross Platform Multi-purpose Game and App Engine 00004 // 00005 // Developed by Matthew Hopwood of Pocketeers Limited - www.pocketeers.co.uk 00006 // 00007 // For updates, tutorials and more details check out www.appeasymobile.com 00008 // 00009 // This code is provided free of charge and without any warranty whatsoever. You must ensure that this whole notice is present in all files and derivatives, so the reader knows its origin. 00010 // If you use this SDK in your product then please ensure that you credit AppEasy's usage appropriately. Please see www.appeasymobile.com for licensing details and support 00011 // 00012 // 00013 00014 #if !defined(_CIZ_PLATFORM_MARKET_H_) 00015 #define _CIZ_PLATFORM_MARKET_H_ 00016 00017 #include "CzPlatform.h" 00018 #include "CzMarket.h" 00019 00020 #define PLATFORM_MARKET PLATFORM->getMarket() 00021 00022 class CzMarket; 00023 00024 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 00025 // 00026 // IzPlatformMarket 00027 // 00028 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 00029 class IzPlatformMarket 00030 { 00031 public: 00032 enum eMarketStatus 00033 { 00034 MS_IDLE, 00035 MS_PURCHASING, 00036 MS_PURCHASE_COMPLETED, 00037 MS_RESTORE_COMPLETED, 00038 MS_ERROR_CLIENT_INVALID, 00039 MS_ERROR_PAYMENT_CANCELLED, 00040 MS_ERROR_PAYMENT_INVALID, 00041 MS_ERROR_PAYMENT_NOT_ALLOWED, 00042 MS_ERROR_PURCHASE_UNKNOWN, 00043 MS_ERROR_PURCHASE_DISABLED, 00044 MS_ERROR_NO_CONNECTION, 00045 MS_ERROR_RESTORE_FAILED, 00046 MS_ERROR_UNKNOWN_PRODUCT, 00047 MS_ERROR_DEVELOPER_ERROR, 00048 MS_ERROR_UNAVAILABLE 00049 }; 00050 00051 // Properties 00052 protected: 00053 bool Available; ///< Is available on this platform 00054 bool Initialised; ///< Initialised state 00055 eMarketStatus Status; ///< Markets current status 00056 CzMarket* ActiveMarket; ///< Currently active market 00057 unsigned int SimulationHash; ///< Name of sinulation to perform 00058 public: 00059 bool isAvailable() const { return Available; } 00060 bool isInitialised() const { return Initialised; } 00061 eMarketStatus getStatus() const { return Status; } 00062 void setStatus(eMarketStatus status) { Status = status; } 00063 CzMarket* getActiveMarket() { return ActiveMarket; } 00064 void setActiveMarket(CzMarket* market) { ActiveMarket = market; } 00065 void setSimulation(unsigned int sim) { SimulationHash = sim; } 00066 unsigned int getSimulation() const { return SimulationHash; } 00067 virtual bool isBillingEnabled() = 0; ///< Returns true if billing enabled on device 00068 // Properties end 00069 public: 00070 IzPlatformMarket() : SimulationHash(0), Available(false), Initialised(false), ActiveMarket(NULL), Status(MS_IDLE) {} 00071 00072 // PLatform specific implementations 00073 virtual int Init(void* id) = 0; ///< Market intialisation 00074 virtual void Release() = 0; ///< Market cleanup 00075 virtual void Update() = 0; ///< Per frame update 00076 virtual bool QueryProduct(const char* product_id) = 0; ///< Query product information 00077 virtual bool PurchaseProduct(const char* product_id) = 0; ///< Purchase a product 00078 virtual bool RestoreProducts() = 0; ///< Restore previously purchased products 00079 00080 // Event notification callbacks (platform agnostic, although you can override the event notification methods) 00081 protected: 00082 public: 00083 // Event notification 00084 00085 }; 00086 00087 00088 00089 00090 00091 #endif // _CIZ_PLATFORM_MARKET_H_