Minor changes to comments. One integer literal changed to float literal.

This commit is contained in:
Donald Alan Morrison 2012-09-14 15:26:38 -07:00
parent 5146ea8bfa
commit 7c750dc9c5
13 changed files with 68 additions and 77 deletions

View File

@ -136,7 +136,7 @@ bool CCDirector::init(void)
m_pobOpenGLView = NULL; m_pobOpenGLView = NULL;
m_fContentScaleFactor = 1; m_fContentScaleFactor = 1.0f;
m_bIsContentScaleSupported = false; m_bIsContentScaleSupported = false;
// scheduler // scheduler
@ -200,7 +200,7 @@ void CCDirector::setGLDefaultValues(void)
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
} }
// Draw the SCene // Draw the Scene
void CCDirector::drawScene(void) void CCDirector::drawScene(void)
{ {
// calculate "global" dt // calculate "global" dt
@ -290,16 +290,13 @@ void CCDirector::calculateDeltaTime(void)
*m_pLastUpdate = now; *m_pLastUpdate = now;
} }
// m_pobOpenGLView
void CCDirector::setOpenGLView(CCEGLView *pobOpenGLView) void CCDirector::setOpenGLView(CCEGLView *pobOpenGLView)
{ {
CCAssert(pobOpenGLView, "opengl view should not be null"); CCAssert(pobOpenGLView, "opengl view should not be null");
if (m_pobOpenGLView != pobOpenGLView) if (m_pobOpenGLView != pobOpenGLView)
{ {
// because EAGLView is not kind of CCObject // EAGLView is not a CCObject
delete m_pobOpenGLView; // [openGLView_ release] delete m_pobOpenGLView; // [openGLView_ release]
m_pobOpenGLView = pobOpenGLView; m_pobOpenGLView = pobOpenGLView;
@ -942,7 +939,7 @@ CCAccelerometer* CCDirector::getAccelerometer()
* implementation of DisplayLinkDirector * implementation of DisplayLinkDirector
**************************************************/ **************************************************/
// should we afford 4 types of director ?? // should we implement 4 types of director ??
// I think DisplayLinkDirector is enough // I think DisplayLinkDirector is enough
// so we now only support DisplayLinkDirector // so we now only support DisplayLinkDirector
void CCDisplayLinkDirector::startAnimation(void) void CCDisplayLinkDirector::startAnimation(void)

View File

@ -83,7 +83,7 @@ and when to execute the Scenes.
- setting the OpenGL pixel format (default on is RGB565) - setting the OpenGL pixel format (default on is RGB565)
- setting the OpenGL buffer depth (default one is 0-bit) - setting the OpenGL buffer depth (default one is 0-bit)
- setting the projection (default one is 3D) - setting the projection (default one is 3D)
- setting the orientation (default one is Protrait) - setting the orientation (default one is Portrait)
Since the CCDirector is a singleton, the standard way to use it is by calling: Since the CCDirector is a singleton, the standard way to use it is by calling:
_ CCDirector::sharedDirector()->methodName(); _ CCDirector::sharedDirector()->methodName();

View File

@ -681,7 +681,7 @@ void CCNode::sortAllChildren()
{ {
//CCAssert(0); //CCAssert(0);
// override me // override me
// Only use- this function to draw your staff. // Only use- this function to draw your stuff.
// DON'T draw your stuff outside this method // DON'T draw your stuff outside this method
} }

View File

@ -46,7 +46,7 @@ public:
/** /**
@brief Callback by CCDirector for limit FPS. @brief Callback by CCDirector for limit FPS.
@interval The time, which expressed in second in second, between current frame and next. @interval The time, expressed in seconds, between current frame and next.
*/ */
virtual void setAnimationInterval(double interval) = 0; virtual void setAnimationInterval(double interval) = 0;

View File

@ -77,14 +77,14 @@ public:
virtual CCPoint getVisibleOrigin() const; virtual CCPoint getVisibleOrigin() const;
/** /**
* Set the design resolutin size. * Set the design resolution size.
* You can't use it with enableRetina together. * Behavior undefined when enableRetina == true.
* @param width Design resolution width. * @param width Design resolution width.
* @param height Design resolution height. * @param height Design resolution height.
* @param resolutionPolicy The resolution policy you need, there are: * @param resolutionPolicy The resolution policy desired, you may choose:
* [1] kCCResolutionExactFit Fill screen, if the design resolution ratio of width and height is different from the screen resolution ratio, your game view will be stretched. * [1] kCCResolutionExactFit Fill screen by stretch-to-fit: if the design resolution ratio of width to height is different from the screen resolution ratio, your game view will be stretched.
* [2] kCCResolutionNoBorder Full screen without black border, if the design resolution ratio of width and height is different from the screen resolution ratio, two areas of your game view will be cut. * [2] kCCResolutionNoBorder Full screen without black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two areas of your game view will be cut.
* [3] kCCResolutionShowAll Full screen with black border, if the design resolution ratio of width and height is different from the screen resolution ratio, two black border will be shown on the screen; * [3] kCCResolutionShowAll Full screen with black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two black borders will be shown.
*/ */
virtual void setDesignResolutionSize(float width, float height, ResolutionPolicy resolutionPolicy); virtual void setDesignResolutionSize(float width, float height, ResolutionPolicy resolutionPolicy);
@ -93,7 +93,7 @@ public:
/** /**
* Set content scale factor. * Set content scale factor.
* @return If return true, it means the plaform supports retina display. * @return If the return value is true, the plaform supports retina display mode.
*/ */
virtual bool setContentScaleFactor(float contentScaleFactor); virtual bool setContentScaleFactor(float contentScaleFactor);
@ -113,30 +113,29 @@ public:
*/ */
virtual bool enableRetina(); virtual bool enableRetina();
/** handle touch events by default, if you want to custom your handles, please override these functions */ /** Touch events are handled by default; if you want to customize your handlers, please override these functions: */
virtual void handleTouchesBegin(int num, int ids[], float xs[], float ys[]); virtual void handleTouchesBegin(int num, int ids[], float xs[], float ys[]);
virtual void handleTouchesMove(int num, int ids[], float xs[], float ys[]); virtual void handleTouchesMove(int num, int ids[], float xs[], float ys[]);
virtual void handleTouchesEnd(int num, int ids[], float xs[], float ys[]); virtual void handleTouchesEnd(int num, int ids[], float xs[], float ys[]);
virtual void handleTouchesCancel(int num, int ids[], float xs[], float ys[]); virtual void handleTouchesCancel(int num, int ids[], float xs[], float ys[]);
/** /**
* Get opengl view port rectangle. * Get the opengl view port rectangle.
*/ */
const CCRect& getViewPortRect() const; const CCRect& getViewPortRect() const;
/** /**
* Get the scale factor of horizontal direction. * Get scale factor of the horizontal direction.
*
*/ */
float getScaleX() const; float getScaleX() const;
/** /**
* Get the scale factor of vertical direction. * Get scale factor of the vertical direction.
*/ */
float getScaleY() const; float getScaleY() const;
/** /**
* Get whether the retina mode is enabled. * Get retina mode status (on if true).
*/ */
bool isRetinaEnabled() const; bool isRetinaEnabled() const;
private: private:
@ -145,9 +144,9 @@ private:
protected: protected:
EGLTouchDelegate* m_pDelegate; EGLTouchDelegate* m_pDelegate;
// real size of screen // real screen size
CCSize m_obScreenSize; CCSize m_obScreenSize;
// resolution size, it is the size the app resources designed for // resolution size, it is the size appropriate for the app resources.
CCSize m_obDesignResolutionSize; CCSize m_obDesignResolutionSize;
// the view port size // the view port size
CCRect m_obViewPortRect; CCRect m_obViewPortRect;

View File

@ -45,20 +45,20 @@ public:
void purgeCachedEntries(); void purgeCachedEntries();
/** /**
@brief Get resource file data @brief Get resource file data
@param[in] pszFileName The resource file name which contain the path @param[in] pszFileName The resource file name which contains the path.
@param[in] pszMode The read mode of the file @param[in] pszMode The read mode of the file.
@param[out] pSize If get the file data succeed the it will be the data size,or it will be 0 @param[out] pSize If the file read operation succeeds, it will be the data size, otherwise 0.
@return if success,the pointer of data will be returned,or NULL is returned @return Upon success, a pointer to the data is returned, otherwise NULL.
@warning If you get the file data succeed,you must delete[] it after used. @warning Recall: you are responsible for calling delete[] on any Non-NULL pointer returned.
*/ */
unsigned char* getFileData(const char* pszFileName, const char* pszMode, unsigned long * pSize); unsigned char* getFileData(const char* pszFileName, const char* pszMode, unsigned long * pSize);
/** /**
@brief Get resource file data from zip file @brief Get resource file data from a zip file.
@param[in] pszFileName The resource file name which contain the relative path of zip file @param[in] pszFileName The resource file name which contains the relative path of the zip file.
@param[out] pSize If get the file data succeed the it will be the data size,or it will be 0 @param[out] pSize If the file read operation succeeds, it will be the data size, otherwise 0.
@return if success,the pointer of data will be returned,or NULL is returned @return Upon success, a pointer to the data is returned, otherwise NULL.
@warning If you get the file data succeed,you must delete[] it after used. @warning Recall: you are responsible for calling delete[] on any Non-NULL pointer returned.
*/ */
unsigned char* getFileDataFromZip(const char* pszZipFilePath, const char* pszFileName, unsigned long * pSize); unsigned char* getFileDataFromZip(const char* pszZipFilePath, const char* pszFileName, unsigned long * pSize);
@ -67,8 +67,8 @@ public:
@param pszRelativePath The relative path of the file. @param pszRelativePath The relative path of the file.
@return The absolute path of the file. @return The absolute path of the file.
@warning We only add the ResourcePath before the relative path of the file. @warning We only add the ResourcePath before the relative path of the file.
If you have not set the ResourcePath,the function add "/NEWPLUS/TDA_DATA/UserData/" as default. If you have not set the ResourcePath, the function appends "/NEWPLUS/TDA_DATA/UserData/" by default.
You can set ResourcePath by function void setResourcePath(const char *pszResourcePath); You can set ResourcePath with void setResourcePath(const char *pszResourcePath);
*/ */
const char* fullPathFromRelativePath(const char *pszRelativePath); const char* fullPathFromRelativePath(const char *pszRelativePath);
@ -77,8 +77,8 @@ public:
/// @endcond /// @endcond
/** /**
@brief Set the resource directory,we will find resource relative to this directory @brief Set the resource directory; we will find resources relative to this directory.
@param pszDirectoryName Relative path to root @param pszDirectoryName Relative path to root.
*/ */
void setResourceDirectory(const char *pszDirectoryName); void setResourceDirectory(const char *pszDirectoryName);

View File

@ -64,29 +64,29 @@ public:
/** /**
@brief Load the image from the specified path. @brief Load the image from the specified path.
@param strPath the absolute file path @param strPath the absolute file path.
@param imageType the type of image, now only support tow types. @param imageType the type of image, currently only supporting two types.
@return true if load correctly @return true if loaded correctly.
*/ */
bool initWithImageFile(const char * strPath, EImageFormat imageType = kFmtPng); bool initWithImageFile(const char * strPath, EImageFormat imageType = kFmtPng);
/* /*
@brief The same meaning as initWithImageFile, but it is thread safe. It is casued by @brief The same meaning as initWithImageFile, but it is thread safe. It is casued by
loadImage() in CCTextureCache.cpp. loadImage() in CCTextureCache.cpp.
@param fullpath full path of the file @param fullpath full path of the file.
@param imageType the type of image, now only support tow types. @param imageType the type of image, currently only supporting two types.
@return true if load correctly @return true if loaded correctly.
*/ */
bool initWithImageFileThreadSafe(const char *fullpath, EImageFormat imageType = kFmtPng); bool initWithImageFileThreadSafe(const char *fullpath, EImageFormat imageType = kFmtPng);
/** /**
@brief Load image from stream buffer. @brief Load image from stream buffer.
@warning kFmtRawData only support RGBA8888 @warning kFmtRawData only supports RGBA8888.
@param pBuffer stream buffer that hold the image data @param pBuffer stream buffer which holds the image data.
@param nLength the length of data(managed in byte) @param nLength data length expressed in (number of) bytes.
@param nWidth, nHeight, nBitsPerComponent are used for kFmtRawData @param nWidth, nHeight, nBitsPerComponent are used for kFmtRawData.
@return true if load correctly @return true if loaded correctly.
*/ */
bool initWithImageData(void * pData, bool initWithImageData(void * pData,
int nDataLen, int nDataLen,
@ -97,11 +97,11 @@ public:
/** /**
@brief Create image with specified string. @brief Create image with specified string.
@param pText the text which the image show, nil cause init fail @param pText the text the image will show (cannot be nil).
@param nWidth the image width, if 0, the width match the text's width @param nWidth the image width, if 0, the width will match the text's width.
@param nHeight the image height, if 0, the height match the text's height @param nHeight the image height, if 0, the height will match the text's height.
@param eAlignMask the test Alignment @param eAlignMask the test Alignment
@param pFontName the name of the font which use to draw the text. If nil, use the default system font. @param pFontName the name of the font used to draw the text. If nil, use the default system font.
@param nSize the font size, if 0, use the system default size. @param nSize the font size, if 0, use the system default size.
*/ */
bool initWithString( bool initWithString(
@ -119,9 +119,9 @@ public:
bool isPremultipliedAlpha() { return m_bPreMulti; } bool isPremultipliedAlpha() { return m_bPreMulti; }
/** /**
@brief Save the CCImage data to specified file with specified format. @brief Save CCImage data to the specified file, with specified format.
@param pszFilePath the file's absolute path, including file subfix @param pszFilePath the file's absolute path, including file subfix.
@param bIsToRGB if the image is saved as RGB format @param bIsToRGB whether the image is saved as RGB format.
*/ */
bool saveToFile(const char *pszFilePath, bool bIsToRGB = true); bool saveToFile(const char *pszFilePath, bool bIsToRGB = true);

View File

@ -26,10 +26,7 @@ THE SOFTWARE.
#define __CC_PLATFORM_CONFIG_H__ #define __CC_PLATFORM_CONFIG_H__
/** /**
Config of cocos2d-x project. Config of cocos2d-x project, per target platform.
There are config below:
build for which target platform
*/ */
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -106,10 +103,9 @@ build for which target platform
// check user set platform // check user set platform
#if ! CC_TARGET_PLATFORM #if ! CC_TARGET_PLATFORM
#error "Can not recognize the target platform, compling under a unsupported platform?" #error "Cannot recognize the target platform; are you targeting an unsupported platform?"
#endif #endif
// Check the supportive of platform
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
#pragma warning (disable:4127) #pragma warning (disable:4127)
#endif // CC_PLATFORM_WIN32 #endif // CC_PLATFORM_WIN32

View File

@ -44,14 +44,14 @@ public:
int run(); int run();
/** /**
@brief Get current applicaiton instance. @brief Get the current application instance.
@return Current application instance pointer. @return Current application instance pointer.
*/ */
static CCApplication* sharedApplication(); static CCApplication* sharedApplication();
/** /**
@brief Callback by CCDirector for limit FPS. @brief Callback by CCDirector for limit FPS.
@interval The time, which expressed in second in second, between current frame and next. @interval The time, expressed in seconds, between current frame and next.
*/ */
virtual void setAnimationInterval(double interval); virtual void setAnimationInterval(double interval);

View File

@ -110,7 +110,7 @@ ccLanguageType CCApplication::getCurrentLanguage()
TargetPlatform CCApplication::getTargetPlatform() TargetPlatform CCApplication::getTargetPlatform()
{ {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) // idiom for iOS <= 3.2, otherwise: [UIDevice userInterfaceIdiom] is faster.
{ {
return kTargetIpad; return kTargetIpad;
} }

View File

@ -48,8 +48,7 @@ bool CCEGLView::isOpenGLReady()
bool CCEGLView::setContentScaleFactor(float contentScaleFactor) bool CCEGLView::setContentScaleFactor(float contentScaleFactor)
{ {
// can not enable retina because have used resolution policy assert(m_eResolutionPolicy == kResolutionUnKnown); // cannot enable retina mode
assert(m_eResolutionPolicy == kResolutionUnKnown);
if ([[EAGLView sharedEGLView] respondsToSelector:@selector(setContentScaleFactor:)]) if ([[EAGLView sharedEGLView] respondsToSelector:@selector(setContentScaleFactor:)])
{ {

View File

@ -14,7 +14,7 @@
/** /**
@brief The cocos2d Application. @brief The cocos2d Application.
The reason for implement as private inheritance is to hide some interface call by CCDirector. The reason to implement with private inheritance is to hide some interface details of CCDirector.
*/ */
class AppDelegate : private cocos2d::CCApplication class AppDelegate : private cocos2d::CCApplication
{ {
@ -30,14 +30,14 @@ public:
virtual bool applicationDidFinishLaunching(); virtual bool applicationDidFinishLaunching();
/** /**
@brief The function be called when the application enter background @brief The function is called when the application enters the background
@param the pointer of the application @param the pointer of the application instance
*/ */
virtual void applicationDidEnterBackground(); virtual void applicationDidEnterBackground();
/** /**
@brief The function be called when the application enter foreground @brief The function is called when the application enters the foreground
@param the pointer of the application @param the pointer of the application instance
*/ */
virtual void applicationWillEnterForeground(); virtual void applicationWillEnterForeground();
}; };

View File

@ -6,16 +6,16 @@
class HelloWorld : public cocos2d::CCLayer class HelloWorld : public cocos2d::CCLayer
{ {
public: public:
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone // Method 'init' in cocos2d-x returns bool, instead of 'id' in cocos2d-iphone (an object pointer)
virtual bool init(); virtual bool init();
// there's no 'id' in cpp, so we recommand to return the exactly class pointer // there's no 'id' in cpp, so we recommend to return the class instance pointer
static cocos2d::CCScene* scene(); static cocos2d::CCScene* scene();
// a selector callback // a selector callback
void menuCloseCallback(CCObject* pSender); void menuCloseCallback(CCObject* pSender);
// implement the "static node()" method manually // preprocessor macro for "static create()" constructor ( node() deprecated )
CREATE_FUNC(HelloWorld); CREATE_FUNC(HelloWorld);
}; };