2012-04-24 17:13:13 +08:00
|
|
|
#ifndef __CC_APPLICATION_PROTOCOL_H__
|
|
|
|
#define __CC_APPLICATION_PROTOCOL_H__
|
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
/**
|
|
|
|
* @addtogroup platform
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL ApplicationProtocol
|
2012-04-24 17:13:13 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2013-07-26 18:17:30 +08:00
|
|
|
// Since WINDOWS and ANDROID are defined as macros, we could not just use these keywords in enumeration(Platform).
|
|
|
|
// Therefore, 'OS_' prefix is added to avoid conflicts with the definitions of system macros.
|
2013-07-26 17:29:06 +08:00
|
|
|
enum class Platform
|
|
|
|
{
|
2013-07-26 18:17:30 +08:00
|
|
|
OS_WINDOWS,
|
|
|
|
OS_LINUX,
|
2013-07-26 20:24:33 +08:00
|
|
|
OS_MAC,
|
2013-07-26 18:17:30 +08:00
|
|
|
OS_ANDROID,
|
|
|
|
OS_IPHONE,
|
|
|
|
OS_IPAD,
|
|
|
|
OS_BLACKBERRY,
|
|
|
|
OS_NACL,
|
|
|
|
OS_EMSCRIPTEN,
|
|
|
|
OS_TIZEN
|
2013-07-26 17:29:06 +08:00
|
|
|
};
|
|
|
|
|
2013-09-13 13:52:42 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual ~ApplicationProtocol() {}
|
2012-04-24 17:13:13 +08:00
|
|
|
|
|
|
|
/**
|
2013-06-20 14:13:12 +08:00
|
|
|
@brief Implement Director and Scene init code here.
|
2012-04-24 17:13:13 +08:00
|
|
|
@return true Initialize success, app continue.
|
|
|
|
@return false Initialize failed, app terminate.
|
2013-09-13 11:41:20 +08:00
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
2012-04-24 17:13:13 +08:00
|
|
|
*/
|
|
|
|
virtual bool applicationDidFinishLaunching() = 0;
|
|
|
|
|
|
|
|
/**
|
2013-08-01 20:55:43 +08:00
|
|
|
@brief This function will be called when the application enters background.
|
2013-09-13 11:41:20 +08:00
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
2012-04-24 17:13:13 +08:00
|
|
|
*/
|
|
|
|
virtual void applicationDidEnterBackground() = 0;
|
|
|
|
|
|
|
|
/**
|
2013-08-01 20:55:43 +08:00
|
|
|
@brief This function will be called when the application enters foreground.
|
2013-09-13 11:41:20 +08:00
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
2012-04-24 17:13:13 +08:00
|
|
|
*/
|
|
|
|
virtual void applicationWillEnterForeground() = 0;
|
|
|
|
|
|
|
|
/**
|
2013-06-20 14:13:12 +08:00
|
|
|
@brief Callback by Director for limit FPS.
|
2013-08-01 20:55:43 +08:00
|
|
|
@param interval The time, expressed in seconds, between current frame and next.
|
2013-09-13 11:41:20 +08:00
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
2012-04-24 17:13:13 +08:00
|
|
|
*/
|
|
|
|
virtual void setAnimationInterval(double interval) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
@brief Get current language config
|
|
|
|
@return Current language config
|
2013-09-13 11:41:20 +08:00
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
2012-04-24 17:13:13 +08:00
|
|
|
*/
|
2013-07-26 17:29:06 +08:00
|
|
|
virtual LanguageType getCurrentLanguage() = 0;
|
2012-06-11 14:36:25 +08:00
|
|
|
|
2012-08-16 10:21:15 +08:00
|
|
|
/**
|
|
|
|
@brief Get target platform
|
2013-09-13 11:41:20 +08:00
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
2012-08-16 10:21:15 +08:00
|
|
|
*/
|
2013-07-26 17:29:06 +08:00
|
|
|
virtual Platform getTargetPlatform() = 0;
|
2012-04-24 17:13:13 +08:00
|
|
|
};
|
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
// end of platform group
|
|
|
|
/// @}
|
|
|
|
|
2012-04-24 17:13:13 +08:00
|
|
|
NS_CC_END
|
|
|
|
|
|
|
|
#endif // __CC_APPLICATION_PROTOCOL_H__
|