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_fContentScaleFactor = 1;
m_fContentScaleFactor = 1.0f;
m_bIsContentScaleSupported = false;
// scheduler
@ -200,7 +200,7 @@ void CCDirector::setGLDefaultValues(void)
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
}
// Draw the SCene
// Draw the Scene
void CCDirector::drawScene(void)
{
// calculate "global" dt
@ -290,16 +290,13 @@ void CCDirector::calculateDeltaTime(void)
*m_pLastUpdate = now;
}
// m_pobOpenGLView
void CCDirector::setOpenGLView(CCEGLView *pobOpenGLView)
{
CCAssert(pobOpenGLView, "opengl view should not be null");
if (m_pobOpenGLView != pobOpenGLView)
{
// because EAGLView is not kind of CCObject
// EAGLView is not a CCObject
delete m_pobOpenGLView; // [openGLView_ release]
m_pobOpenGLView = pobOpenGLView;
@ -942,7 +939,7 @@ CCAccelerometer* CCDirector::getAccelerometer()
* implementation of DisplayLinkDirector
**************************************************/
// should we afford 4 types of director ??
// should we implement 4 types of director ??
// I think DisplayLinkDirector is enough
// so we now only support DisplayLinkDirector
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 buffer depth (default one is 0-bit)
- 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:
_ CCDirector::sharedDirector()->methodName();

View File

@ -681,7 +681,7 @@ void CCNode::sortAllChildren()
{
//CCAssert(0);
// 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
}

View File

@ -46,7 +46,7 @@ public:
/**
@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;

View File

@ -77,14 +77,14 @@ public:
virtual CCPoint getVisibleOrigin() const;
/**
* Set the design resolutin size.
* You can't use it with enableRetina together.
* Set the design resolution size.
* Behavior undefined when enableRetina == true.
* @param width Design resolution width.
* @param height Design resolution height.
* @param resolutionPolicy The resolution policy you need, there are:
* [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.
* [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.
* [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;
* @param resolutionPolicy The resolution policy desired, you may choose:
* [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 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 to height is different from the screen resolution ratio, two black borders will be shown.
*/
virtual void setDesignResolutionSize(float width, float height, ResolutionPolicy resolutionPolicy);
@ -93,7 +93,7 @@ public:
/**
* 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);
@ -113,30 +113,29 @@ public:
*/
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 handleTouchesMove(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[]);
/**
* Get opengl view port rectangle.
* Get the opengl view port rectangle.
*/
const CCRect& getViewPortRect() const;
/**
* Get the scale factor of horizontal direction.
*
* Get scale factor of the horizontal direction.
*/
float getScaleX() const;
/**
* Get the scale factor of vertical direction.
* Get scale factor of the vertical direction.
*/
float getScaleY() const;
/**
* Get whether the retina mode is enabled.
* Get retina mode status (on if true).
*/
bool isRetinaEnabled() const;
private:
@ -145,9 +144,9 @@ private:
protected:
EGLTouchDelegate* m_pDelegate;
// real size of screen
// real screen size
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;
// the view port size
CCRect m_obViewPortRect;

View File

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

View File

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

View File

@ -26,10 +26,7 @@ THE SOFTWARE.
#define __CC_PLATFORM_CONFIG_H__
/**
Config of cocos2d-x project.
There are config below:
build for which target platform
Config of cocos2d-x project, per target platform.
*/
//////////////////////////////////////////////////////////////////////////
@ -106,10 +103,9 @@ build for which target platform
// check user set 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
// Check the supportive of platform
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
#pragma warning (disable:4127)
#endif // CC_PLATFORM_WIN32

View File

@ -44,14 +44,14 @@ public:
int run();
/**
@brief Get current applicaiton instance.
@brief Get the current application instance.
@return Current application instance pointer.
*/
static CCApplication* sharedApplication();
/**
@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);

View File

@ -110,7 +110,7 @@ ccLanguageType CCApplication::getCurrentLanguage()
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;
}

View File

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

View File

@ -14,7 +14,7 @@
/**
@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
{
@ -30,14 +30,14 @@ public:
virtual bool applicationDidFinishLaunching();
/**
@brief The function be called when the application enter background
@param the pointer of the application
@brief The function is called when the application enters the background
@param the pointer of the application instance
*/
virtual void applicationDidEnterBackground();
/**
@brief The function be called when the application enter foreground
@param the pointer of the application
@brief The function is called when the application enters the foreground
@param the pointer of the application instance
*/
virtual void applicationWillEnterForeground();
};

View File

@ -6,16 +6,16 @@
class HelloWorld : public cocos2d::CCLayer
{
public:
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();
// Method 'init' in cocos2d-x returns bool, instead of 'id' in cocos2d-iphone (an object pointer)
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();
// a selector callback
void menuCloseCallback(CCObject* pSender);
// implement the "static node()" method manually
// preprocessor macro for "static create()" constructor ( node() deprecated )
CREATE_FUNC(HelloWorld);
};