mirror of https://github.com/axmolengine/axmol.git
issue #6: implement some function
This commit is contained in:
parent
52ace69f09
commit
a2083303e9
|
@ -34,6 +34,7 @@ THE SOFTWARE.
|
||||||
#include "CCTransition.h"
|
#include "CCTransition.h"
|
||||||
#include "CCTextureCache.h"
|
#include "CCTextureCache.h"
|
||||||
#include "CCTransition.h"
|
#include "CCTransition.h"
|
||||||
|
#include "CCSpriteFrameCache.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -234,42 +235,16 @@ void CCDirector::calculateDeltaTime(void)
|
||||||
m_sLastUpdate = now;
|
m_sLastUpdate = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
// attribute
|
|
||||||
|
|
||||||
// m_pRunningScene
|
|
||||||
CCScene* CCDirector::getRunningScene(void)
|
|
||||||
{
|
|
||||||
return m_pRunningScene;
|
|
||||||
}
|
|
||||||
|
|
||||||
// m_dAnimationInterval
|
// m_dAnimationInterval
|
||||||
double CCDirector::getAnimationInterval(void)
|
|
||||||
{
|
|
||||||
return m_dAnimationInterval;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCDirector::setAnimationInterval(double dValue)
|
void CCDirector::setAnimationInterval(double dValue)
|
||||||
{
|
{
|
||||||
CCLOG("cocos2d: Director#setAnimationInterval. Overrride me");
|
CCLOG("cocos2d: Director#setAnimationInterval. Overrride me");
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_bDisplayFPS
|
|
||||||
bool CCDirector::isDisplayFPS(void)
|
|
||||||
{
|
|
||||||
return m_bDisplayFPS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCDirector::setDisplayFPS(bool bDisplayFPS)
|
|
||||||
{
|
|
||||||
m_bDisplayFPS = bDisplayFPS;
|
|
||||||
}
|
|
||||||
|
|
||||||
// m_pobOpenGLView
|
// m_pobOpenGLView
|
||||||
CCXEGLView* CCDirector::getOpenGLView(void)
|
|
||||||
{
|
|
||||||
return m_pobOpenGLView;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCDirector::setOpenGLView(CCXEGLView *pobOpenGLView)
|
void CCDirector::setOpenGLView(CCXEGLView *pobOpenGLView)
|
||||||
{
|
{
|
||||||
|
@ -294,24 +269,6 @@ void CCDirector::setOpenGLView(CCXEGLView *pobOpenGLView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_ePixelFormat
|
|
||||||
void CCDirector::setPixelFormat(tPixelFormat kPixelFormat)
|
|
||||||
{
|
|
||||||
assert(! isOpenGLAttached());
|
|
||||||
m_ePixelFormat = kPixelFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
tPixelFormat CCDirector::getPiexFormat(void)
|
|
||||||
{
|
|
||||||
return m_ePixelFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
// m_bNextDeltaTimeZero
|
|
||||||
bool CCDirector::isNextDeltaTimeZero(void)
|
|
||||||
{
|
|
||||||
return m_bNextDeltaTimeZero;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCDirector::setNextDeltaTimeZero(bool bNextDeltaTimeZero)
|
void CCDirector::setNextDeltaTimeZero(bool bNextDeltaTimeZero)
|
||||||
{
|
{
|
||||||
m_bNextDeltaTimeZero = bNextDeltaTimeZero;
|
m_bNextDeltaTimeZero = bNextDeltaTimeZero;
|
||||||
|
@ -346,18 +303,6 @@ void CCDirector::setDeviceOrientation(ccDeviceOrientation kDeviceOrientation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_bPaused
|
|
||||||
bool CCDirector::isPaused(void)
|
|
||||||
{
|
|
||||||
return m_bPaused;
|
|
||||||
}
|
|
||||||
|
|
||||||
// m_eProjection
|
|
||||||
ccDirectorProjection CCDirector::getProjection(void)
|
|
||||||
{
|
|
||||||
return m_eProjection;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCDirector::setProjection(ccDirectorProjection kProjection)
|
void CCDirector::setProjection(ccDirectorProjection kProjection)
|
||||||
{
|
{
|
||||||
CGSize size = m_obSurfaceSize;
|
CGSize size = m_obSurfaceSize;
|
||||||
|
@ -396,39 +341,11 @@ void CCDirector::setProjection(ccDirectorProjection kProjection)
|
||||||
m_eProjection = kProjection;
|
m_eProjection = kProjection;
|
||||||
}
|
}
|
||||||
|
|
||||||
ccDeviceOrientation CCDirector::getDeviceOrientation(void)
|
|
||||||
{
|
|
||||||
return m_eDeviceOrientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
// m_bSendCleanupToScene
|
|
||||||
bool CCDirector::isSendCleanupToScene(void)
|
|
||||||
{
|
|
||||||
return m_bSendCleanupToScene;
|
|
||||||
}
|
|
||||||
|
|
||||||
// m_fContentScaleFactor
|
|
||||||
CGFloat CCDirector::getContentScaleFactor(void)
|
|
||||||
{
|
|
||||||
return m_fContentScaleFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCDirector::setContentScaleFactor(CGFloat obCGFloatValue)
|
|
||||||
{
|
|
||||||
m_fContentScaleFactor = obCGFloatValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCDirector::setDepthBufferFormat(tDepthBufferFormat kDepthBufferFormat)
|
|
||||||
{
|
|
||||||
assert(! isOpenGLAttached());
|
|
||||||
m_eDepthBufferFormat = kDepthBufferFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCDirector::purgeCachedData(void)
|
void CCDirector::purgeCachedData(void)
|
||||||
{
|
{
|
||||||
///@todo add needed source
|
///@todo add needed source
|
||||||
// CCBitmapFontAtlas::purgeCacheData();
|
// CCBitmapFontAtlas::purgeCacheData();
|
||||||
// CCSpriteFrameCache::purgeSharedSpriteFrameCache();
|
CCSpriteFrameCache::purgeSharedSpriteFrameCache();
|
||||||
CCTextureCache::purgeSharedTextureCache();
|
CCTextureCache::purgeSharedTextureCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -737,8 +654,8 @@ void CCDirector::end(void)
|
||||||
|
|
||||||
// purge all managers
|
// purge all managers
|
||||||
///@todo: implement
|
///@todo: implement
|
||||||
// CCSpriteFrameCache::purgeSharedSpriteFrameCache();
|
CCSpriteFrameCache::purgeSharedSpriteFrameCache();
|
||||||
// CCScheduler::purgeSharedScheduler();
|
CCScheduler::purgeSharedScheduler();
|
||||||
// CCActionManager::purgeSharedManager();
|
// CCActionManager::purgeSharedManager();
|
||||||
CCTextureCache::purgeSharedTextureCache();
|
CCTextureCache::purgeSharedTextureCache();
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,10 @@ THE SOFTWARE.
|
||||||
#include "cocoa/NSMutableArray.h"
|
#include "cocoa/NSMutableArray.h"
|
||||||
#include "cocoa/CGGeometry.h"
|
#include "cocoa/CGGeometry.h"
|
||||||
#include "CCXEGLView.h"
|
#include "CCXEGLView.h"
|
||||||
#include "platform/platform.h"
|
|
||||||
#include "ccxCommon.h"
|
#include "ccxCommon.h"
|
||||||
|
#include "platform/platform.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
// OpenGL related
|
// OpenGL related
|
||||||
// #include "support/CCXEGLView.h"
|
// #include "support/CCXEGLView.h"
|
||||||
|
@ -173,6 +175,7 @@ typedef enum {
|
||||||
class CCLabelAtlas;
|
class CCLabelAtlas;
|
||||||
class CCScene;
|
class CCScene;
|
||||||
class cocos2d::CCXEGLView;
|
class cocos2d::CCXEGLView;
|
||||||
|
struct cc_timeval;
|
||||||
|
|
||||||
/**Class that creates and handle the main Window and manages how
|
/**Class that creates and handle the main Window and manages how
|
||||||
and when to execute the Scenes.
|
and when to execute the Scenes.
|
||||||
|
@ -203,38 +206,35 @@ public:
|
||||||
// attribute
|
// attribute
|
||||||
|
|
||||||
// The current running Scene. Director can only run one Scene at the time
|
// The current running Scene. Director can only run one Scene at the time
|
||||||
CCScene* getRunningScene(void);
|
inline CCScene* getRunningScene(void) { return m_pRunningScene; }
|
||||||
|
|
||||||
// The FPS value
|
// The FPS value
|
||||||
double getAnimationInterval(void);
|
inline double getAnimationInterval(void) { return m_dAnimationInterval; }
|
||||||
virtual void setAnimationInterval(double dValue);
|
virtual void setAnimationInterval(double dValue);
|
||||||
|
|
||||||
// Whether or not to display the FPS on the bottom-left corner
|
// Whether or not to display the FPS on the bottom-left corner
|
||||||
bool isDisplayFPS(void);
|
inline bool isDisplayFPS(void) { return m_bDisplayFPS; }
|
||||||
void setDisplayFPS(bool bDisplayFPS);
|
inline void setDisplayFPS(bool bDisplayFPS) { m_bDisplayFPS = bDisplayFPS; }
|
||||||
|
|
||||||
// The CCXEGLView, where everything is rendered
|
// The CCXEGLView, where everything is rendered
|
||||||
cocos2d::CCXEGLView* getOpenGLView(void);
|
inline cocos2d::CCXEGLView* getOpenGLView(void) { return m_pobOpenGLView; }
|
||||||
void setOpenGLView(cocos2d::CCXEGLView *pobOpenGLView);
|
void setOpenGLView(cocos2d::CCXEGLView *pobOpenGLView);
|
||||||
|
|
||||||
// Pixel format used to create the context
|
|
||||||
tPixelFormat getPiexFormat(void);
|
|
||||||
|
|
||||||
// whether or not the next delta time will be zero
|
// whether or not the next delta time will be zero
|
||||||
bool isNextDeltaTimeZero(void);
|
inline bool isNextDeltaTimeZero(void) { return m_bNextDeltaTimeZero; }
|
||||||
void setNextDeltaTimeZero(bool bNextDeltaTimeZero);
|
void setNextDeltaTimeZero(bool bNextDeltaTimeZero);
|
||||||
|
|
||||||
// The device orientattion
|
// The device orientattion
|
||||||
ccDeviceOrientation getDeviceOrientation(void);
|
inline ccDeviceOrientation getDeviceOrientation(void) { return m_eDeviceOrientation; }
|
||||||
void setDeviceOrientation(ccDeviceOrientation kDeviceOrientation);
|
void setDeviceOrientation(ccDeviceOrientation kDeviceOrientation);
|
||||||
|
|
||||||
// Whether or not the Director is paused
|
// Whether or not the Director is paused
|
||||||
bool isPaused(void);
|
inline bool isPaused(void) { return m_bPaused; }
|
||||||
|
|
||||||
/** Sets an OpenGL projection
|
/** Sets an OpenGL projection
|
||||||
@since v0.8.2
|
@since v0.8.2
|
||||||
*/
|
*/
|
||||||
ccDirectorProjection getProjection(void);
|
inline ccDirectorProjection getProjection(void) { return m_eProjection; }
|
||||||
void setProjection(ccDirectorProjection kProjection);
|
void setProjection(ccDirectorProjection kProjection);
|
||||||
|
|
||||||
/** Whether or not the replaced scene will receive the cleanup message.
|
/** Whether or not the replaced scene will receive the cleanup message.
|
||||||
|
@ -242,15 +242,19 @@ public:
|
||||||
If the new scene replaces the old one, the it will receive the "cleanup" message.
|
If the new scene replaces the old one, the it will receive the "cleanup" message.
|
||||||
@since v0.99.0
|
@since v0.99.0
|
||||||
*/
|
*/
|
||||||
bool isSendCleanupToScene(void);
|
inline bool isSendCleanupToScene(void) { return m_bSendCleanupToScene; }
|
||||||
|
|
||||||
/** The size in pixels of the surface. It could be different than the screen size.
|
/** The size in pixels of the surface. It could be different than the screen size.
|
||||||
High-res devices might have a higher surface size than the screen size.
|
High-res devices might have a higher surface size than the screen size.
|
||||||
Only available when compiled using SDK >= 4.0.
|
Only available when compiled using SDK >= 4.0.
|
||||||
@since v0.99.4
|
@since v0.99.4
|
||||||
*/
|
*/
|
||||||
CGFloat getContentScaleFactor(void);
|
inline void setContentScaleFactor(CGFloat obCGFloatValue)
|
||||||
void setContentScaleFactor(CGFloat obCGFloatValue);
|
{
|
||||||
|
assert(! isOpenGLAttached());
|
||||||
|
m_fContentScaleFactor = obCGFloatValue;
|
||||||
|
}
|
||||||
|
inline CGFloat getContentScaleFactor(void) { return m_fContentScaleFactor; }
|
||||||
|
|
||||||
// UI dependent
|
// UI dependent
|
||||||
|
|
||||||
|
@ -260,7 +264,13 @@ public:
|
||||||
|
|
||||||
@deprecated Set the pixel format when creating the CCXEGLView. This method will be removed in v1.0
|
@deprecated Set the pixel format when creating the CCXEGLView. This method will be removed in v1.0
|
||||||
*/
|
*/
|
||||||
void setPixelFormat(tPixelFormat kPixelFormat);
|
inline void setPixelFormat(tPixelFormat kPixelFormat)
|
||||||
|
{
|
||||||
|
assert(! isOpenGLAttached());
|
||||||
|
m_ePixelFormat = kPixelFormat;
|
||||||
|
}
|
||||||
|
// Pixel format used to create the context
|
||||||
|
inline tPixelFormat getPiexFormat(void) { return m_ePixelFormat; }
|
||||||
|
|
||||||
/** Change depth buffer format of the render buffer.
|
/** Change depth buffer format of the render buffer.
|
||||||
Call this class method before attaching it to a UIWindow/UIView
|
Call this class method before attaching it to a UIWindow/UIView
|
||||||
|
@ -268,7 +278,11 @@ public:
|
||||||
|
|
||||||
@deprecated Set the depth buffer format when creating the CCXEGLView. This method will be removed in v1.0
|
@deprecated Set the depth buffer format when creating the CCXEGLView. This method will be removed in v1.0
|
||||||
*/
|
*/
|
||||||
void setDepthBufferFormat(tDepthBufferFormat kDepthBufferFormat);
|
inline void setDepthBufferFormat(tDepthBufferFormat kDepthBufferFormat)
|
||||||
|
{
|
||||||
|
assert(! isOpenGLAttached());
|
||||||
|
m_eDepthBufferFormat = kDepthBufferFormat;
|
||||||
|
}
|
||||||
|
|
||||||
// Integration with UI
|
// Integration with UI
|
||||||
/** detach the cocos2d view from the view/window */
|
/** detach the cocos2d view from the view/window */
|
||||||
|
|
|
@ -583,3 +583,8 @@ void CCScheduler::tick(ccTime dt)
|
||||||
|
|
||||||
m_pCurrentTarget = NULL;
|
m_pCurrentTarget = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCScheduler::purgeSharedScheduler(void)
|
||||||
|
{
|
||||||
|
pSharedScheduler->release();
|
||||||
|
}
|
||||||
|
|
|
@ -39,8 +39,8 @@ public:
|
||||||
CCTimer(void) {}
|
CCTimer(void) {}
|
||||||
|
|
||||||
// interval in seconds
|
// interval in seconds
|
||||||
ccTime getInterval(void);
|
inline ccTime getInterval(void) { return m_fInterval; }
|
||||||
void setInterval(ccTime fInterval);
|
inline void setInterval(ccTime fInterval){ m_fInterval = fInterval; }
|
||||||
|
|
||||||
// Initializes a timer with a target and a selector.
|
// Initializes a timer with a target and a selector.
|
||||||
CCTimer* initWithTarget(SelectorProtocol *pTarget, SEL_SCHEDULE pfnSelector);
|
CCTimer* initWithTarget(SelectorProtocol *pTarget, SEL_SCHEDULE pfnSelector);
|
||||||
|
@ -98,8 +98,8 @@ public:
|
||||||
@since v0.8
|
@since v0.8
|
||||||
@warning It will affect EVERY scheduled selector / action.
|
@warning It will affect EVERY scheduled selector / action.
|
||||||
*/
|
*/
|
||||||
ccTime getTimeScale(void);
|
inline ccTime getTimeScale(void) { return m_fTimeScale; }
|
||||||
void setTimeScale(ccTime fTimeScale);
|
inline void setTimeScale(ccTime fTimeScale) { m_fTimeScale = fTimeScale; }
|
||||||
|
|
||||||
/** 'tick' the scheduler.
|
/** 'tick' the scheduler.
|
||||||
You should NEVER call this method, unless you know what you are doing.
|
You should NEVER call this method, unless you know what you are doing.
|
||||||
|
|
Loading…
Reference in New Issue