fixed #452: refactor CCDirector CCNode CCGrid

This commit is contained in:
minggo 2011-04-11 15:10:09 +08:00
parent d4dbedca4d
commit 37bb33d9e5
7 changed files with 33 additions and 144 deletions

View File

@ -21,6 +21,7 @@ actions/CCActionPageTurn3D.cpp \
actions/CCActionProgressTimer.cpp \
actions/CCActionTiledGrid.cpp \
base_nodes/CCAtlasNode.cpp \
base_nodes/CCNode.cpp \
cocoa/CCAffineTransform.cpp \
cocoa/CCGeometry.cpp \
cocoa/CCAutoreleasePool.cpp \
@ -30,7 +31,9 @@ cocoa/CCObject.cpp \
cocoa/CCSet.cpp \
cocoa/CCZone.cpp \
cocos2d.cpp \
CCDirector.cpp \
effects/CCGrabber.cpp \
effects/CCGrid.cpp \
keypad_dispatcher/CCKeypadDelegate.cpp \
keypad_dispatcher/CCKeypadDispatcher.cpp \
label_nodes/CCLabelAtlas.cpp \
@ -50,10 +53,7 @@ particle_nodes/CCParticleExamples.cpp \
particle_nodes/CCParticleSystem.cpp \
particle_nodes/CCParticleSystemPoint.cpp \
particle_nodes/CCParticleSystemQuad.cpp \
platform/CCDirector_mobile.cpp \
platform/CCFileUtils.cpp \
platform/CCGrid_mobile.cpp \
platform/CCNode_mobile.cpp \
platform/CCGL.cpp \
platform/CCImage.cpp \
platform/CCStdC.cpp \

View File

@ -262,14 +262,6 @@ void CCDirector::calculateDeltaTime(void)
}
// m_dAnimationInterval
void CCDirector::setAnimationInterval(double dValue)
{
CCLOG("cocos2d: Director#setAnimationInterval. Overrride me");
// assert(0);
}
// m_pobOpenGLView
void CCDirector::setOpenGLView(CC_GLVIEW *pobOpenGLView)
@ -411,11 +403,6 @@ CCPoint CCDirector::convertToGL(CCPoint obPoint)
ret.y = newX;
break;
}
// if (m_fContentScaleFactor != 1 && m_bIsContentScaleSupported)
// {
// ret = ccpMult(ret, m_fContentScaleFactor);
// }
return ret;
}
@ -662,24 +649,6 @@ void CCDirector::resume(void)
m_fDeltaTime = 0;
}
void CCDirector::startAnimation(void)
{
CCLOG("cocos2d: Director#startAnimation. Overrride me");
assert(0);
}
void CCDirector::stopAnimation(void)
{
CCLOG("cocos2d: Director#stopAnimation. Overrride me");
assert(0);
}
void CCDirector::mainLoop(void)
{
CCLOG("cocos2d: Director#preMainLoop. Overrride me");
assert(0);
}
#if CC_DIRECTOR_FAST_FPS
// display the FPS using a LabelAtlas
// updates the FPS every frame
@ -900,45 +869,6 @@ void CCDirector::setDeviceOrientation(ccDeviceOrientation kDeviceOrientation)
}
}
/***************************************************
* PC platforms specific functions, such as mac
**************************************************/
CCPoint CCDirector::convertEventToGL(CCEvent *event)
{
assert(false);
return CCPointZero;
}
bool CCDirector::isFullScreen(void)
{
assert(false);
return false;
}
void CCDirector::setResizeMode(int resizeMode)
{
assert(false);
}
int CCDirector::getResizeMode(void)
{
assert(false);
return -1;
}
void CCDirector::setFullScreen(bool fullscreen)
{
assert(false);
}
CCPoint CCDirector::convertToLogicalCoordinates(CCPoint coordinates)
{
assert(false);
return CCPointZero;
}
/***************************************************
* implementation of DisplayLinkDirector
**************************************************/

View File

@ -178,7 +178,6 @@ typedef enum {
class CCLabelTTF;
class CCScene;
class CCEGLView;
class CCEvent;
class CCNode;
class CCProjectionProtocol;
@ -217,7 +216,7 @@ public:
/** Get the FPS value */
inline double getAnimationInterval(void) { return m_dAnimationInterval; }
/** Set the FPS value. */
virtual void setAnimationInterval(double dValue);
virtual void setAnimationInterval(double dValue) = 0;
/** Whether or not to display the FPS on the bottom-left corner */
inline bool isDisplayFPS(void) { return m_bDisplayFPS; }
@ -329,13 +328,13 @@ public:
/** Stops the animation. Nothing will be drawn. The main loop won't be triggered anymore.
If you don't want to pause your animation call [pause] instead.
*/
virtual void stopAnimation(void);
virtual void stopAnimation(void) = 0;
/** The main loop is triggered again.
Call this function only if [stopAnimation] was called earlier
@warning Don't call this function to start the main loop. To run the main loop call runWithScene
*/
virtual void startAnimation(void);
virtual void startAnimation(void) = 0;
/** Draw the scene.
This method is called every frame. Don't call it manually.
@ -361,16 +360,11 @@ public:
/** enables/disables OpenGL depth test */
void setDepthTest(bool bOn);
virtual void mainLoop(void);
virtual void mainLoop(void) = 0;
// Profiler
void showProfilers(void);
/***************************************************
* mobile platforms specific functions
**************************************************/
/** rotates the screen if an orientation different than Portrait is used */
void applyOrientation(void);
@ -431,31 +425,12 @@ public:
/** detach the cocos2d view from the view/window */
bool detach(void);
/***************************************************
* PC platforms specific functions, such as mac
**************************************************/
CCPoint convertEventToGL(CCEvent *event);
// whether or not the view is in fullscreen mode
bool isFullScreen(void);
// resize mode: with or without scaling
void setResizeMode(int resizeMode);
int getResizeMode(void);
/** Sets the view in fullscreen or window mode */
void setFullScreen(bool fullscreen);
/** Converts window size coordiantes to logical coordinates.
Useful only if resizeMode is kCCDirectorResize_Scale.
If resizeMode is kCCDirectorResize_NoScale, then no conversion will be done.
*/
CCPoint convertToLogicalCoordinates(CCPoint coordinates);
public:
/** returns a shared instance of the director */
static CCDirector* sharedDirector(void);
protected:
/***************************************************
* mobile platforms specific functions
**************************************************/
void purgeDirector();
bool m_bPurgeDirecotorInNextLoop; // this flag will be set to true in end()
@ -535,9 +510,6 @@ protected:
/* Projection protocol delegate */
CCProjectionProtocol *m_pProjectionDelegate;
/***************************************************
* mobile platforms specific members
**************************************************/
/* The device orientation */
ccDeviceOrientation m_eDeviceOrientation;
/* contentScaleFactor could be simulated */
@ -546,20 +518,7 @@ protected:
tPixelFormat m_ePixelFormat;
tDepthBufferFormat m_eDepthBufferFormat;
/***************************************************
* mac platforms specific members
**************************************************/
bool m_bIsFullScreen;
bool m_bRetinaDisplay;
int m_nResizeMode;
CCPoint m_winOffset;
CCSize m_originalWinSize;
MacGLView *m_pFullScreenGLView;
NSWindow *m_pFullScreenWindow;
// cache
MacGLView *m_pWindowGLView;
bool m_bRetinaDisplay;
#if CC_ENABLE_PROFILERS
ccTime m_fAccumDtForProfiler;

View File

@ -191,6 +191,10 @@
RelativePath="..\base_nodes\CCAtlasNode.cpp"
>
</File>
<File
RelativePath="..\base_nodes\CCNode.cpp"
>
</File>
</Filter>
<Filter
Name="cocoa"
@ -243,6 +247,10 @@
RelativePath="..\effects\CCGrabber.h"
>
</File>
<File
RelativePath="..\effects\CCGrid.cpp"
>
</File>
<File
RelativePath="..\effects\CCGrid.h"
>
@ -727,10 +735,6 @@
RelativePath="..\platform\CCCommon.h"
>
</File>
<File
RelativePath="..\platform\CCDirector_mobile.cpp"
>
</File>
<File
RelativePath="..\platform\CCEGLView_platform.h"
>
@ -751,10 +755,6 @@
RelativePath="..\platform\CCGL.h"
>
</File>
<File
RelativePath="..\platform\CCGrid_mobile.cpp"
>
</File>
<File
RelativePath="..\platform\CCImage.cpp"
>
@ -767,10 +767,6 @@
RelativePath="..\platform\CCLibxml2.h"
>
</File>
<File
RelativePath="..\platform\CCNode_mobile.cpp"
>
</File>
<File
RelativePath="..\platform\CCPlatformConfig.h"
>
@ -1056,6 +1052,10 @@
RelativePath="..\CCConfiguration.h"
>
</File>
<File
RelativePath="..\CCDirector.cpp"
>
</File>
<File
RelativePath="..\CCDrawingPrimitives.cpp"
>

View File

@ -240,6 +240,10 @@
RelativePath="..\base_nodes\CCAtlasNode.cpp"
>
</File>
<File
RelativePath="..\base_nodes\CCNode.cpp"
>
</File>
</Filter>
<Filter
Name="effects"
@ -252,6 +256,10 @@
RelativePath="..\effects\CCGrabber.h"
>
</File>
<File
RelativePath="..\effects\CCGrid.cpp"
>
</File>
<File
RelativePath="..\effects\CCGrid.h"
>
@ -916,10 +924,6 @@
RelativePath="..\platform\CCCommon.h"
>
</File>
<File
RelativePath="..\platform\CCDirector_mobile.cpp"
>
</File>
<File
RelativePath="..\platform\CCEGLView_platform.h"
>
@ -940,10 +944,6 @@
RelativePath="..\platform\CCGL.h"
>
</File>
<File
RelativePath="..\platform\CCGrid_mobile.cpp"
>
</File>
<File
RelativePath="..\platform\CCImage.cpp"
>
@ -956,10 +956,6 @@
RelativePath="..\platform\CCLibxml2.h"
>
</File>
<File
RelativePath="..\platform\CCNode_mobile.cpp"
>
</File>
<File
RelativePath="..\platform\CCPlatformConfig.h"
>
@ -1077,6 +1073,10 @@
RelativePath="..\CCConfiguration.h"
>
</File>
<File
RelativePath="..\CCDirector.cpp"
>
</File>
<File
RelativePath="..\CCDrawingPrimitives.cpp"
>