mirror of https://github.com/axmolengine/axmol.git
fixed #452: refactor CCDirector CCNode CCGrid
This commit is contained in:
parent
d4dbedca4d
commit
37bb33d9e5
|
@ -21,6 +21,7 @@ actions/CCActionPageTurn3D.cpp \
|
||||||
actions/CCActionProgressTimer.cpp \
|
actions/CCActionProgressTimer.cpp \
|
||||||
actions/CCActionTiledGrid.cpp \
|
actions/CCActionTiledGrid.cpp \
|
||||||
base_nodes/CCAtlasNode.cpp \
|
base_nodes/CCAtlasNode.cpp \
|
||||||
|
base_nodes/CCNode.cpp \
|
||||||
cocoa/CCAffineTransform.cpp \
|
cocoa/CCAffineTransform.cpp \
|
||||||
cocoa/CCGeometry.cpp \
|
cocoa/CCGeometry.cpp \
|
||||||
cocoa/CCAutoreleasePool.cpp \
|
cocoa/CCAutoreleasePool.cpp \
|
||||||
|
@ -30,7 +31,9 @@ cocoa/CCObject.cpp \
|
||||||
cocoa/CCSet.cpp \
|
cocoa/CCSet.cpp \
|
||||||
cocoa/CCZone.cpp \
|
cocoa/CCZone.cpp \
|
||||||
cocos2d.cpp \
|
cocos2d.cpp \
|
||||||
|
CCDirector.cpp \
|
||||||
effects/CCGrabber.cpp \
|
effects/CCGrabber.cpp \
|
||||||
|
effects/CCGrid.cpp \
|
||||||
keypad_dispatcher/CCKeypadDelegate.cpp \
|
keypad_dispatcher/CCKeypadDelegate.cpp \
|
||||||
keypad_dispatcher/CCKeypadDispatcher.cpp \
|
keypad_dispatcher/CCKeypadDispatcher.cpp \
|
||||||
label_nodes/CCLabelAtlas.cpp \
|
label_nodes/CCLabelAtlas.cpp \
|
||||||
|
@ -50,10 +53,7 @@ particle_nodes/CCParticleExamples.cpp \
|
||||||
particle_nodes/CCParticleSystem.cpp \
|
particle_nodes/CCParticleSystem.cpp \
|
||||||
particle_nodes/CCParticleSystemPoint.cpp \
|
particle_nodes/CCParticleSystemPoint.cpp \
|
||||||
particle_nodes/CCParticleSystemQuad.cpp \
|
particle_nodes/CCParticleSystemQuad.cpp \
|
||||||
platform/CCDirector_mobile.cpp \
|
|
||||||
platform/CCFileUtils.cpp \
|
platform/CCFileUtils.cpp \
|
||||||
platform/CCGrid_mobile.cpp \
|
|
||||||
platform/CCNode_mobile.cpp \
|
|
||||||
platform/CCGL.cpp \
|
platform/CCGL.cpp \
|
||||||
platform/CCImage.cpp \
|
platform/CCImage.cpp \
|
||||||
platform/CCStdC.cpp \
|
platform/CCStdC.cpp \
|
||||||
|
|
|
@ -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
|
// m_pobOpenGLView
|
||||||
|
|
||||||
void CCDirector::setOpenGLView(CC_GLVIEW *pobOpenGLView)
|
void CCDirector::setOpenGLView(CC_GLVIEW *pobOpenGLView)
|
||||||
|
@ -411,11 +403,6 @@ CCPoint CCDirector::convertToGL(CCPoint obPoint)
|
||||||
ret.y = newX;
|
ret.y = newX;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (m_fContentScaleFactor != 1 && m_bIsContentScaleSupported)
|
|
||||||
// {
|
|
||||||
// ret = ccpMult(ret, m_fContentScaleFactor);
|
|
||||||
// }
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -662,24 +649,6 @@ void CCDirector::resume(void)
|
||||||
m_fDeltaTime = 0;
|
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
|
#if CC_DIRECTOR_FAST_FPS
|
||||||
// display the FPS using a LabelAtlas
|
// display the FPS using a LabelAtlas
|
||||||
// updates the FPS every frame
|
// 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
|
* implementation of DisplayLinkDirector
|
||||||
**************************************************/
|
**************************************************/
|
|
@ -178,7 +178,6 @@ typedef enum {
|
||||||
class CCLabelTTF;
|
class CCLabelTTF;
|
||||||
class CCScene;
|
class CCScene;
|
||||||
class CCEGLView;
|
class CCEGLView;
|
||||||
class CCEvent;
|
|
||||||
class CCNode;
|
class CCNode;
|
||||||
class CCProjectionProtocol;
|
class CCProjectionProtocol;
|
||||||
|
|
||||||
|
@ -217,7 +216,7 @@ public:
|
||||||
/** Get the FPS value */
|
/** Get the FPS value */
|
||||||
inline double getAnimationInterval(void) { return m_dAnimationInterval; }
|
inline double getAnimationInterval(void) { return m_dAnimationInterval; }
|
||||||
/** Set the FPS value. */
|
/** 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 */
|
/** Whether or not to display the FPS on the bottom-left corner */
|
||||||
inline bool isDisplayFPS(void) { return m_bDisplayFPS; }
|
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.
|
/** 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.
|
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.
|
/** The main loop is triggered again.
|
||||||
Call this function only if [stopAnimation] was called earlier
|
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
|
@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.
|
/** Draw the scene.
|
||||||
This method is called every frame. Don't call it manually.
|
This method is called every frame. Don't call it manually.
|
||||||
|
@ -361,16 +360,11 @@ public:
|
||||||
/** enables/disables OpenGL depth test */
|
/** enables/disables OpenGL depth test */
|
||||||
void setDepthTest(bool bOn);
|
void setDepthTest(bool bOn);
|
||||||
|
|
||||||
virtual void mainLoop(void);
|
virtual void mainLoop(void) = 0;
|
||||||
|
|
||||||
// Profiler
|
// Profiler
|
||||||
void showProfilers(void);
|
void showProfilers(void);
|
||||||
|
|
||||||
|
|
||||||
/***************************************************
|
|
||||||
* mobile platforms specific functions
|
|
||||||
**************************************************/
|
|
||||||
|
|
||||||
/** rotates the screen if an orientation different than Portrait is used */
|
/** rotates the screen if an orientation different than Portrait is used */
|
||||||
void applyOrientation(void);
|
void applyOrientation(void);
|
||||||
|
|
||||||
|
@ -431,31 +425,12 @@ public:
|
||||||
/** detach the cocos2d view from the view/window */
|
/** detach the cocos2d view from the view/window */
|
||||||
bool detach(void);
|
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:
|
public:
|
||||||
/** returns a shared instance of the director */
|
/** returns a shared instance of the director */
|
||||||
static CCDirector* sharedDirector(void);
|
static CCDirector* sharedDirector(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/***************************************************
|
|
||||||
* mobile platforms specific functions
|
|
||||||
**************************************************/
|
|
||||||
void purgeDirector();
|
void purgeDirector();
|
||||||
bool m_bPurgeDirecotorInNextLoop; // this flag will be set to true in end()
|
bool m_bPurgeDirecotorInNextLoop; // this flag will be set to true in end()
|
||||||
|
|
||||||
|
@ -535,9 +510,6 @@ protected:
|
||||||
/* Projection protocol delegate */
|
/* Projection protocol delegate */
|
||||||
CCProjectionProtocol *m_pProjectionDelegate;
|
CCProjectionProtocol *m_pProjectionDelegate;
|
||||||
|
|
||||||
/***************************************************
|
|
||||||
* mobile platforms specific members
|
|
||||||
**************************************************/
|
|
||||||
/* The device orientation */
|
/* The device orientation */
|
||||||
ccDeviceOrientation m_eDeviceOrientation;
|
ccDeviceOrientation m_eDeviceOrientation;
|
||||||
/* contentScaleFactor could be simulated */
|
/* contentScaleFactor could be simulated */
|
||||||
|
@ -546,20 +518,7 @@ protected:
|
||||||
tPixelFormat m_ePixelFormat;
|
tPixelFormat m_ePixelFormat;
|
||||||
tDepthBufferFormat m_eDepthBufferFormat;
|
tDepthBufferFormat m_eDepthBufferFormat;
|
||||||
|
|
||||||
/***************************************************
|
bool m_bRetinaDisplay;
|
||||||
* 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;
|
|
||||||
|
|
||||||
#if CC_ENABLE_PROFILERS
|
#if CC_ENABLE_PROFILERS
|
||||||
ccTime m_fAccumDtForProfiler;
|
ccTime m_fAccumDtForProfiler;
|
||||||
|
|
|
@ -191,6 +191,10 @@
|
||||||
RelativePath="..\base_nodes\CCAtlasNode.cpp"
|
RelativePath="..\base_nodes\CCAtlasNode.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\base_nodes\CCNode.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="cocoa"
|
Name="cocoa"
|
||||||
|
@ -243,6 +247,10 @@
|
||||||
RelativePath="..\effects\CCGrabber.h"
|
RelativePath="..\effects\CCGrabber.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\effects\CCGrid.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\effects\CCGrid.h"
|
RelativePath="..\effects\CCGrid.h"
|
||||||
>
|
>
|
||||||
|
@ -727,10 +735,6 @@
|
||||||
RelativePath="..\platform\CCCommon.h"
|
RelativePath="..\platform\CCCommon.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\platform\CCDirector_mobile.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\platform\CCEGLView_platform.h"
|
RelativePath="..\platform\CCEGLView_platform.h"
|
||||||
>
|
>
|
||||||
|
@ -751,10 +755,6 @@
|
||||||
RelativePath="..\platform\CCGL.h"
|
RelativePath="..\platform\CCGL.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\platform\CCGrid_mobile.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\platform\CCImage.cpp"
|
RelativePath="..\platform\CCImage.cpp"
|
||||||
>
|
>
|
||||||
|
@ -767,10 +767,6 @@
|
||||||
RelativePath="..\platform\CCLibxml2.h"
|
RelativePath="..\platform\CCLibxml2.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\platform\CCNode_mobile.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\platform\CCPlatformConfig.h"
|
RelativePath="..\platform\CCPlatformConfig.h"
|
||||||
>
|
>
|
||||||
|
@ -1056,6 +1052,10 @@
|
||||||
RelativePath="..\CCConfiguration.h"
|
RelativePath="..\CCConfiguration.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\CCDirector.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\CCDrawingPrimitives.cpp"
|
RelativePath="..\CCDrawingPrimitives.cpp"
|
||||||
>
|
>
|
||||||
|
|
|
@ -240,6 +240,10 @@
|
||||||
RelativePath="..\base_nodes\CCAtlasNode.cpp"
|
RelativePath="..\base_nodes\CCAtlasNode.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\base_nodes\CCNode.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="effects"
|
Name="effects"
|
||||||
|
@ -252,6 +256,10 @@
|
||||||
RelativePath="..\effects\CCGrabber.h"
|
RelativePath="..\effects\CCGrabber.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\effects\CCGrid.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\effects\CCGrid.h"
|
RelativePath="..\effects\CCGrid.h"
|
||||||
>
|
>
|
||||||
|
@ -916,10 +924,6 @@
|
||||||
RelativePath="..\platform\CCCommon.h"
|
RelativePath="..\platform\CCCommon.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\platform\CCDirector_mobile.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\platform\CCEGLView_platform.h"
|
RelativePath="..\platform\CCEGLView_platform.h"
|
||||||
>
|
>
|
||||||
|
@ -940,10 +944,6 @@
|
||||||
RelativePath="..\platform\CCGL.h"
|
RelativePath="..\platform\CCGL.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\platform\CCGrid_mobile.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\platform\CCImage.cpp"
|
RelativePath="..\platform\CCImage.cpp"
|
||||||
>
|
>
|
||||||
|
@ -956,10 +956,6 @@
|
||||||
RelativePath="..\platform\CCLibxml2.h"
|
RelativePath="..\platform\CCLibxml2.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\platform\CCNode_mobile.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\platform\CCPlatformConfig.h"
|
RelativePath="..\platform\CCPlatformConfig.h"
|
||||||
>
|
>
|
||||||
|
@ -1077,6 +1073,10 @@
|
||||||
RelativePath="..\CCConfiguration.h"
|
RelativePath="..\CCConfiguration.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\CCDirector.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\CCDrawingPrimitives.cpp"
|
RelativePath="..\CCDrawingPrimitives.cpp"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue