mirror of https://github.com/axmolengine/axmol.git
Merge pull request #771 from dumganhar/gles20-dev
issue #1056: TestCases works ok except Box2dTest and ChipmunkTest.
This commit is contained in:
commit
673a1ca238
|
@ -126,8 +126,10 @@ bool CCDirector::init(void)
|
|||
|
||||
// scheduler
|
||||
m_pScheduler = new CCScheduler();
|
||||
m_pScheduler->retain();
|
||||
// action manager
|
||||
m_pActionManager = new CCActionManager();
|
||||
m_pActionManager->retain();
|
||||
m_pScheduler->scheduleUpdateForTarget(m_pActionManager, kCCActionManagerPriority, false);
|
||||
|
||||
// create autorelease pool
|
||||
|
@ -895,9 +897,12 @@ void CCDirector::setDeviceOrientation(ccDeviceOrientation kDeviceOrientation)
|
|||
|
||||
void CCDirector::setScheduler(CCScheduler* pScheduler)
|
||||
{
|
||||
CC_SAFE_RETAIN(pScheduler);
|
||||
CC_SAFE_RELEASE(m_pScheduler);
|
||||
m_pScheduler = pScheduler;
|
||||
if (m_pScheduler != pScheduler)
|
||||
{
|
||||
CC_SAFE_RETAIN(pScheduler);
|
||||
CC_SAFE_RELEASE(m_pScheduler);
|
||||
m_pScheduler = pScheduler;
|
||||
}
|
||||
}
|
||||
|
||||
CCScheduler* CCDirector::getScheduler()
|
||||
|
|
|
@ -35,12 +35,11 @@ THE SOFTWARE.
|
|||
#include <string.h>
|
||||
#include <cmath>
|
||||
|
||||
NS_CC_BEGIN
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
namespace cocos2d {
|
||||
|
||||
static bool initialized = false;
|
||||
static CCGLProgram *shader_ = NULL;
|
||||
static int colorLocation_ = -1;
|
||||
|
@ -72,7 +71,7 @@ static void lazy_init( void )
|
|||
|
||||
}
|
||||
|
||||
void ccDrawPoint( CCPoint point )
|
||||
void ccDrawPoint( const CCPoint& point )
|
||||
{
|
||||
lazy_init();
|
||||
|
||||
|
@ -126,7 +125,7 @@ void ccDrawPoints( const CCPoint *points, unsigned int numberOfPoints )
|
|||
}
|
||||
|
||||
|
||||
void ccDrawLine( CCPoint origin, CCPoint destination )
|
||||
void ccDrawLine( const CCPoint& origin, const CCPoint& destination )
|
||||
{
|
||||
lazy_init();
|
||||
|
||||
|
@ -182,7 +181,7 @@ void ccDrawPoly( const CCPoint *poli, unsigned int numberOfPoints, bool closePol
|
|||
CC_SAFE_DELETE_ARRAY(newPoli);
|
||||
}
|
||||
|
||||
void ccDrawCircle( CCPoint center, float r, float a, unsigned int segs, bool drawLineToCenter)
|
||||
void ccDrawCircle( const CCPoint& center, float radius, float angle, int segments, bool drawLineToCenter)
|
||||
{
|
||||
lazy_init();
|
||||
|
||||
|
@ -190,22 +189,22 @@ void ccDrawCircle( CCPoint center, float r, float a, unsigned int segs, bool dra
|
|||
if (drawLineToCenter)
|
||||
additionalSegment++;
|
||||
|
||||
const float coef = 2.0f * (float)M_PI/segs;
|
||||
const float coef = 2.0f * (float)M_PI/segments;
|
||||
|
||||
GLfloat *vertices = (GLfloat*)calloc( sizeof(GLfloat)*2*(segs+2), 1);
|
||||
GLfloat *vertices = (GLfloat*)calloc( sizeof(GLfloat)*2*(segments+2), 1);
|
||||
if( ! vertices )
|
||||
return;
|
||||
|
||||
for(unsigned int i = 0;i <= segs; i++) {
|
||||
for(unsigned int i = 0;i <= segments; i++) {
|
||||
float rads = i*coef;
|
||||
GLfloat j = r * cosf(rads + a) + center.x;
|
||||
GLfloat k = r * sinf(rads + a) + center.y;
|
||||
GLfloat j = radius * cosf(rads + angle) + center.x;
|
||||
GLfloat k = radius * sinf(rads + angle) + center.y;
|
||||
|
||||
vertices[i*2] = j;
|
||||
vertices[i*2+1] = k;
|
||||
}
|
||||
vertices[(segs+1)*2] = center.x;
|
||||
vertices[(segs+1)*2+1] = center.y;
|
||||
vertices[(segments+1)*2] = center.x;
|
||||
vertices[(segments+1)*2+1] = center.y;
|
||||
|
||||
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );
|
||||
ccGLUseProgram( shader_->program_ );
|
||||
|
@ -214,12 +213,12 @@ void ccDrawCircle( CCPoint center, float r, float a, unsigned int segs, bool dra
|
|||
glUniform4f( colorLocation_, color_.r, color_.g, color_.b, color_.a );
|
||||
|
||||
glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices);
|
||||
glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) segs+additionalSegment);
|
||||
glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) segments+additionalSegment);
|
||||
|
||||
free( vertices );
|
||||
}
|
||||
|
||||
void ccDrawQuadBezier(CCPoint origin, CCPoint control, CCPoint destination, unsigned int segments)
|
||||
void ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, int segments)
|
||||
{
|
||||
lazy_init();
|
||||
|
||||
|
@ -246,7 +245,7 @@ void ccDrawQuadBezier(CCPoint origin, CCPoint control, CCPoint destination, unsi
|
|||
CC_SAFE_DELETE_ARRAY(vertices);
|
||||
}
|
||||
|
||||
void ccDrawCubicBezier(CCPoint origin, CCPoint control1, CCPoint control2, CCPoint destination, unsigned int segments)
|
||||
void ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, int segments)
|
||||
{
|
||||
lazy_init();
|
||||
|
||||
|
@ -298,4 +297,4 @@ void ccDrawColor4B( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
|
|||
color_.a = a/255.0f;
|
||||
}
|
||||
|
||||
}//namespace cocos2d
|
||||
NS_CC_END
|
||||
|
|
|
@ -211,10 +211,8 @@ void CCTimer::update(ccTime dt)
|
|||
|
||||
// implementation of CCScheduler
|
||||
|
||||
static CCScheduler *pSharedScheduler;
|
||||
|
||||
CCScheduler::CCScheduler(void)
|
||||
: m_fTimeScale(0.0f)
|
||||
: m_fTimeScale(1.0f)
|
||||
, m_pUpdatesNegList(NULL)
|
||||
, m_pUpdates0List(NULL)
|
||||
, m_pUpdatesPosList(NULL)
|
||||
|
@ -223,42 +221,17 @@ CCScheduler::CCScheduler(void)
|
|||
, m_pCurrentTarget(NULL)
|
||||
, m_bCurrentTargetSalvaged(false)
|
||||
, m_pScriptHandlerEntries(NULL)
|
||||
, m_bUpdateHashLocked(false)
|
||||
{
|
||||
CCAssert(pSharedScheduler == NULL, "");
|
||||
|
||||
}
|
||||
|
||||
CCScheduler::~CCScheduler(void)
|
||||
{
|
||||
unscheduleAllSelectors();
|
||||
|
||||
pSharedScheduler = NULL;
|
||||
CC_SAFE_RELEASE(m_pScriptHandlerEntries);
|
||||
}
|
||||
|
||||
|
||||
bool CCScheduler::init(void)
|
||||
{
|
||||
m_fTimeScale = 1.0f;
|
||||
|
||||
// used to trigger CCTimer#update
|
||||
// m_pfnUpdateSelector = &CCScheduler::update;
|
||||
// impMethod = (TICK_IMP) [CCTimer instanceMethodForSelector:updateSelector];
|
||||
|
||||
// updates with priority
|
||||
m_pUpdates0List = NULL;
|
||||
m_pUpdatesNegList = NULL;
|
||||
m_pUpdatesPosList = NULL;
|
||||
m_pHashForUpdates = NULL;
|
||||
|
||||
// selectors with interval
|
||||
m_pCurrentTarget = NULL;
|
||||
m_bCurrentTargetSalvaged = false;
|
||||
m_pHashForSelectors = NULL;
|
||||
m_bUpdateHashLocked = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCScheduler::removeHashElement(_hashSelectorEntry *pElement)
|
||||
{
|
||||
ccArrayFree(pElement->timers);
|
||||
|
|
|
@ -35,8 +35,6 @@ namespace cocos2d {
|
|||
//
|
||||
// singleton stuff
|
||||
//
|
||||
static CCActionManager *gSharedManager = NULL;
|
||||
|
||||
typedef struct _hashElement
|
||||
{
|
||||
struct _ccArray *actions;
|
||||
|
@ -53,7 +51,7 @@ CCActionManager::CCActionManager(void)
|
|||
m_pCurrentTarget(NULL),
|
||||
m_bCurrentTargetSalvaged(false)
|
||||
{
|
||||
CCAssert(gSharedManager == NULL, "");
|
||||
|
||||
}
|
||||
|
||||
CCActionManager::~CCActionManager(void)
|
||||
|
@ -61,16 +59,6 @@ CCActionManager::~CCActionManager(void)
|
|||
CCLOGINFO("cocos2d: deallocing %p", this);
|
||||
|
||||
removeAllActions();
|
||||
|
||||
// ?? do not delete , is it because purgeSharedManager() delete it?
|
||||
gSharedManager = NULL;
|
||||
}
|
||||
|
||||
bool CCActionManager::init(void)
|
||||
{
|
||||
m_pTargets = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// private
|
||||
|
|
|
@ -86,8 +86,11 @@ CCNode::CCNode(void)
|
|||
// set default scheduler and actionManager
|
||||
CCDirector *director = CCDirector::sharedDirector();
|
||||
m_pActionManager = director->getActionManager();
|
||||
m_pActionManager->retain();
|
||||
m_pScheduler = director->getScheduler();
|
||||
m_pScheduler->retain();
|
||||
}
|
||||
|
||||
CCNode::~CCNode(void)
|
||||
{
|
||||
CCLOGINFO( "cocos2d: deallocing" );
|
||||
|
@ -889,9 +892,12 @@ unsigned int CCNode::numberOfRunningActions()
|
|||
|
||||
void CCNode::setShaderProgram(CCGLProgram* pShaderProgram)
|
||||
{
|
||||
CC_SAFE_RETAIN(pShaderProgram);
|
||||
CC_SAFE_RELEASE(m_pShaderProgram);
|
||||
m_pShaderProgram = pShaderProgram;
|
||||
if (m_pShaderProgram != pShaderProgram)
|
||||
{
|
||||
CC_SAFE_RETAIN(pShaderProgram);
|
||||
CC_SAFE_RELEASE(m_pShaderProgram);
|
||||
m_pShaderProgram = pShaderProgram;
|
||||
}
|
||||
}
|
||||
|
||||
CCGLProgram* CCNode::getShaderProgram(void)
|
||||
|
|
|
@ -296,6 +296,16 @@ namespace cocos2d
|
|||
return pRet;
|
||||
}
|
||||
|
||||
|
||||
CCGrid3D::CCGrid3D()
|
||||
: m_pTexCoordinates(NULL)
|
||||
, m_pVertices(NULL)
|
||||
, m_pOriginalVertices(NULL)
|
||||
, m_pIndices(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CCGrid3D::~CCGrid3D(void)
|
||||
{
|
||||
CC_SAFE_FREE(m_pTexCoordinates);
|
||||
|
@ -441,6 +451,15 @@ namespace cocos2d
|
|||
|
||||
// implementation of CCTiledGrid3D
|
||||
|
||||
CCTiledGrid3D::CCTiledGrid3D()
|
||||
: m_pTexCoordinates(NULL)
|
||||
, m_pVertices(NULL)
|
||||
, m_pOriginalVertices(NULL)
|
||||
, m_pIndices(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CCTiledGrid3D::~CCTiledGrid3D(void)
|
||||
{
|
||||
CC_SAFE_FREE(m_pTexCoordinates);
|
||||
|
|
|
@ -98,6 +98,7 @@ namespace cocos2d
|
|||
class CCGrid3D : public CCGridBase
|
||||
{
|
||||
public:
|
||||
CCGrid3D();
|
||||
~CCGrid3D(void);
|
||||
|
||||
/** returns the vertex at a given position */
|
||||
|
@ -129,6 +130,7 @@ namespace cocos2d
|
|||
class CCTiledGrid3D : public CCGridBase
|
||||
{
|
||||
public:
|
||||
CCTiledGrid3D();
|
||||
~CCTiledGrid3D(void);
|
||||
|
||||
/** returns the tile at the given position */
|
||||
|
|
|
@ -46,7 +46,8 @@ THE SOFTWARE.
|
|||
#include "ccTypes.h"
|
||||
#include "ccMacros.h"
|
||||
#include "CCGeometry.h" // for CCPoint
|
||||
namespace cocos2d {
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/** draws a point given x and y coordinate measured in points */
|
||||
void CC_DLL ccDrawPoint( const CCPoint& point );
|
||||
|
@ -62,12 +63,7 @@ void CC_DLL ccDrawLine( const CCPoint& origin, const CCPoint& destination );
|
|||
/** draws a poligon given a pointer to CCPoint coordiantes and the number of vertices measured in points.
|
||||
The polygon can be closed or open
|
||||
*/
|
||||
void CC_DLL ccDrawPoly( const CCPoint *vertices, int numOfVertices, bool closePolygon );
|
||||
|
||||
/** draws a poligon given a pointer to CCPoint coordiantes and the number of vertices measured in points.
|
||||
The polygon can be closed or open and optionally filled with current GL color
|
||||
*/
|
||||
void CC_DLL ccDrawPoly( const CCPoint *vertices, int numOfVertices, bool closePolygon , bool fill);
|
||||
void CC_DLL ccDrawPoly( const CCPoint *vertices, unsigned int numOfVertices, bool closePolygon );
|
||||
|
||||
/** draws a circle given the center, radius and number of segments. */
|
||||
void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, int segments, bool drawLineToCenter);
|
||||
|
@ -97,6 +93,6 @@ void CC_DLL ccDrawColor4f( GLubyte r, GLubyte g, GLubyte b, GLubyte a );
|
|||
*/
|
||||
void CC_DLL ccPointSize( GLfloat pointSize );
|
||||
|
||||
}//namespace cocos2d
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CCDRAWING_PRIMITIVES__
|
||||
|
|
|
@ -140,11 +140,11 @@ namespace cocos2d{
|
|||
CCMenuItemAtlasFont(){}
|
||||
virtual ~CCMenuItemAtlasFont(){}
|
||||
/** creates a menu item from a string and atlas with a target/selector */
|
||||
static CCMenuItemAtlasFont* itemFromString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap);
|
||||
static CCMenuItemAtlasFont* itemWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap);
|
||||
/** creates a menu item from a string and atlas. Use it with MenuItemToggle */
|
||||
static CCMenuItemAtlasFont* itemFromString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector);
|
||||
static CCMenuItemAtlasFont* itemWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector);
|
||||
/** initializes a menu item from a string and atlas with a target/selector */
|
||||
bool initFromString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector);
|
||||
bool initWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector);
|
||||
};
|
||||
|
||||
/** @brief A CCMenuItemFont
|
||||
|
@ -164,11 +164,11 @@ namespace cocos2d{
|
|||
/** get the default font name */
|
||||
static const char *fontName();
|
||||
/** creates a menu item from a string without target/selector. To be used with CCMenuItemToggle */
|
||||
static CCMenuItemFont * itemFromString(const char *value);
|
||||
static CCMenuItemFont * itemWithString(const char *value);
|
||||
/** creates a menu item from a string with a target/selector */
|
||||
static CCMenuItemFont * itemFromString(const char *value, CCObject* target, SEL_MenuHandler selector);
|
||||
static CCMenuItemFont * itemWithString(const char *value, CCObject* target, SEL_MenuHandler selector);
|
||||
/** initializes a menu item from a string with a target/selector */
|
||||
bool initFromString(const char *value, CCObject* target, SEL_MenuHandler selector);
|
||||
bool initWithString(const char *value, CCObject* target, SEL_MenuHandler selector);
|
||||
|
||||
/** set font size
|
||||
* c++ can not overload static and non-static member functions with the same parameter types
|
||||
|
@ -217,13 +217,13 @@ namespace cocos2d{
|
|||
,m_pDisabledImage(NULL)
|
||||
{}
|
||||
/** creates a menu item with a normal, selected and disabled image*/
|
||||
static CCMenuItemSprite * itemFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite = NULL);
|
||||
static CCMenuItemSprite * itemWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite = NULL);
|
||||
/** creates a menu item with a normal and selected image with target/selector */
|
||||
static CCMenuItemSprite * itemFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCObject* target, SEL_MenuHandler selector);
|
||||
static CCMenuItemSprite * itemWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCObject* target, SEL_MenuHandler selector);
|
||||
/** creates a menu item with a normal,selected and disabled image with target/selector */
|
||||
static CCMenuItemSprite * itemFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector);
|
||||
static CCMenuItemSprite * itemWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector);
|
||||
/** initializes a menu item with a normal, selected and disabled image with target/selector */
|
||||
bool initFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector);
|
||||
bool initWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector);
|
||||
// super methods
|
||||
virtual void setColor(const ccColor3B& color);
|
||||
virtual const ccColor3B& getColor();
|
||||
|
@ -255,15 +255,15 @@ namespace cocos2d{
|
|||
CCMenuItemImage(){}
|
||||
virtual ~CCMenuItemImage(){}
|
||||
/** creates a menu item with a normal and selected image*/
|
||||
static CCMenuItemImage* itemFromNormalImage(const char *normalImage, const char *selectedImage);
|
||||
static CCMenuItemImage* itemWithNormalImage(const char *normalImage, const char *selectedImage);
|
||||
/** creates a menu item with a normal,selected and disabled image*/
|
||||
static CCMenuItemImage* itemFromNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage);
|
||||
static CCMenuItemImage* itemWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage);
|
||||
/** creates a menu item with a normal and selected image with target/selector */
|
||||
static CCMenuItemImage* itemFromNormalImage(const char *normalImage, const char *selectedImage, CCObject* target, SEL_MenuHandler selector);
|
||||
static CCMenuItemImage* itemWithNormalImage(const char *normalImage, const char *selectedImage, CCObject* target, SEL_MenuHandler selector);
|
||||
/** creates a menu item with a normal,selected and disabled image with target/selector */
|
||||
static CCMenuItemImage* itemFromNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector);
|
||||
static CCMenuItemImage* itemWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector);
|
||||
/** initializes a menu item with a normal, selected and disabled image with target/selector */
|
||||
bool initFromNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector);
|
||||
bool initWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector);
|
||||
};
|
||||
|
||||
/** @brief A CCMenuItemToggle
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2011 cocos2d-x.org
|
||||
Copyright (c) 2008, 2009 Jason Booth
|
||||
Copyright (c) 2011 ForzeField Studios S.L.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -25,10 +25,80 @@ THE SOFTWARE.
|
|||
#ifndef __CCMOTION_STREAK_H__
|
||||
#define __CCMOTION_STREAK_H__
|
||||
|
||||
#include "CCNode.h"
|
||||
#include "CCProtocols.h"
|
||||
#include "CCTexture2D.h"
|
||||
#include "ccTypes.h"
|
||||
#include "CCNode.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
||||
/** MotionStreak.
|
||||
Creates a trailing path.
|
||||
*/
|
||||
class CC_DLL CCMotionStreak : public CCNode, public CCTextureProtocol, public CCRGBAProtocol
|
||||
{
|
||||
public:
|
||||
CCMotionStreak();
|
||||
virtual ~CCMotionStreak();
|
||||
/** creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture filename */
|
||||
static CCMotionStreak* streakWithFade(float fade, float minSeg, float stroke, ccColor3B color, const char* path);
|
||||
/** creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture */
|
||||
static CCMotionStreak* streakWithFade(float fade, float minSeg, float stroke, ccColor3B color, CCTexture2D* texture);
|
||||
|
||||
/** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture filename */
|
||||
bool initWithFade(float fade, float minSeg, float stroke, ccColor3B color, const char* path);
|
||||
/** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture */
|
||||
bool initWithFade(float fade, float minSeg, float stroke, ccColor3B color, CCTexture2D* texture);
|
||||
|
||||
/** color used for the tint */
|
||||
void tintWithColor(ccColor3B colors);
|
||||
|
||||
/** Remove all living segments of the ribbon */
|
||||
void reset();
|
||||
|
||||
/** Override super methods */
|
||||
virtual void setPosition(const CCPoint& position);
|
||||
virtual void draw();
|
||||
virtual void update(ccTime delta);
|
||||
|
||||
/* Implement interfaces */
|
||||
virtual CCTexture2D* getTexture(void);
|
||||
virtual void setTexture(CCTexture2D *texture);
|
||||
virtual void setBlendFunc(ccBlendFunc blendFunc);
|
||||
virtual ccBlendFunc getBlendFunc(void);
|
||||
virtual void setColor(const ccColor3B& color);
|
||||
virtual const ccColor3B& getColor(void);
|
||||
virtual GLubyte getOpacity(void);
|
||||
virtual void setOpacity(GLubyte opacity);
|
||||
virtual void setIsOpacityModifyRGB(bool bValue);
|
||||
virtual bool getIsOpacityModifyRGB(void);
|
||||
|
||||
/** When fast mode is enbled, new points are added faster but with lower precision */
|
||||
CC_SYNTHESIZE(bool, m_bFastMode, IsFastMode);
|
||||
private:
|
||||
/** texture used for the motion streak */
|
||||
CCTexture2D* m_pTexture;
|
||||
ccBlendFunc m_tBlendFunc;
|
||||
CCPoint m_tPositionR;
|
||||
ccColor3B m_tColor;
|
||||
|
||||
float m_fStroke;
|
||||
float m_fFadeDelta;
|
||||
float m_fMinSeg;
|
||||
|
||||
unsigned int m_uMaxPoints;
|
||||
unsigned int m_uNuPoints;
|
||||
|
||||
/** Pointers */
|
||||
CCPoint* m_pPointVertexes;
|
||||
float* m_pPointState;
|
||||
|
||||
// Opengl
|
||||
ccVertex2F* m_pVertices;
|
||||
GLubyte* m_pColorPointer;
|
||||
ccTex2F* m_pTexCoords;
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
||||
|
|
|
@ -184,6 +184,18 @@ ccpLengthSQ(const CCPoint& v)
|
|||
return ccpDot(v, v);
|
||||
}
|
||||
|
||||
|
||||
/** Calculates the square distance between two points (not calling sqrt() )
|
||||
@return CGFloat
|
||||
@since v1.1
|
||||
*/
|
||||
static inline CGFloat
|
||||
ccpDistanceSQ(const CCPoint p1, const CCPoint p2)
|
||||
{
|
||||
return ccpLengthSQ(ccpSub(p1, p2));
|
||||
}
|
||||
|
||||
|
||||
/** Calculates distance between point an origin
|
||||
@return CGFloat
|
||||
@since v0.7.2
|
||||
|
|
|
@ -198,20 +198,9 @@ public:
|
|||
*/
|
||||
bool isTargetPaused(CCObject *pTarget);
|
||||
|
||||
public:
|
||||
/** returns a shared instance of the Scheduler */
|
||||
static CCScheduler* sharedScheduler(void);
|
||||
|
||||
/** purges the shared scheduler. It releases the retained instance.
|
||||
@since v0.99.0
|
||||
*/
|
||||
static void purgeSharedScheduler(void);
|
||||
|
||||
private:
|
||||
void removeHashElement(struct _hashSelectorEntry *pElement);
|
||||
void removeUpdateFromHash(struct _listEntry *entry);
|
||||
|
||||
bool init(void);
|
||||
|
||||
// update specific
|
||||
|
||||
|
|
|
@ -282,19 +282,19 @@ namespace cocos2d{
|
|||
//
|
||||
//CCMenuItemAtlasFont
|
||||
//
|
||||
CCMenuItemAtlasFont * CCMenuItemAtlasFont::itemFromString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap)
|
||||
CCMenuItemAtlasFont * CCMenuItemAtlasFont::itemWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap)
|
||||
{
|
||||
return CCMenuItemAtlasFont::itemFromString(value, charMapFile, itemWidth, itemHeight, startCharMap, NULL, NULL);
|
||||
return CCMenuItemAtlasFont::itemWithString(value, charMapFile, itemWidth, itemHeight, startCharMap, NULL, NULL);
|
||||
}
|
||||
|
||||
CCMenuItemAtlasFont * CCMenuItemAtlasFont::itemFromString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector)
|
||||
CCMenuItemAtlasFont * CCMenuItemAtlasFont::itemWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector)
|
||||
{
|
||||
CCMenuItemAtlasFont *pRet = new CCMenuItemAtlasFont();
|
||||
pRet->initFromString(value, charMapFile, itemWidth, itemHeight, startCharMap, target, selector);
|
||||
pRet->initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap, target, selector);
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
bool CCMenuItemAtlasFont::initFromString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector)
|
||||
bool CCMenuItemAtlasFont::initWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector)
|
||||
{
|
||||
CCAssert( value != NULL && strlen(value) != 0, "value length must be greater than 0");
|
||||
CCLabelAtlas *label = new CCLabelAtlas();
|
||||
|
@ -330,21 +330,21 @@ namespace cocos2d{
|
|||
{
|
||||
return _fontName.c_str();
|
||||
}
|
||||
CCMenuItemFont * CCMenuItemFont::itemFromString(const char *value, CCObject* target, SEL_MenuHandler selector)
|
||||
CCMenuItemFont * CCMenuItemFont::itemWithString(const char *value, CCObject* target, SEL_MenuHandler selector)
|
||||
{
|
||||
CCMenuItemFont *pRet = new CCMenuItemFont();
|
||||
pRet->initFromString(value, target, selector);
|
||||
pRet->initWithString(value, target, selector);
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
CCMenuItemFont * CCMenuItemFont::itemFromString(const char *value)
|
||||
CCMenuItemFont * CCMenuItemFont::itemWithString(const char *value)
|
||||
{
|
||||
CCMenuItemFont *pRet = new CCMenuItemFont();
|
||||
pRet->initFromString(value, NULL, NULL);
|
||||
pRet->initWithString(value, NULL, NULL);
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
bool CCMenuItemFont::initFromString(const char *value, CCObject* target, SEL_MenuHandler selector)
|
||||
bool CCMenuItemFont::initWithString(const char *value, CCObject* target, SEL_MenuHandler selector)
|
||||
{
|
||||
CCAssert( value != NULL && strlen(value) != 0, "Value length must be greater than 0");
|
||||
|
||||
|
@ -490,22 +490,22 @@ namespace cocos2d{
|
|||
{
|
||||
return dynamic_cast<CCRGBAProtocol*>(m_pNormalImage)->getColor();
|
||||
}
|
||||
CCMenuItemSprite * CCMenuItemSprite::itemFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite)
|
||||
CCMenuItemSprite * CCMenuItemSprite::itemWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite)
|
||||
{
|
||||
return CCMenuItemSprite::itemFromNormalSprite(normalSprite, selectedSprite, disabledSprite, NULL, NULL);
|
||||
return CCMenuItemSprite::itemWithNormalSprite(normalSprite, selectedSprite, disabledSprite, NULL, NULL);
|
||||
}
|
||||
CCMenuItemSprite * CCMenuItemSprite::itemFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCObject* target, SEL_MenuHandler selector)
|
||||
CCMenuItemSprite * CCMenuItemSprite::itemWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCObject* target, SEL_MenuHandler selector)
|
||||
{
|
||||
return CCMenuItemSprite::itemFromNormalSprite(normalSprite, selectedSprite, NULL, target, selector);
|
||||
return CCMenuItemSprite::itemWithNormalSprite(normalSprite, selectedSprite, NULL, target, selector);
|
||||
}
|
||||
CCMenuItemSprite * CCMenuItemSprite::itemFromNormalSprite(CCNode *normalSprite, CCNode *selectedSprite, CCNode *disabledSprite, CCObject *target, SEL_MenuHandler selector)
|
||||
CCMenuItemSprite * CCMenuItemSprite::itemWithNormalSprite(CCNode *normalSprite, CCNode *selectedSprite, CCNode *disabledSprite, CCObject *target, SEL_MenuHandler selector)
|
||||
{
|
||||
CCMenuItemSprite *pRet = new CCMenuItemSprite();
|
||||
pRet->initFromNormalSprite(normalSprite, selectedSprite, disabledSprite, target, selector);
|
||||
pRet->initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, target, selector);
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
bool CCMenuItemSprite::initFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector)
|
||||
bool CCMenuItemSprite::initWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector)
|
||||
{
|
||||
CCAssert(normalSprite != NULL, "");
|
||||
CCMenuItem::initWithTarget(target, selector);
|
||||
|
@ -589,18 +589,18 @@ namespace cocos2d{
|
|||
}
|
||||
}
|
||||
|
||||
CCMenuItemImage * CCMenuItemImage::itemFromNormalImage(const char *normalImage, const char *selectedImage)
|
||||
CCMenuItemImage * CCMenuItemImage::itemWithNormalImage(const char *normalImage, const char *selectedImage)
|
||||
{
|
||||
return CCMenuItemImage::itemFromNormalImage(normalImage, selectedImage, NULL, NULL, NULL);
|
||||
return CCMenuItemImage::itemWithNormalImage(normalImage, selectedImage, NULL, NULL, NULL);
|
||||
}
|
||||
CCMenuItemImage * CCMenuItemImage::itemFromNormalImage(const char *normalImage, const char *selectedImage, CCObject* target, SEL_MenuHandler selector)
|
||||
CCMenuItemImage * CCMenuItemImage::itemWithNormalImage(const char *normalImage, const char *selectedImage, CCObject* target, SEL_MenuHandler selector)
|
||||
{
|
||||
return CCMenuItemImage::itemFromNormalImage(normalImage, selectedImage, NULL, target, selector);
|
||||
return CCMenuItemImage::itemWithNormalImage(normalImage, selectedImage, NULL, target, selector);
|
||||
}
|
||||
CCMenuItemImage * CCMenuItemImage::itemFromNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector)
|
||||
CCMenuItemImage * CCMenuItemImage::itemWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector)
|
||||
{
|
||||
CCMenuItemImage *pRet = new CCMenuItemImage();
|
||||
if (pRet && pRet->initFromNormalImage(normalImage, selectedImage, disabledImage, target, selector))
|
||||
if (pRet && pRet->initWithNormalImage(normalImage, selectedImage, disabledImage, target, selector))
|
||||
{
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
|
@ -608,10 +608,10 @@ namespace cocos2d{
|
|||
CC_SAFE_DELETE(pRet);
|
||||
return NULL;
|
||||
}
|
||||
CCMenuItemImage * CCMenuItemImage::itemFromNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage)
|
||||
CCMenuItemImage * CCMenuItemImage::itemWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage)
|
||||
{
|
||||
CCMenuItemImage *pRet = new CCMenuItemImage();
|
||||
if (pRet && pRet->initFromNormalImage(normalImage, selectedImage, disabledImage, NULL, NULL))
|
||||
if (pRet && pRet->initWithNormalImage(normalImage, selectedImage, disabledImage, NULL, NULL))
|
||||
{
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
|
@ -619,7 +619,7 @@ namespace cocos2d{
|
|||
CC_SAFE_DELETE(pRet);
|
||||
return NULL;
|
||||
}
|
||||
bool CCMenuItemImage::initFromNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector)
|
||||
bool CCMenuItemImage::initWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector)
|
||||
{
|
||||
CCNode *normalSprite = CCSprite::spriteWithFile(normalImage);
|
||||
CCNode *selectedSprite = NULL;
|
||||
|
@ -634,7 +634,7 @@ namespace cocos2d{
|
|||
{
|
||||
disabledSprite = CCSprite::spriteWithFile(disabledImage);
|
||||
}
|
||||
return initFromNormalSprite(normalSprite, selectedSprite, disabledSprite, target, selector);
|
||||
return initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, target, selector);
|
||||
}
|
||||
//
|
||||
// MenuItemToggle
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2011 cocos2d-x.org
|
||||
Copyright (c) 2008-2009 Jason Booth
|
||||
Copyright (c) 2011 ForzeField Studios S.L.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -16,16 +16,314 @@ all copies or substantial portions of the Software.
|
|||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN false EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "CCMotionStreak.h"
|
||||
#include "CCMotionStreak.h"
|
||||
#include "CCTextureCache.h"
|
||||
#include "ccGLState.h"
|
||||
#include "CCGLProgram.h"
|
||||
#include "CCShaderCache.h"
|
||||
#include "ccMacros.h"
|
||||
|
||||
#include "support/CCVertex.h"
|
||||
#include "CCPointExtension.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
CCMotionStreak::CCMotionStreak()
|
||||
: m_bFastMode(false)
|
||||
, m_pTexture(NULL)
|
||||
, m_tPositionR(CCPointZero)
|
||||
, m_tColor(ccc3(0,0,0))
|
||||
, m_fStroke(0.0f)
|
||||
, m_fFadeDelta(0.0f)
|
||||
, m_fMinSeg(0.0f)
|
||||
, m_uMaxPoints(0)
|
||||
, m_uNuPoints(0)
|
||||
, m_pPointVertexes(NULL)
|
||||
, m_pPointState(NULL)
|
||||
, m_pVertices(NULL)
|
||||
, m_pColorPointer(NULL)
|
||||
, m_pTexCoords(NULL)
|
||||
{
|
||||
m_tBlendFunc.src = GL_SRC_ALPHA;
|
||||
m_tBlendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
|
||||
}
|
||||
|
||||
CCMotionStreak::~CCMotionStreak()
|
||||
{
|
||||
CC_SAFE_RELEASE(m_pTexture);
|
||||
CC_SAFE_FREE(m_pPointState);
|
||||
CC_SAFE_FREE(m_pPointVertexes);
|
||||
CC_SAFE_FREE(m_pVertices);
|
||||
CC_SAFE_FREE(m_pColorPointer);
|
||||
CC_SAFE_FREE(m_pTexCoords);
|
||||
}
|
||||
|
||||
CCMotionStreak* CCMotionStreak::streakWithFade(float fade, float minSeg, float stroke, ccColor3B color, const char* path)
|
||||
{
|
||||
CCMotionStreak *pRet = new CCMotionStreak();
|
||||
if (pRet && pRet->initWithFade(fade, minSeg, stroke, color, path))
|
||||
{
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
|
||||
CC_SAFE_DELETE(pRet)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCMotionStreak* CCMotionStreak::streakWithFade(float fade, float minSeg, float stroke, ccColor3B color, CCTexture2D* texture)
|
||||
{
|
||||
CCMotionStreak *pRet = new CCMotionStreak();
|
||||
if (pRet && pRet->initWithFade(fade, minSeg, stroke, color, texture))
|
||||
{
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
|
||||
CC_SAFE_DELETE(pRet)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CCMotionStreak::initWithFade(float fade, float minSeg, float stroke, ccColor3B color, const char* path)
|
||||
{
|
||||
CCAssert(path != NULL, "Invalid filename");
|
||||
|
||||
CCTexture2D *texture = CCTextureCache::sharedTextureCache()->addImage(path);
|
||||
return initWithFade(fade, minSeg, stroke, color, texture);
|
||||
}
|
||||
|
||||
bool CCMotionStreak::initWithFade(float fade, float minSeg, float stroke, ccColor3B color, CCTexture2D* texture)
|
||||
{
|
||||
CCNode::setPosition(CCPointZero);
|
||||
setAnchorPoint(CCPointZero);
|
||||
setIsRelativeAnchorPoint(false);
|
||||
|
||||
m_tPositionR = CCPointZero;
|
||||
m_bFastMode = true;
|
||||
m_fMinSeg = (minSeg == -1.0f) ? stroke/5.0f : minSeg;
|
||||
m_fMinSeg *= m_fMinSeg;
|
||||
|
||||
m_fStroke = stroke;
|
||||
m_fFadeDelta = 1.0f/fade;
|
||||
|
||||
m_uMaxPoints = (int)(fade*60.0f)+2;
|
||||
m_uNuPoints = 0;
|
||||
m_pPointState = (float *)malloc(sizeof(float) * m_uMaxPoints);
|
||||
m_pPointVertexes = (CCPoint*)malloc(sizeof(CCPoint) * m_uMaxPoints);
|
||||
|
||||
m_pVertices = (ccVertex2F*)malloc(sizeof(ccVertex2F) * m_uMaxPoints * 2);
|
||||
m_pTexCoords = (ccTex2F*)malloc(sizeof(ccTex2F) * m_uMaxPoints * 2);
|
||||
m_pColorPointer = (GLubyte*)malloc(sizeof(GLubyte) * m_uMaxPoints * 2 * 4);
|
||||
|
||||
// Set blend mode
|
||||
m_tBlendFunc.src = GL_SRC_ALPHA;
|
||||
m_tBlendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
|
||||
|
||||
// shader program
|
||||
setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColor));
|
||||
|
||||
setTexture(texture);
|
||||
setColor(color);
|
||||
scheduleUpdate();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCMotionStreak::setPosition(const CCPoint& position)
|
||||
{
|
||||
m_tPositionR = position;
|
||||
}
|
||||
|
||||
void CCMotionStreak::tintWithColor(ccColor3B colors)
|
||||
{
|
||||
setColor(colors);
|
||||
|
||||
// Fast assignation
|
||||
for(unsigned int i = 0; i<m_uNuPoints*2; i++)
|
||||
{
|
||||
*((ccColor3B*) (m_pColorPointer+i*4)) = colors;
|
||||
}
|
||||
}
|
||||
|
||||
CCTexture2D* CCMotionStreak::getTexture(void)
|
||||
{
|
||||
return m_pTexture;
|
||||
}
|
||||
|
||||
void CCMotionStreak::setTexture(CCTexture2D *texture)
|
||||
{
|
||||
if (m_pTexture != texture)
|
||||
{
|
||||
CC_SAFE_RETAIN(texture);
|
||||
CC_SAFE_RELEASE(m_pTexture);
|
||||
m_pTexture = texture;
|
||||
}
|
||||
}
|
||||
|
||||
void CCMotionStreak::setBlendFunc(ccBlendFunc blendFunc)
|
||||
{
|
||||
m_tBlendFunc = blendFunc;
|
||||
}
|
||||
|
||||
ccBlendFunc CCMotionStreak::getBlendFunc(void)
|
||||
{
|
||||
return m_tBlendFunc;
|
||||
}
|
||||
|
||||
void CCMotionStreak::setColor(const ccColor3B& color)
|
||||
{
|
||||
m_tColor = color;
|
||||
}
|
||||
|
||||
const ccColor3B& CCMotionStreak::getColor(void)
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
|
||||
void CCMotionStreak::setOpacity(GLubyte opacity)
|
||||
{
|
||||
CCAssert(false, "Set opacity no supported");
|
||||
}
|
||||
|
||||
GLubyte CCMotionStreak::getOpacity(void)
|
||||
{
|
||||
CCAssert(false, "Opacity no supported");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CCMotionStreak::setIsOpacityModifyRGB(bool bValue)
|
||||
{
|
||||
CC_UNUSED_PARAM(bValue);
|
||||
}
|
||||
|
||||
bool CCMotionStreak::getIsOpacityModifyRGB(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CCMotionStreak::update(ccTime delta)
|
||||
{
|
||||
delta *= m_fFadeDelta;
|
||||
|
||||
unsigned int newIdx, newIdx2, i, i2;
|
||||
unsigned int mov = 0;
|
||||
|
||||
// Update current points
|
||||
for(i = 0; i<m_uNuPoints; i++)
|
||||
{
|
||||
m_pPointState[i]-=delta;
|
||||
|
||||
if(m_pPointState[i] <= 0)
|
||||
mov++;
|
||||
else
|
||||
{
|
||||
newIdx = i-mov;
|
||||
|
||||
if(mov>0)
|
||||
{
|
||||
// Move data
|
||||
m_pPointState[newIdx] = m_pPointState[i];
|
||||
|
||||
// Move point
|
||||
m_pPointVertexes[newIdx] = m_pPointVertexes[i];
|
||||
|
||||
// Move vertices
|
||||
i2 = i*2;
|
||||
newIdx2 = newIdx*2;
|
||||
m_pVertices[newIdx2] = m_pVertices[i2];
|
||||
m_pVertices[newIdx2+1] = m_pVertices[i2+1];
|
||||
|
||||
// Move color
|
||||
i2 *= 4;
|
||||
newIdx2 *= 4;
|
||||
m_pColorPointer[newIdx2+0] = m_pColorPointer[i2+0];
|
||||
m_pColorPointer[newIdx2+1] = m_pColorPointer[i2+1];
|
||||
m_pColorPointer[newIdx2+2] = m_pColorPointer[i2+2];
|
||||
m_pColorPointer[newIdx2+4] = m_pColorPointer[i2+4];
|
||||
m_pColorPointer[newIdx2+5] = m_pColorPointer[i2+5];
|
||||
m_pColorPointer[newIdx2+6] = m_pColorPointer[i2+6];
|
||||
}else
|
||||
newIdx2 = newIdx*8;
|
||||
|
||||
const GLubyte op = (GLubyte)(m_pPointState[newIdx] * 255.0f);
|
||||
m_pColorPointer[newIdx2+3] = op;
|
||||
m_pColorPointer[newIdx2+7] = op;
|
||||
}
|
||||
}
|
||||
m_uNuPoints-=mov;
|
||||
|
||||
// Append new point
|
||||
bool appendNewPoint = true;
|
||||
if(m_uNuPoints >= m_uMaxPoints)
|
||||
appendNewPoint = false;
|
||||
|
||||
else if(m_uNuPoints>0)
|
||||
{
|
||||
bool a1 = ccpDistanceSQ(m_pPointVertexes[m_uNuPoints-1], m_tPositionR) < m_fMinSeg;
|
||||
bool a2 = (m_uNuPoints == 1) ? false : (ccpDistanceSQ(m_pPointVertexes[m_uNuPoints-2], m_tPositionR) < (m_fMinSeg * 2.0f));
|
||||
if(a1 || a2)
|
||||
appendNewPoint = false;
|
||||
}
|
||||
|
||||
if(appendNewPoint)
|
||||
{
|
||||
m_pPointVertexes[m_uNuPoints] = m_tPositionR;
|
||||
m_pPointState[m_uNuPoints] = 1.0f;
|
||||
|
||||
// Color asignation
|
||||
const unsigned int offset = m_uNuPoints*8;
|
||||
*((ccColor3B*)(m_pColorPointer + offset)) = m_tColor;
|
||||
*((ccColor3B*)(m_pColorPointer + offset+4)) = m_tColor;
|
||||
|
||||
// Opacity
|
||||
m_pColorPointer[offset+3] = 255;
|
||||
m_pColorPointer[offset+7] = 255;
|
||||
|
||||
// Generate polygon
|
||||
if(m_uNuPoints > 0 && m_bFastMode )
|
||||
{
|
||||
if(m_uNuPoints > 1)
|
||||
ccVertexLineToPolygon(m_pPointVertexes, m_fStroke, m_pVertices, m_pTexCoords, m_uNuPoints, 1);
|
||||
else
|
||||
ccVertexLineToPolygon(m_pPointVertexes, m_fStroke, m_pVertices, m_pTexCoords, 0, 2);
|
||||
}
|
||||
|
||||
m_uNuPoints ++;
|
||||
}
|
||||
|
||||
if( ! m_bFastMode )
|
||||
ccVertexLineToPolygon(m_pPointVertexes, m_fStroke, m_pVertices, m_pTexCoords, 0, m_uNuPoints);
|
||||
}
|
||||
|
||||
void CCMotionStreak::reset()
|
||||
{
|
||||
m_uNuPoints = 0;
|
||||
}
|
||||
|
||||
void CCMotionStreak::draw()
|
||||
{
|
||||
if(m_uNuPoints <= 1)
|
||||
return;
|
||||
|
||||
CC_NODE_DRAW_SETUP();
|
||||
|
||||
ccGLEnableVertexAttribs(kCCVertexAttribFlag_PosColorTex );
|
||||
ccGLBlendFunc( m_tBlendFunc.src, m_tBlendFunc.dst );
|
||||
|
||||
ccGLBindTexture2D( m_pTexture->getName() );
|
||||
|
||||
glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, m_pVertices);
|
||||
glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, m_pTexCoords);
|
||||
glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, m_pColorPointer);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)m_uNuPoints*2);
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ bool CCRenderTexture::initWithWidthAndHeight(int w, int h, CCTexture2DPixelForma
|
|||
{
|
||||
// If the gles version is lower than GLES_VER_2_0,
|
||||
// some extended gles functions can't be implemented, so return false directly.
|
||||
if (CCConfiguration::sharedConfiguration()->getGlesVersion() <= GLES_VER_2_0)
|
||||
if (CCConfiguration::sharedConfiguration()->getGlesVersion() < GLES_VER_2_0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -132,9 +132,12 @@ protected: varType varName; \
|
|||
public: virtual varType get##funName(void) const { return varName; } \
|
||||
public: virtual void set##funName(varType var) \
|
||||
{ \
|
||||
CC_SAFE_RETAIN(var); \
|
||||
CC_SAFE_RELEASE(varName); \
|
||||
varName = var; \
|
||||
if (varName != var) \
|
||||
{ \
|
||||
CC_SAFE_RETAIN(var); \
|
||||
CC_SAFE_RELEASE(varName); \
|
||||
varName = var; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CC_SAFE_DELETE(p) if(p) { delete (p); (p) = 0; }
|
||||
|
|
|
@ -923,6 +923,14 @@
|
|||
RelativePath="..\support\ccUtils.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\support\CCVertex.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\support\CCVertex.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\support\TransformUtils.cpp"
|
||||
>
|
||||
|
|
|
@ -557,8 +557,11 @@ void CCSprite::draw(void)
|
|||
|
||||
ccGLBlendFunc( m_sBlendFunc.src, m_sBlendFunc.dst );
|
||||
|
||||
ccGLBindTexture2D( m_pobTexture->getName() );
|
||||
|
||||
if (m_pobTexture != NULL)
|
||||
{
|
||||
ccGLBindTexture2D( m_pobTexture->getName() );
|
||||
}
|
||||
|
||||
//
|
||||
// Attributes
|
||||
//
|
||||
|
@ -1063,20 +1066,16 @@ void CCSprite::setTexture(CCTexture2D *texture)
|
|||
{
|
||||
// CCSprite: setTexture doesn't work when the sprite is rendered using a CCSpriteSheet
|
||||
CCAssert(! m_pobBatchNode, "setTexture doesn't work when the sprite is rendered using a CCSpriteSheet");
|
||||
|
||||
// we can not use RTTI, so we do not known the type of object
|
||||
// accept texture==nil as argument
|
||||
/*CCAssert((! texture) || dynamic_cast<CCTexture2D*>(texture));*/
|
||||
CCAssert((! texture) || dynamic_cast<CCTexture2D*>(texture));
|
||||
|
||||
CC_SAFE_RELEASE(m_pobTexture);
|
||||
|
||||
m_pobTexture = texture;
|
||||
if (texture)
|
||||
if (m_pobTexture != texture)
|
||||
{
|
||||
texture->retain();
|
||||
CC_SAFE_RETAIN(texture);
|
||||
CC_SAFE_RELEASE(m_pobTexture);
|
||||
m_pobTexture = texture;
|
||||
updateBlendFunc();
|
||||
}
|
||||
|
||||
updateBlendFunc();
|
||||
}
|
||||
|
||||
CCTexture2D* CCSprite::getTexture(void)
|
||||
|
|
|
@ -302,6 +302,10 @@ namespace cocos2d
|
|||
void CCSpriteBatchNode::updateAtlasIndex(CCSprite* sprite, int* curIndex)
|
||||
{
|
||||
CCArray *array = sprite->getChildren();
|
||||
if (array == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
unsigned int count = array->count();
|
||||
int oldIndex = 0;
|
||||
|
||||
|
|
|
@ -0,0 +1,143 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010 cocos2d-x.org
|
||||
Copyright (c) 2011 ForzeField Studios S.L
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCVertex.h"
|
||||
#include "CCPointExtension.h"
|
||||
#include "ccMacros.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
void ccVertexLineToPolygon(CCPoint *points, float stroke, ccVertex2F *vertices, ccTex2F *texCoords, unsigned int offset, unsigned int nuPoints)
|
||||
{
|
||||
nuPoints += offset;
|
||||
if(nuPoints<=1) return;
|
||||
|
||||
stroke *= 0.5f;
|
||||
|
||||
unsigned int idx;
|
||||
unsigned int nuPointsMinus = nuPoints-1;
|
||||
float texDelta = 1.0f/(float)nuPointsMinus;
|
||||
|
||||
for(unsigned int i = offset; i<nuPoints; i++)
|
||||
{
|
||||
idx = i*2;
|
||||
CCPoint p1 = points[i];
|
||||
CCPoint perpVector;
|
||||
|
||||
if(i == 0)
|
||||
perpVector = ccpPerp(ccpNormalize(ccpSub(p1, points[i+1])));
|
||||
else if(i == nuPointsMinus)
|
||||
perpVector = ccpPerp(ccpNormalize(ccpSub(points[i-1], p1)));
|
||||
else
|
||||
{
|
||||
CCPoint p2 = points[i+1];
|
||||
CCPoint p0 = points[i-1];
|
||||
|
||||
CCPoint p2p1 = ccpNormalize(ccpSub(p2, p1));
|
||||
CCPoint p0p1 = ccpNormalize(ccpSub(p0, p1));
|
||||
|
||||
// Calculate angle between vectors
|
||||
float angle = acosf(ccpDot(p2p1, p0p1));
|
||||
|
||||
if(angle < CC_DEGREES_TO_RADIANS(70))
|
||||
perpVector = ccpPerp(ccpNormalize(ccpMidpoint(p2p1, p0p1)));
|
||||
else if(angle < CC_DEGREES_TO_RADIANS(170))
|
||||
perpVector = ccpNormalize(ccpMidpoint(p2p1, p0p1));
|
||||
else
|
||||
perpVector = ccpPerp(ccpNormalize(ccpSub(p2, p0)));
|
||||
}
|
||||
perpVector = ccpMult(perpVector, stroke);
|
||||
|
||||
vertices[idx] = vertex2(p1.x+perpVector.x, p1.y+perpVector.y);
|
||||
vertices[idx+1] = vertex2(p1.x-perpVector.x, p1.y-perpVector.y);
|
||||
|
||||
texCoords[idx] = tex2(0, texDelta*(float)i);
|
||||
texCoords[idx+1] = tex2(1, texDelta*(float)i);
|
||||
}
|
||||
|
||||
// Validate vertexes
|
||||
offset = (offset==0) ? 0 : offset-1;
|
||||
for(unsigned int i = offset; i<nuPointsMinus; i++)
|
||||
{
|
||||
idx = i*2;
|
||||
const unsigned int idx1 = idx+2;
|
||||
|
||||
ccVertex2F p1 = vertices[idx];
|
||||
ccVertex2F p2 = vertices[idx+1];
|
||||
ccVertex2F p3 = vertices[idx1];
|
||||
ccVertex2F p4 = vertices[idx1+1];
|
||||
|
||||
float s;
|
||||
//BOOL fixVertex = !ccpLineIntersect(ccp(p1.x, p1.y), ccp(p4.x, p4.y), ccp(p2.x, p2.y), ccp(p3.x, p3.y), &s, &t);
|
||||
bool fixVertex = !ccVertexLineIntersect(p1.x, p1.y, p4.x, p4.y, p2.x, p2.y, p3.x, p3.y, &s);
|
||||
if(!fixVertex)
|
||||
if (s<0.0f || s>1.0f)
|
||||
fixVertex = true;
|
||||
|
||||
if(fixVertex)
|
||||
{
|
||||
vertices[idx1] = p4;
|
||||
vertices[idx1+1] = p3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ccVertexLineIntersect(float Ax, float Ay,
|
||||
float Bx, float By,
|
||||
float Cx, float Cy,
|
||||
float Dx, float Dy, float *T)
|
||||
{
|
||||
float distAB, theCos, theSin, newX;
|
||||
|
||||
// FAIL: Line undefined
|
||||
if ((Ax==Bx && Ay==By) || (Cx==Dx && Cy==Dy)) return false;
|
||||
|
||||
// Translate system to make A the origin
|
||||
Bx-=Ax; By-=Ay;
|
||||
Cx-=Ax; Cy-=Ay;
|
||||
Dx-=Ax; Dy-=Ay;
|
||||
|
||||
// Length of segment AB
|
||||
distAB = sqrtf(Bx*Bx+By*By);
|
||||
|
||||
// Rotate the system so that point B is on the positive X axis.
|
||||
theCos = Bx/distAB;
|
||||
theSin = By/distAB;
|
||||
newX = Cx*theCos+Cy*theSin;
|
||||
Cy = Cy*theCos-Cx*theSin; Cx = newX;
|
||||
newX = Dx*theCos+Dy*theSin;
|
||||
Dy = Dy*theCos-Dx*theSin; Dx = newX;
|
||||
|
||||
// FAIL: Lines are parallel.
|
||||
if (Cy == Dy) return false;
|
||||
|
||||
// Discover the relative position of the intersection in the line AB
|
||||
*T = (Dx+(Cx-Dx)*Dy/(Dy-Cy))/distAB;
|
||||
|
||||
// Success.
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_CC_END
|
|
@ -0,0 +1,46 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010 cocos2d-x.org
|
||||
Copyright (c) 2011 ForzeField Studios S.L
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#ifndef __CCVERTEX_H__
|
||||
#define __CCVERTEX_H__
|
||||
|
||||
#include "ccTypes.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/** @file CCVertex.h */
|
||||
|
||||
/** converts a line to a polygon */
|
||||
void CC_DLL ccVertexLineToPolygon(CCPoint *points, float stroke, ccVertex2F *vertices, ccTex2F *texCoords, unsigned int offset, unsigned int nuPoints);
|
||||
|
||||
/** returns wheter or not the line intersects */
|
||||
bool CC_DLL ccVertexLineIntersect(float Ax, float Ay,
|
||||
float Bx, float By,
|
||||
float Cx, float Cy,
|
||||
float Dx, float Dy, float *T);
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif /* __CCVERTEX_H__ */
|
||||
|
|
@ -249,6 +249,7 @@ void CCTextureAtlas::initVAO()
|
|||
void CCTextureAtlas::mapBuffers()
|
||||
{
|
||||
initIndices();
|
||||
initVAO();
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_pBuffersVBO[0]);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(m_pQuads[0]) * m_uCapacity, m_pQuads, GL_DYNAMIC_DRAW);
|
||||
|
|
|
@ -165,13 +165,13 @@ namespace cocos2d {
|
|||
}
|
||||
bool CCTMXMapInfo::initWithXML(const char* tmxString, const char* resourcePath)
|
||||
{
|
||||
internalInit(NULL, resourcePath);
|
||||
internalInit("", resourcePath);
|
||||
return parseXMLString(tmxString);
|
||||
}
|
||||
|
||||
bool CCTMXMapInfo::initWithTMXFile(const char *tmxFile)
|
||||
{
|
||||
internalInit(tmxFile, NULL);
|
||||
internalInit(tmxFile, "");
|
||||
return parseXMLFile(m_sTMXFileName.c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
// http://www.cocos2d-iphone.org
|
||||
|
||||
attribute vec4 a_position;
|
||||
attribute vec4 a_color;
|
||||
|
||||
uniform mat4 u_MVPMatrix;
|
||||
|
||||
#ifdef GL_ES
|
||||
varying lowp vec4 v_fragmentColor;
|
||||
#else
|
||||
varying vec4 v_fragmentColor;
|
||||
#endif
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_MVPMatrix * a_position;
|
||||
v_fragmentColor = a_color;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
// http://www.cocos2d-iphone.org
|
||||
|
||||
attribute vec4 a_position;
|
||||
attribute vec2 a_texCoord;
|
||||
|
||||
uniform mat4 u_MVPMatrix;
|
||||
|
||||
#ifdef GL_ES
|
||||
varying mediump vec2 v_texCoord;
|
||||
#else
|
||||
varying vec2 v_texCoord;
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_MVPMatrix * a_position;
|
||||
v_texCoord = a_texCoord;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
// http://www.cocos2d-iphone.org
|
||||
|
||||
attribute vec4 a_position;
|
||||
attribute vec2 a_texCoord;
|
||||
attribute vec4 a_color;
|
||||
|
||||
uniform mat4 u_MVPMatrix;
|
||||
|
||||
#ifdef GL_ES
|
||||
varying lowp vec4 v_fragmentColor;
|
||||
varying mediump vec2 v_texCoord;
|
||||
#else
|
||||
varying vec4 v_fragmentColor;
|
||||
varying vec2 v_texCoord;
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_MVPMatrix * a_position;
|
||||
v_fragmentColor = a_color;
|
||||
v_texCoord = a_texCoord;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
// http://www.cocos2d-iphone.org
|
||||
|
||||
attribute vec4 a_position;
|
||||
attribute vec2 a_texCoord;
|
||||
attribute vec4 a_color;
|
||||
|
||||
uniform mat4 u_MVPMatrix;
|
||||
|
||||
#ifdef GL_ES
|
||||
varying lowp vec4 v_fragmentColor;
|
||||
varying mediump vec2 v_texCoord;
|
||||
#else
|
||||
varying vec4 v_fragmentColor;
|
||||
varying vec2 v_texCoord;
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_MVPMatrix * a_position;
|
||||
v_fragmentColor = a_color;
|
||||
v_texCoord = a_texCoord;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
// http://www.cocos2d-iphone.org
|
||||
|
||||
attribute vec4 a_position;
|
||||
attribute vec2 a_texCoord;
|
||||
|
||||
uniform mat4 u_MVPMatrix;
|
||||
|
||||
#ifdef GL_ES
|
||||
varying mediump vec2 v_texCoord;
|
||||
#else
|
||||
varying vec2 v_texCoord;
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_MVPMatrix * a_position;
|
||||
v_texCoord = a_texCoord;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
// http://www.cocos2d-iphone.org
|
||||
|
||||
attribute vec4 a_position;
|
||||
|
||||
uniform mat4 u_MVPMatrix;
|
||||
uniform vec4 u_color;
|
||||
uniform float u_pointSize;
|
||||
|
||||
#ifdef GL_ES
|
||||
varying lowp vec4 v_fragmentColor;
|
||||
#else
|
||||
varying vec4 v_fragmentColor;
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_MVPMatrix * a_position;
|
||||
gl_PointSize = u_pointSize;
|
||||
v_fragmentColor = u_color;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// http://www.cocos2d-iphone.org
|
||||
|
||||
attribute vec4 a_position;
|
||||
|
||||
uniform mat4 u_MVPMatrix;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_MVPMatrix * a_position;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// http://www.cocos2d-iphone.org
|
||||
|
||||
attribute vec4 a_position;
|
||||
|
||||
uniform mat4 u_MVPMatrix;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_MVPMatrix * a_position;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// http://www.cocos2d-iphone.org
|
||||
|
||||
attribute vec4 a_position;
|
||||
|
||||
uniform mat4 u_MVPMatrix;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_MVPMatrix * a_position;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// http://www.cocos2d-iphone.org
|
||||
|
||||
attribute vec4 a_position;
|
||||
|
||||
uniform mat4 u_MVPMatrix;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_MVPMatrix * a_position;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// http://www.cocos2d-iphone.org
|
||||
|
||||
attribute vec4 a_position;
|
||||
|
||||
uniform mat4 u_MVPMatrix;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_MVPMatrix * a_position;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// http://www.cocos2d-iphone.org
|
||||
|
||||
attribute vec4 a_position;
|
||||
|
||||
uniform mat4 u_MVPMatrix;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_MVPMatrix * a_position;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// http://www.cocos2d-iphone.org
|
||||
|
||||
attribute vec4 a_position;
|
||||
|
||||
uniform mat4 u_MVPMatrix;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_MVPMatrix * a_position;
|
||||
}
|
|
@ -41,7 +41,7 @@
|
|||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)cocos2dx\platform\third_party\win32";"$(SolutionDir)cocos2dx\platform";"$(SolutionDir)cocos2dx";"$(SolutionDir)cocos2dx\include";"$(SolutionDir)";"$(SolutionDir)chipmunk\include\chipmunk";"$(SolutionDir)CocosDenshion\include";..\tests;"$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES";..\;.\"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)cocos2dx\platform\third_party\win32";"$(SolutionDir)cocos2dx\platform";"$(SolutionDir)cocos2dx";"$(SolutionDir)cocos2dx\kazmath\include";"$(SolutionDir)cocos2dx\include";"$(SolutionDir)";"$(SolutionDir)chipmunk\include\chipmunk";"$(SolutionDir)CocosDenshion\include";..\tests;"$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES";..\;.\"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USE_MATH_DEFINES;GL_GLEXT_PROTOTYPES"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
@ -62,7 +62,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libcocos2d.lib libgles_cm.lib libBox2d.lib libchipmunk.lib libcurl_imp.lib"
|
||||
AdditionalDependencies="libcocos2d.lib libGLESv2.lib libBox2d.lib libchipmunk.lib libcurl_imp.lib"
|
||||
OutputFile="$(OutDir)\$(ProjectName).exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""$(OutDir)""
|
||||
|
@ -251,18 +251,6 @@
|
|||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="ProgressActionsTest"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\tests\ProgressActionsTest\ProgressActionsTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ProgressActionsTest\ProgressActionsTest.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="EffectsTest"
|
||||
>
|
||||
|
@ -519,334 +507,6 @@
|
|||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="ChipmunkTest"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\Bounce.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\ChipmunkDemo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\cocos2dChipmunkDemo.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\cocos2dChipmunkDemo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\drawSpace.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\drawSpace.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\Joints.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\LogoSmash.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\MagnetsElectric.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\OneWay.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\Planet.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\Player.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\Plink.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\Pump.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\PyramidStack.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\PyramidTopple.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\Query.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\Sensors.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\Simple.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\Springies.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\Tank.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\TheoJansen.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\Tumble.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\ChipmunkTest\UnsafeOps.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Box2dTest"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTest\Box2dTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTest\Box2dTest.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Box2DTestBed"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Box2dView.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Box2dView.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\GLES-Render.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\GLES-Render.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Test.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Test.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\TestEntries.cpp"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="Tests"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\AddPair.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\ApplyForce.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\BodyTypes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Breakable.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Bridge.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\BulletTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Cantilever.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Car.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Chain.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\CharacterCollision.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\CollisionFiltering.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\CollisionProcessing.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\CompoundShapes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Confined.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\ContinuousTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\DistanceTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Dominos.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\DumpShell.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\DynamicTreeTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\EdgeShapes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\EdgeTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Gears.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\OneSidedPlatform.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Pinball.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\PolyCollision.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\PolyShapes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Prismatic.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Pulleys.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Pyramid.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\RayCast.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Revolute.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Rope.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\RopeJoint.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\SensorTest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\ShapeEditing.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\SliderCrank.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\SphereStack.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\TheoJansen.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Tiles.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\TimeOfImpact.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Tumbler.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\VaryingFriction.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\VaryingRestitution.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\VerticalStack.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\Box2DTestBed\Tests\Web.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="EffectsAdvancedTest"
|
||||
>
|
||||
|
@ -1183,6 +843,14 @@
|
|||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="ShaderTest"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="NodeTest"
|
||||
>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Files>
|
||||
|
|
|
@ -92,9 +92,9 @@ void ActionManagerTest::onEnter()
|
|||
addChild(label, 1);
|
||||
label->setPosition( CCPointMake(s.width/2, s.height-50) );
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(ActionManagerTest::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(ActionManagerTest::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(ActionManagerTest::nextCallback));
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(ActionManagerTest::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(ActionManagerTest::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(ActionManagerTest::nextCallback));
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
@ -234,7 +234,8 @@ void PauseTest::onEnter()
|
|||
|
||||
CCAction* action = CCMoveBy::actionWithDuration(1, CCPointMake(150,0));
|
||||
|
||||
CCActionManager::sharedManager()->addAction(action, grossini, true);
|
||||
CCDirector* pDirector = CCDirector::sharedDirector();
|
||||
pDirector->getActionManager()->addAction(action, grossini, true);
|
||||
|
||||
schedule( schedule_selector(PauseTest::unpause), 3);
|
||||
}
|
||||
|
@ -243,7 +244,8 @@ void PauseTest::unpause(ccTime dt)
|
|||
{
|
||||
unschedule( schedule_selector(PauseTest::unpause) );
|
||||
CCNode* node = getChildByTag( kTagGrossini );
|
||||
CCActionManager::sharedManager()->resumeTarget(node);
|
||||
CCDirector* pDirector = CCDirector::sharedDirector();
|
||||
pDirector->getActionManager()->resumeTarget(node);
|
||||
}
|
||||
|
||||
std::string PauseTest::title()
|
||||
|
@ -315,7 +317,8 @@ void ResumeTest::onEnter()
|
|||
|
||||
pGrossini->runAction(CCScaleBy::actionWithDuration(2, 2));
|
||||
|
||||
CCActionManager::sharedManager()->pauseTarget(pGrossini);
|
||||
CCDirector* pDirector = CCDirector::sharedDirector();
|
||||
pDirector->getActionManager()->pauseTarget(pGrossini);
|
||||
pGrossini->runAction(CCRotateBy::actionWithDuration(2, 360));
|
||||
|
||||
this->schedule(schedule_selector(ResumeTest::resumeGrossini), 3.0f);
|
||||
|
@ -326,7 +329,8 @@ void ResumeTest::resumeGrossini(ccTime time)
|
|||
this->unschedule(schedule_selector(ResumeTest::resumeGrossini));
|
||||
|
||||
CCNode* pGrossini = getChildByTag(kTagGrossini);
|
||||
CCActionManager::sharedManager()->resumeTarget(pGrossini);
|
||||
CCDirector* pDirector = CCDirector::sharedDirector();
|
||||
pDirector->getActionManager()->resumeTarget(pGrossini);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
@ -165,9 +165,9 @@ void ActionsDemo::onEnter()
|
|||
}
|
||||
|
||||
// add menu
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(ActionsDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(ActionsDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(ActionsDemo::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(ActionsDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(ActionsDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(ActionsDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
|
|
@ -65,9 +65,9 @@ bool MenuLayer::initWithEntryID(int entryId)
|
|||
addChild(label, 1);
|
||||
label->setPosition( ccp(s.width/2, s.height-50) );
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage("Images/b1.png", "Images/b2.png", this, menu_selector(MenuLayer::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage("Images/r1.png","Images/r2.png", this, menu_selector(MenuLayer::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage("Images/f1.png", "Images/f2.png", this, menu_selector(MenuLayer::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage("Images/b1.png", "Images/b2.png", this, menu_selector(MenuLayer::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage("Images/r1.png","Images/r2.png", this, menu_selector(MenuLayer::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage("Images/f1.png", "Images/f2.png", this, menu_selector(MenuLayer::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ bool Bug1159Layer::init()
|
|||
CCLayerColor *background = CCLayerColor::layerWithColor(ccc4(255, 0, 255, 255));
|
||||
addChild(background);
|
||||
|
||||
CCLayerColor *sprite_a = CCLayerColor::layerWithColorWidthHeight(ccc4(255, 0, 0, 255), 700, 700);
|
||||
CCLayerColor *sprite_a = CCLayerColor::layerWithColor(ccc4(255, 0, 0, 255), 700, 700);
|
||||
sprite_a->setAnchorPoint(ccp(0.5f, 0.5f));
|
||||
sprite_a->setIsRelativeAnchorPoint(true);
|
||||
sprite_a->setPosition(ccp(0.0f, s.height/2));
|
||||
|
@ -38,7 +38,7 @@ bool Bug1159Layer::init()
|
|||
CCMoveTo::actionWithDuration(1.0f, ccp(0.0f, 384.0f)),
|
||||
NULL)));
|
||||
|
||||
CCLayerColor *sprite_b = CCLayerColor::layerWithColorWidthHeight(ccc4(0, 0, 255, 255), 400, 400);
|
||||
CCLayerColor *sprite_b = CCLayerColor::layerWithColor(ccc4(0, 0, 255, 255), 400, 400);
|
||||
sprite_b->setAnchorPoint(ccp(0.5f, 0.5f));
|
||||
sprite_b->setIsRelativeAnchorPoint(true);
|
||||
sprite_b->setPosition(ccp(s.width/2, s.height/2));
|
||||
|
|
|
@ -31,9 +31,9 @@ void Bug422Layer::reset()
|
|||
removeChild(node, false);
|
||||
// [self removeChildByTag:localtag-1 cleanup:NO];
|
||||
|
||||
CCMenuItem *item1 = CCMenuItemFont::itemFromString("One", this, menu_selector(Bug422Layer::menuCallback));
|
||||
CCMenuItem *item1 = CCMenuItemFont::itemWithString("One", this, menu_selector(Bug422Layer::menuCallback));
|
||||
CCLog("MenuItemFont: %p", item1);
|
||||
CCMenuItem *item2 = CCMenuItemFont::itemFromString("Two", this, menu_selector(Bug422Layer::menuCallback));
|
||||
CCMenuItem *item2 = CCMenuItemFont::itemWithString("Two", this, menu_selector(Bug422Layer::menuCallback));
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, NULL);
|
||||
menu->alignItemsVertically();
|
||||
|
||||
|
|
|
@ -21,13 +21,13 @@ bool Bug458Layer::init()
|
|||
// [question setContentSize:CGSizeMake(50,50)];
|
||||
// [question2 setContentSize:CGSizeMake(50,50)];
|
||||
|
||||
CCMenuItemSprite* sprite = CCMenuItemSprite::itemFromNormalSprite(question2, question, this, menu_selector(Bug458Layer::selectAnswer));
|
||||
CCLayerColor* layer = CCLayerColor::layerWithColorWidthHeight(ccc4(0,0,255,255), 100, 100);
|
||||
CCMenuItemSprite* sprite = CCMenuItemSprite::itemWithNormalSprite(question2, question, this, menu_selector(Bug458Layer::selectAnswer));
|
||||
CCLayerColor* layer = CCLayerColor::layerWithColor(ccc4(0,0,255,255), 100, 100);
|
||||
question->release();
|
||||
question2->release();
|
||||
|
||||
CCLayerColor* layer2 = CCLayerColor::layerWithColorWidthHeight(ccc4(255,0,0,255), 100, 100);
|
||||
CCMenuItemSprite* sprite2 = CCMenuItemSprite::itemFromNormalSprite(layer, layer2, this, menu_selector(Bug458Layer::selectAnswer));
|
||||
CCLayerColor* layer2 = CCLayerColor::layerWithColor(ccc4(255,0,0,255), 100, 100);
|
||||
CCMenuItemSprite* sprite2 = CCMenuItemSprite::itemWithNormalSprite(layer, layer2, this, menu_selector(Bug458Layer::selectAnswer));
|
||||
CCMenu* menu = CCMenu::menuWithItems(sprite, sprite2, NULL);
|
||||
menu->alignItemsVerticallyWithPadding(100);
|
||||
menu->setPosition(ccp(size.width / 2, size.height / 2));
|
||||
|
|
|
@ -18,7 +18,7 @@ bool QuestionContainerSprite::init()
|
|||
|
||||
int width = size.width * 0.9f - (corner->getContentSize().width * 2);
|
||||
int height = size.height * 0.15f - (corner->getContentSize().height * 2);
|
||||
CCLayerColor* layer = CCLayerColor::layerWithColorWidthHeight(ccc4(255, 255, 255, 255 * .75), width, height);
|
||||
CCLayerColor* layer = CCLayerColor::layerWithColor(ccc4(255, 255, 255, 255 * .75), width, height);
|
||||
layer->setPosition(ccp(-width / 2, -height / 2));
|
||||
|
||||
//First button is blue,
|
||||
|
|
|
@ -46,7 +46,7 @@ bool Bug914Layer::init()
|
|||
|
||||
// create and initialize a Label
|
||||
CCLabelTTF *label = CCLabelTTF::labelWithString("Hello World", "Marker Felt", 64);
|
||||
CCMenuItem *item1 = CCMenuItemFont::itemFromString("restart", this, menu_selector(Bug914Layer::restart));
|
||||
CCMenuItem *item1 = CCMenuItemFont::itemWithString("restart", this, menu_selector(Bug914Layer::restart));
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, NULL);
|
||||
menu->alignItemsVertically();
|
||||
|
|
|
@ -56,7 +56,7 @@ void BugsTestMainLayer::onEnter()
|
|||
CCMenuItemFont::setFontSize(24);
|
||||
for (int i = 0; i < MAX_COUNT; ++i)
|
||||
{
|
||||
CCMenuItemFont* pItem = CCMenuItemFont::itemFromString(testsName[i].c_str(), this,
|
||||
CCMenuItemFont* pItem = CCMenuItemFont::itemWithString(testsName[i].c_str(), this,
|
||||
menu_selector(BugsTestMainLayer::menuCallback));
|
||||
pItem->setPosition(ccp(s.width / 2, s.height - (i + 1) * LINE_SPACE));
|
||||
m_pItmeMenu->addChild(pItem, kItemTagBasic + i);
|
||||
|
@ -157,7 +157,7 @@ void BugsTestBaseLayer::onEnter()
|
|||
|
||||
CCMenuItemFont::setFontName("Arial");
|
||||
CCMenuItemFont::setFontSize(24);
|
||||
CCMenuItemFont* pMainItem = CCMenuItemFont::itemFromString("Back", this,
|
||||
CCMenuItemFont* pMainItem = CCMenuItemFont::itemWithString("Back", this,
|
||||
menu_selector(BugsTestBaseLayer::backCallback));
|
||||
pMainItem->setPosition(ccp(s.width - 50, 25));
|
||||
CCMenu* pMenu = CCMenu::menuWithItems(pMainItem, NULL);
|
||||
|
|
|
@ -114,9 +114,9 @@ void TestCocosNodeDemo::onEnter()
|
|||
l->setPosition( CCPointMake(s.width/2, s.height-80) );
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(TestCocosNodeDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1,s_pPathR2, this, menu_selector(TestCocosNodeDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(TestCocosNodeDemo::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(TestCocosNodeDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1,s_pPathR2, this, menu_selector(TestCocosNodeDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(TestCocosNodeDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
@ -513,7 +513,7 @@ NodeToWorld::NodeToWorld()
|
|||
back->setAnchorPoint( CCPointMake(0,0) );
|
||||
CCSize backSize = back->getContentSize();
|
||||
|
||||
CCMenuItem *item = CCMenuItemImage::itemFromNormalImage(s_PlayNormal, s_PlaySelect);
|
||||
CCMenuItem *item = CCMenuItemImage::itemWithNormalImage(s_PlayNormal, s_PlaySelect);
|
||||
CCMenu *menu = CCMenu::menuWithItems(item, NULL);
|
||||
menu->alignItemsVertically();
|
||||
menu->setPosition( CCPointMake(backSize.width/2, backSize.height/2));
|
||||
|
|
|
@ -73,9 +73,9 @@ bool DirectorTest::init()
|
|||
l->setPosition(ccp(s.width/2, s.height-80));
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(DirectorTest::backCallback));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(DirectorTest::restartCallback));
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(DirectorTest::nextCallback));
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(DirectorTest::backCallback));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(DirectorTest::restartCallback));
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(DirectorTest::nextCallback));
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
|
@ -139,7 +139,7 @@ bool Director1::init()
|
|||
setIsTouchEnabled(true);
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCMenuItem *item = CCMenuItemFont::itemFromString("Rotate Device", this, menu_selector(Director1::rotateDevice));
|
||||
CCMenuItem *item = CCMenuItemFont::itemWithString("Rotate Device", this, menu_selector(Director1::rotateDevice));
|
||||
CCMenu *menu = CCMenu::menuWithItems(item, NULL);
|
||||
menu->setPosition(ccp( s.width/2, s.height/2));
|
||||
addChild(menu);
|
||||
|
|
|
@ -6,84 +6,97 @@ DrawPrimitivesTest::DrawPrimitivesTest()
|
|||
|
||||
void DrawPrimitivesTest::draw()
|
||||
{
|
||||
CCLayer::draw();
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
//TODO: CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
// draw a simple line
|
||||
// The default state is:
|
||||
// Line Width: 1
|
||||
// color: 255,255,255,255 (white, non-transparent)
|
||||
// Anti-Aliased
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
ccDrawLine( CCPointMake(0, 0), CCPointMake(s.width, s.height) );
|
||||
|
||||
// glEnable(GL_LINE_SMOOTH);
|
||||
ccDrawLine( ccp(0, 0), ccp(s.width, s.height) );
|
||||
|
||||
//TODO: CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
// line: color, width, aliased
|
||||
// glLineWidth > 1 and GL_LINE_SMOOTH are not compatible
|
||||
// GL_SMOOTH_LINE_WIDTH_RANGE = (1,1) on iPhone
|
||||
glDisable(GL_LINE_SMOOTH);
|
||||
// glDisable(GL_LINE_SMOOTH);
|
||||
glLineWidth( 5.0f );
|
||||
/*glColor4ub(255,0,0,255);*/
|
||||
glColor4f(1.0, 0.0, 0.0, 1.0);
|
||||
ccDrawLine( CCPointMake(0, s.height), CCPointMake(s.width, 0) );
|
||||
ccDrawColor4B(255,0,0,255);
|
||||
ccDrawLine( ccp(0, s.height), ccp(s.width, 0) );
|
||||
|
||||
//TODO: CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
// TIP:
|
||||
// If you are going to use always the same color or width, you don't
|
||||
// need to call it before every draw
|
||||
//
|
||||
// Remember: OpenGL is a state-machine.
|
||||
|
||||
|
||||
// draw big point in the center
|
||||
glPointSize(64);
|
||||
/*glColor4ub(0,0,255,128);*/
|
||||
glColor4f(0.0, 0.0, 1.0, 0.5);
|
||||
ccDrawPoint( CCPointMake(s.width / 2, s.height / 2) );
|
||||
|
||||
ccPointSize(64);
|
||||
ccDrawColor4B(0,0,255,128);
|
||||
ccDrawPoint( ccp(s.width / 2, s.height / 2) );
|
||||
|
||||
//TODO: CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
// draw 4 small points
|
||||
CCPoint points[] = { CCPointMake(60,60), CCPointMake(70,70), CCPointMake(60,70), CCPointMake(70,60) };
|
||||
glPointSize(4);
|
||||
/*glColor4ub(0,255,255,255);*/
|
||||
glColor4f(0.0, 1.0, 1.0, 1.0);
|
||||
CCPoint points[] = { ccp(60,60), ccp(70,70), ccp(60,70), ccp(70,60) };
|
||||
ccPointSize(4);
|
||||
ccDrawColor4B(0,255,255,255);
|
||||
ccDrawPoints( points, 4);
|
||||
|
||||
|
||||
//TODO: CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
// draw a green circle with 10 segments
|
||||
glLineWidth(16);
|
||||
/*glColor4ub(0, 255, 0, 255);*/
|
||||
glColor4f(0.0, 1.0, 0.0, 1.0);
|
||||
ccDrawCircle( CCPointMake(s.width/2, s.height/2), 100, 0, 10, false);
|
||||
ccDrawColor4B(0, 255, 0, 255);
|
||||
ccDrawCircle( ccp(s.width/2, s.height/2), 100, 0, 10, false);
|
||||
|
||||
//TODO: CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
// draw a green circle with 50 segments with line to center
|
||||
glLineWidth(2);
|
||||
/*glColor4ub(0, 255, 255, 255);*/
|
||||
glColor4f(0.0, 1.0, 1.0, 1.0);
|
||||
ccDrawCircle( CCPointMake(s.width/2, s.height/2), 50, CC_DEGREES_TO_RADIANS(90), 50, true);
|
||||
|
||||
ccDrawColor4B(0, 255, 255, 255);
|
||||
ccDrawCircle( ccp(s.width/2, s.height/2), 50, CC_DEGREES_TO_RADIANS(90), 50, true);
|
||||
|
||||
//TODO: CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
// open yellow poly
|
||||
/*glColor4ub(255, 255, 0, 255);*/
|
||||
glColor4f(1.0, 1.0, 0.0, 1.0);
|
||||
ccDrawColor4B(255, 255, 0, 255);
|
||||
glLineWidth(10);
|
||||
CCPoint vertices[] = { CCPointMake(0,0), CCPointMake(50,50), CCPointMake(100,50), CCPointMake(100,100), CCPointMake(50,100) };
|
||||
CCPoint vertices[] = { ccp(0,0), ccp(50,50), ccp(100,50), ccp(100,100), ccp(50,100) };
|
||||
ccDrawPoly( vertices, 5, false);
|
||||
|
||||
|
||||
//TODO: CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
// closed purble poly
|
||||
/*glColor4ub(255, 0, 255, 255);*/
|
||||
glColor4f(1.0, 0.0, 1.0, 1.0);
|
||||
ccDrawColor4B(255, 0, 255, 255);
|
||||
glLineWidth(2);
|
||||
CCPoint vertices2[] = { CCPointMake(30,130), CCPointMake(30,230), CCPointMake(50,200) };
|
||||
CCPoint vertices2[] = { ccp(30,130), ccp(30,230), ccp(50,200) };
|
||||
ccDrawPoly( vertices2, 3, true);
|
||||
|
||||
|
||||
//TODO: CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
// draw quad bezier path
|
||||
ccDrawQuadBezier(CCPointMake(0,s.height), CCPointMake(s.width/2,s.height/2), CCPointMake(s.width,s.height), 50);
|
||||
ccDrawQuadBezier(ccp(0,s.height), ccp(s.width/2,s.height/2), ccp(s.width,s.height), 50);
|
||||
|
||||
//TODO: CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
// draw cubic bezier path
|
||||
ccDrawCubicBezier(CCPointMake(s.width/2, s.height/2), CCPointMake(s.width/2+30,s.height/2+50), CCPointMake(s.width/2+60,s.height/2-50),CCPointMake(s.width, s.height/2),100);
|
||||
ccDrawCubicBezier(ccp(s.width/2, s.height/2), ccp(s.width/2+30,s.height/2+50), ccp(s.width/2+60,s.height/2-50),ccp(s.width, s.height/2),100);
|
||||
|
||||
//TODO: CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
|
||||
// restore original values
|
||||
glLineWidth(1);
|
||||
/*glColor4ub(255,255,255,255);*/
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
glPointSize(1);
|
||||
ccDrawColor4B(255,255,255,255);
|
||||
ccPointSize(1);
|
||||
|
||||
//TODO: CHECK_GL_ERROR_DEBUG();
|
||||
}
|
||||
|
||||
void DrawPrimitivesTestScene::runThisTest()
|
||||
|
|
|
@ -645,9 +645,9 @@ void EaseSpriteDemo::onEnter()
|
|||
addChild(label);
|
||||
label->setPosition( CCPointMake(s.width/2, s.height-50) );
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(EaseSpriteDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(EaseSpriteDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(EaseSpriteDemo::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(EaseSpriteDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(EaseSpriteDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(EaseSpriteDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
|
|
@ -337,9 +337,9 @@ void EffectAdvanceTextLayer::onEnter(void)
|
|||
l->setPosition( ccp(size.width/2, size.height-80) );
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage("Images/b1.png", "Images/b2.png", this, menu_selector(EffectAdvanceTextLayer::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage("Images/r1.png","Images/r2.png", this, menu_selector(EffectAdvanceTextLayer::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage("Images/f1.png", "Images/f2.png", this, menu_selector(EffectAdvanceTextLayer::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage("Images/b1.png", "Images/b2.png", this, menu_selector(EffectAdvanceTextLayer::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage("Images/r1.png","Images/r2.png", this, menu_selector(EffectAdvanceTextLayer::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage("Images/f1.png", "Images/f2.png", this, menu_selector(EffectAdvanceTextLayer::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
|
|
@ -377,9 +377,9 @@ TextLayer::TextLayer(void)
|
|||
addChild(label);
|
||||
label->setTag( kTagLabel );
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(TextLayer::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(TextLayer::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(TextLayer::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(TextLayer::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(TextLayer::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(TextLayer::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ void ExtensionsMainLayer::onEnter()
|
|||
CCMenuItemFont::setFontSize(24);
|
||||
for (int i = 0; i < MAX_COUNT; ++i)
|
||||
{
|
||||
CCMenuItemFont* pItem = CCMenuItemFont::itemFromString(testsName[i].c_str(), this,
|
||||
CCMenuItemFont* pItem = CCMenuItemFont::itemWithString(testsName[i].c_str(), this,
|
||||
menu_selector(ExtensionsMainLayer::menuCallback));
|
||||
pItem->setPosition(ccp(s.width / 2, s.height - (i + 1) * LINE_SPACE));
|
||||
pMenu->addChild(pItem, kItemTagBasic + i);
|
||||
|
|
|
@ -82,7 +82,7 @@ NotificationCenterTest::NotificationCenterTest()
|
|||
{
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCMenuItemFont* pBackItem = CCMenuItemFont::itemFromString("Back", this,
|
||||
CCMenuItemFont* pBackItem = CCMenuItemFont::itemWithString("Back", this,
|
||||
menu_selector(NotificationCenterTest::toExtensionsMainLayer));
|
||||
pBackItem->setPosition(ccp(s.width - 50, 25));
|
||||
CCMenu* pBackMenu = CCMenu::menuWithItems(pBackItem, NULL);
|
||||
|
|
|
@ -51,9 +51,9 @@ static const char* restartAction(void)
|
|||
FontTest::FontTest()
|
||||
{
|
||||
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(FontTest::backCallback));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(FontTest::restartCallback));
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(FontTest::nextCallback));
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(FontTest::backCallback));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(FontTest::restartCallback));
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(FontTest::nextCallback));
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
|
|
|
@ -75,9 +75,9 @@ void HiResDemo::onEnter()
|
|||
addChild(subLabel, 1);
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(HiResDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(HiResDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(HiResDemo::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(HiResDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(HiResDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(HiResDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ IntervalLayer::IntervalLayer()
|
|||
)
|
||||
);
|
||||
// pause button
|
||||
CCMenuItem* item1 = CCMenuItemFont::itemFromString("Pause", this, menu_selector(IntervalLayer::onPause) );
|
||||
CCMenuItem* item1 = CCMenuItemFont::itemWithString("Pause", this, menu_selector(IntervalLayer::onPause) );
|
||||
CCMenu* menu = CCMenu::menuWithItems(item1, NULL);
|
||||
menu->setPosition( CCPointMake(s.width/2, s.height-50) );
|
||||
|
||||
|
|
|
@ -140,9 +140,9 @@ void AtlasDemo::onEnter()
|
|||
l->setPosition( ccp(s.width/2, s.height-80) );
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(AtlasDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(AtlasDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(AtlasDemo::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(AtlasDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(AtlasDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(AtlasDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
|
|
@ -101,9 +101,9 @@ void LayerTest::onEnter()
|
|||
l->setPosition(ccp(s.width / 2, s.height - 80));
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(LayerTest::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(LayerTest::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(LayerTest::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(LayerTest::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(LayerTest::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(LayerTest::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
@ -152,7 +152,7 @@ void LayerTest1::onEnter()
|
|||
setIsTouchEnabled(true);
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLayerColor* layer = CCLayerColor::layerWithColorWidthHeight( ccc4(0xFF, 0x00, 0x00, 0x80), 200, 200);
|
||||
CCLayerColor* layer = CCLayerColor::layerWithColor( ccc4(0xFF, 0x00, 0x00, 0x80), 200, 200);
|
||||
|
||||
layer->setIsRelativeAnchorPoint(true);
|
||||
layer->setPosition( CCPointMake(s.width/2, s.height/2) );
|
||||
|
@ -210,12 +210,12 @@ void LayerTest2::onEnter()
|
|||
LayerTest::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLayerColor* layer1 = CCLayerColor::layerWithColorWidthHeight( ccc4(255, 255, 0, 80), 100, 300);
|
||||
CCLayerColor* layer1 = CCLayerColor::layerWithColor( ccc4(255, 255, 0, 80), 100, 300);
|
||||
layer1->setPosition(CCPointMake(s.width/3, s.height/2));
|
||||
layer1->setIsRelativeAnchorPoint(true);
|
||||
addChild(layer1, 1);
|
||||
|
||||
CCLayerColor* layer2 = CCLayerColor::layerWithColorWidthHeight( ccc4(0, 0, 255, 255), 100, 300);
|
||||
CCLayerColor* layer2 = CCLayerColor::layerWithColor( ccc4(0, 0, 255, 255), 100, 300);
|
||||
layer2->setPosition(CCPointMake((s.width/3)*2, s.height/2));
|
||||
layer2->setIsRelativeAnchorPoint(true);
|
||||
addChild(layer2, 1);
|
||||
|
|
|
@ -38,10 +38,10 @@ MenuLayer1::MenuLayer1()
|
|||
//dynamic_cast<CCNode*>(mgr)->addChild(spriteSelected);
|
||||
//dynamic_cast<CCNode*>(mgr)->addChild(spriteDisabled);
|
||||
|
||||
CCMenuItemSprite* item1 = CCMenuItemSprite::itemFromNormalSprite(spriteNormal, spriteSelected, spriteDisabled, this, menu_selector(MenuLayer1::menuCallback) );
|
||||
CCMenuItemSprite* item1 = CCMenuItemSprite::itemWithNormalSprite(spriteNormal, spriteSelected, spriteDisabled, this, menu_selector(MenuLayer1::menuCallback) );
|
||||
|
||||
// Image Item
|
||||
CCMenuItem* item2 = CCMenuItemImage::itemFromNormalImage(s_SendScore, s_PressSendScore, this, menu_selector(MenuLayer1::menuCallback2) );
|
||||
CCMenuItem* item2 = CCMenuItemImage::itemWithNormalImage(s_SendScore, s_PressSendScore, this, menu_selector(MenuLayer1::menuCallback2) );
|
||||
|
||||
// Label Item (LabelAtlas)
|
||||
CCLabelAtlas* labelAtlas = CCLabelAtlas::labelWithString("0123456789", "fonts/fps_images.png", 16, 24, '.');
|
||||
|
@ -50,7 +50,7 @@ MenuLayer1::MenuLayer1()
|
|||
item3->setColor( ccc3(200,200,255) );
|
||||
|
||||
// Font Item
|
||||
CCMenuItemFont *item4 = CCMenuItemFont::itemFromString("I toggle enable items", this, menu_selector(MenuLayer1::menuCallbackEnable) );
|
||||
CCMenuItemFont *item4 = CCMenuItemFont::itemWithString("I toggle enable items", this, menu_selector(MenuLayer1::menuCallbackEnable) );
|
||||
|
||||
item4->setFontSizeObj(20);
|
||||
item4->setFontName("Marker Felt");
|
||||
|
@ -63,7 +63,7 @@ MenuLayer1::MenuLayer1()
|
|||
item5->setScale( 0.8f );
|
||||
|
||||
// Font Item
|
||||
CCMenuItemFont* item6 = CCMenuItemFont::itemFromString("Quit", this, menu_selector(MenuLayer1::onQuit));
|
||||
CCMenuItemFont* item6 = CCMenuItemFont::itemWithString("Quit", this, menu_selector(MenuLayer1::onQuit));
|
||||
|
||||
CCActionInterval* color_action = CCTintBy::actionWithDuration(0.5f, 0, -255, -255);
|
||||
CCActionInterval* color_back = color_action->reverse();
|
||||
|
@ -186,9 +186,9 @@ MenuLayer2::MenuLayer2()
|
|||
{
|
||||
for( int i=0;i < 2;i++ )
|
||||
{
|
||||
CCMenuItemImage* item1 = CCMenuItemImage::itemFromNormalImage(s_PlayNormal, s_PlaySelect, this, menu_selector(MenuLayer2::menuCallback));
|
||||
CCMenuItemImage* item2 = CCMenuItemImage::itemFromNormalImage(s_HighNormal, s_HighSelect, this, menu_selector(MenuLayer2::menuCallbackOpacity) );
|
||||
CCMenuItemImage* item3 = CCMenuItemImage::itemFromNormalImage(s_AboutNormal, s_AboutSelect, this, menu_selector(MenuLayer2::menuCallbackAlign) );
|
||||
CCMenuItemImage* item1 = CCMenuItemImage::itemWithNormalImage(s_PlayNormal, s_PlaySelect, this, menu_selector(MenuLayer2::menuCallback));
|
||||
CCMenuItemImage* item2 = CCMenuItemImage::itemWithNormalImage(s_HighNormal, s_HighSelect, this, menu_selector(MenuLayer2::menuCallbackOpacity) );
|
||||
CCMenuItemImage* item3 = CCMenuItemImage::itemWithNormalImage(s_AboutNormal, s_AboutSelect, this, menu_selector(MenuLayer2::menuCallbackAlign) );
|
||||
|
||||
item1->setScaleX( 1.5f );
|
||||
item2->setScaleX( 0.5f );
|
||||
|
@ -295,14 +295,14 @@ MenuLayer3::MenuLayer3()
|
|||
|
||||
CCLabelBMFont* label = CCLabelBMFont::labelWithString("Enable AtlasItem", "fonts/bitmapFontTest3.fnt");
|
||||
CCMenuItemLabel* item1 = CCMenuItemLabel::itemWithLabel(label, this, menu_selector(MenuLayer3::menuCallback2) );
|
||||
CCMenuItemFont* item2 = CCMenuItemFont::itemFromString("--- Go Back ---", this, menu_selector(MenuLayer3::menuCallback) );
|
||||
CCMenuItemFont* item2 = CCMenuItemFont::itemWithString("--- Go Back ---", this, menu_selector(MenuLayer3::menuCallback) );
|
||||
|
||||
CCSprite *spriteNormal = CCSprite::spriteWithFile(s_MenuItem, CCRectMake(0,23*2,115,23));
|
||||
CCSprite *spriteSelected = CCSprite::spriteWithFile(s_MenuItem, CCRectMake(0,23*1,115,23));
|
||||
CCSprite *spriteDisabled = CCSprite::spriteWithFile(s_MenuItem, CCRectMake(0,23*0,115,23));
|
||||
|
||||
|
||||
CCMenuItemSprite* item3 = CCMenuItemSprite::itemFromNormalSprite(spriteNormal, spriteSelected, spriteDisabled, this, menu_selector(MenuLayer3::menuCallback3));
|
||||
CCMenuItemSprite* item3 = CCMenuItemSprite::itemWithNormalSprite(spriteNormal, spriteSelected, spriteDisabled, this, menu_selector(MenuLayer3::menuCallback3));
|
||||
m_disabledItem = item3; item3->retain();
|
||||
m_disabledItem->setIsEnabled( false );
|
||||
|
||||
|
@ -362,60 +362,60 @@ MenuLayer4::MenuLayer4()
|
|||
{
|
||||
CCMenuItemFont::setFontName("American Typewriter");
|
||||
CCMenuItemFont::setFontSize(18);
|
||||
CCMenuItemFont*title1 = CCMenuItemFont::itemFromString("Sound");
|
||||
CCMenuItemFont*title1 = CCMenuItemFont::itemWithString("Sound");
|
||||
title1->setIsEnabled(false);
|
||||
CCMenuItemFont::setFontName( "Marker Felt" );
|
||||
CCMenuItemFont::setFontSize(34);
|
||||
CCMenuItemToggle* item1 = CCMenuItemToggle::itemWithTarget( this,
|
||||
menu_selector(MenuLayer4::menuCallback),
|
||||
CCMenuItemFont::itemFromString( "On" ),
|
||||
CCMenuItemFont::itemFromString( "Off"),
|
||||
CCMenuItemFont::itemWithString( "On" ),
|
||||
CCMenuItemFont::itemWithString( "Off"),
|
||||
NULL );
|
||||
|
||||
CCMenuItemFont::setFontName( "American Typewriter" );
|
||||
CCMenuItemFont::setFontSize(18);
|
||||
CCMenuItemFont* title2 = CCMenuItemFont::itemFromString( "Music" );
|
||||
CCMenuItemFont* title2 = CCMenuItemFont::itemWithString( "Music" );
|
||||
title2->setIsEnabled(false);
|
||||
CCMenuItemFont::setFontName( "Marker Felt" );
|
||||
CCMenuItemFont::setFontSize(34);
|
||||
CCMenuItemToggle *item2 = CCMenuItemToggle::itemWithTarget( this,
|
||||
menu_selector(MenuLayer4::menuCallback),
|
||||
CCMenuItemFont::itemFromString( "On" ),
|
||||
CCMenuItemFont::itemFromString( "Off"),
|
||||
CCMenuItemFont::itemWithString( "On" ),
|
||||
CCMenuItemFont::itemWithString( "Off"),
|
||||
NULL );
|
||||
|
||||
CCMenuItemFont::setFontName( "American Typewriter" );
|
||||
CCMenuItemFont::setFontSize(18);
|
||||
CCMenuItemFont* title3 = CCMenuItemFont::itemFromString( "Quality" );
|
||||
CCMenuItemFont* title3 = CCMenuItemFont::itemWithString( "Quality" );
|
||||
title3->setIsEnabled( false );
|
||||
CCMenuItemFont::setFontName( "Marker Felt" );
|
||||
CCMenuItemFont::setFontSize(34);
|
||||
CCMenuItemToggle *item3 = CCMenuItemToggle::itemWithTarget( this,
|
||||
menu_selector(MenuLayer4::menuCallback),
|
||||
CCMenuItemFont::itemFromString( "High" ),
|
||||
CCMenuItemFont::itemFromString( "Low" ),
|
||||
CCMenuItemFont::itemWithString( "High" ),
|
||||
CCMenuItemFont::itemWithString( "Low" ),
|
||||
NULL );
|
||||
|
||||
CCMenuItemFont::setFontName( "American Typewriter" );
|
||||
CCMenuItemFont::setFontSize(18);
|
||||
CCMenuItemFont* title4 = CCMenuItemFont::itemFromString( "Orientation" );
|
||||
CCMenuItemFont* title4 = CCMenuItemFont::itemWithString( "Orientation" );
|
||||
title4->setIsEnabled(false);
|
||||
CCMenuItemFont::setFontName( "Marker Felt" );
|
||||
CCMenuItemFont::setFontSize(34);
|
||||
CCMenuItemToggle *item4 = CCMenuItemToggle::itemWithTarget( this,
|
||||
menu_selector(MenuLayer4::menuCallback),
|
||||
CCMenuItemFont::itemFromString( "Off" ),
|
||||
CCMenuItemFont::itemWithString( "Off" ),
|
||||
NULL );
|
||||
|
||||
//UxArray* more_items = UxArray::arrayWithObjects(
|
||||
// CCMenuItemFont::itemFromString( "33%" ),
|
||||
// CCMenuItemFont::itemFromString( "66%" ),
|
||||
// CCMenuItemFont::itemFromString( "100%" ),
|
||||
// CCMenuItemFont::itemWithString( "33%" ),
|
||||
// CCMenuItemFont::itemWithString( "66%" ),
|
||||
// CCMenuItemFont::itemWithString( "100%" ),
|
||||
// NULL );
|
||||
// TIP: you can manipulate the items like any other CCMutableArray
|
||||
item4->getSubItems()->addObject( CCMenuItemFont::itemFromString( "33%" ) );
|
||||
item4->getSubItems()->addObject( CCMenuItemFont::itemFromString( "66%" ) );
|
||||
item4->getSubItems()->addObject( CCMenuItemFont::itemFromString( "100%" ) );
|
||||
item4->getSubItems()->addObject( CCMenuItemFont::itemWithString( "33%" ) );
|
||||
item4->getSubItems()->addObject( CCMenuItemFont::itemWithString( "66%" ) );
|
||||
item4->getSubItems()->addObject( CCMenuItemFont::itemWithString( "100%" ) );
|
||||
|
||||
// you can change the one of the items by doing this
|
||||
item4->setSelectedIndex( 2 );
|
||||
|
|
|
@ -28,7 +28,7 @@ void MotionStreakTest1::onEnter()
|
|||
m_target->setPosition( CCPointMake(100,0) );
|
||||
|
||||
// create the streak object and add it to the scene
|
||||
m_streak = CCMotionStreak::streakWithFade(2, 3, s_streak, 32, 32, ccc4(0,255,0,255) );
|
||||
m_streak = CCMotionStreak::streakWithFade(2, 3, 32, ccGREEN, s_streak);
|
||||
addChild( m_streak );
|
||||
// schedule an update on each frame so we can syncronize the streak with the target
|
||||
schedule(schedule_selector(MotionStreakTest1::onUpdate));
|
||||
|
@ -66,7 +66,7 @@ void MotionStreakTest2::onEnter()
|
|||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
// create the streak object and add it to the scene
|
||||
m_streak = CCMotionStreak::streakWithFade(3, 3, s_streak, 64, 32, ccc4(255,255,255,255) );
|
||||
m_streak = CCMotionStreak::streakWithFade(3, 3, 64, ccWHITE, s_streak );
|
||||
addChild( m_streak );
|
||||
|
||||
m_streak->setPosition( CCPointMake(s.width/2, s.height/2) );
|
||||
|
@ -172,9 +172,9 @@ void MotionStreakTest::onEnter()
|
|||
addChild(label, 1);
|
||||
label->setPosition( CCPointMake(s.width/2, s.height-50) );
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(MotionStreakTest::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(MotionStreakTest::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(MotionStreakTest::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(MotionStreakTest::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(MotionStreakTest::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(MotionStreakTest::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
|
|
@ -247,9 +247,9 @@ void ParallaxDemo::onEnter()
|
|||
addChild(label, 1);
|
||||
label->setPosition( ccp(s.width/2, s.height-50) );
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(ParallaxDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(ParallaxDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(ParallaxDemo::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(ParallaxDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(ParallaxDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(ParallaxDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
|
|
@ -1065,15 +1065,15 @@ ParticleDemo::ParticleDemo(void)
|
|||
tapScreen->setPosition( CCPointMake(s.width/2, s.height-80) );
|
||||
addChild(tapScreen, 100);
|
||||
|
||||
CCMenuItemImage* item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(ParticleDemo::backCallback) );
|
||||
CCMenuItemImage* item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(ParticleDemo::restartCallback) );
|
||||
CCMenuItemImage* item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(ParticleDemo::nextCallback) );
|
||||
CCMenuItemImage* item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(ParticleDemo::backCallback) );
|
||||
CCMenuItemImage* item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(ParticleDemo::restartCallback) );
|
||||
CCMenuItemImage* item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(ParticleDemo::nextCallback) );
|
||||
|
||||
CCMenuItemToggle* item4 = CCMenuItemToggle::itemWithTarget( this,
|
||||
menu_selector(ParticleDemo::toggleCallback),
|
||||
CCMenuItemFont::itemFromString( "Free Movement" ),
|
||||
CCMenuItemFont::itemFromString( "Relative Movement" ),
|
||||
CCMenuItemFont::itemFromString( "Grouped Movement" ),
|
||||
CCMenuItemFont::itemWithString( "Free Movement" ),
|
||||
CCMenuItemFont::itemWithString( "Relative Movement" ),
|
||||
CCMenuItemFont::itemWithString( "Grouped Movement" ),
|
||||
NULL );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, item4, NULL);
|
||||
|
|
|
@ -92,9 +92,9 @@ void NodeChildrenMainScene::initWithQuantityOfNodes(unsigned int nNodes)
|
|||
quantityOfNodes = nNodes;
|
||||
|
||||
CCMenuItemFont::setFontSize(65);
|
||||
CCMenuItemFont *decrease = CCMenuItemFont::itemFromString(" - ", this, menu_selector(NodeChildrenMainScene::onDecrease));
|
||||
CCMenuItemFont *decrease = CCMenuItemFont::itemWithString(" - ", this, menu_selector(NodeChildrenMainScene::onDecrease));
|
||||
decrease->setColor(ccc3(0,200,20));
|
||||
CCMenuItemFont *increase = CCMenuItemFont::itemFromString(" + ", this, menu_selector(NodeChildrenMainScene::onIncrease));
|
||||
CCMenuItemFont *increase = CCMenuItemFont::itemWithString(" + ", this, menu_selector(NodeChildrenMainScene::onIncrease));
|
||||
increase->setColor(ccc3(0,200,20));
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(decrease, increase, NULL);
|
||||
|
|
|
@ -79,9 +79,9 @@ void ParticleMainScene::initWithSubTest(int asubtest, int particles)
|
|||
quantityParticles = particles;
|
||||
|
||||
CCMenuItemFont::setFontSize(65);
|
||||
CCMenuItemFont *decrease = CCMenuItemFont::itemFromString(" - ", this, menu_selector(ParticleMainScene::onDecrease));
|
||||
CCMenuItemFont *decrease = CCMenuItemFont::itemWithString(" - ", this, menu_selector(ParticleMainScene::onDecrease));
|
||||
decrease->setColor(ccc3(0,200,20));
|
||||
CCMenuItemFont *increase = CCMenuItemFont::itemFromString(" + ", this, menu_selector(ParticleMainScene::onIncrease));
|
||||
CCMenuItemFont *increase = CCMenuItemFont::itemWithString(" + ", this, menu_selector(ParticleMainScene::onIncrease));
|
||||
increase->setColor(ccc3(0,200,20));
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(decrease, increase, NULL);
|
||||
|
@ -111,7 +111,7 @@ void ParticleMainScene::initWithSubTest(int asubtest, int particles)
|
|||
{
|
||||
char str[10] = {0};
|
||||
sprintf(str, "%d ", i);
|
||||
CCMenuItemFont* itemFont = CCMenuItemFont::itemFromString(str, this, menu_selector(ParticleMainScene::testNCallback));
|
||||
CCMenuItemFont* itemFont = CCMenuItemFont::itemWithString(str, this, menu_selector(ParticleMainScene::testNCallback));
|
||||
itemFont->setTag(i);
|
||||
pSubMenu->addChild(itemFont, 10);
|
||||
|
||||
|
@ -176,11 +176,11 @@ void ParticleMainScene::createParticleSystem()
|
|||
CCTexture2D *texture = CCTextureCache::sharedTextureCache()->addImage("Images/fire.png");
|
||||
CCTextureCache::sharedTextureCache()->removeTexture(texture);
|
||||
|
||||
if (subtestNumber <= 3)
|
||||
{
|
||||
particleSystem = new CCParticleSystemPoint();
|
||||
}
|
||||
else
|
||||
//TODO: if (subtestNumber <= 3)
|
||||
// {
|
||||
// particleSystem = new CCParticleSystemPoint();
|
||||
// }
|
||||
// else
|
||||
{
|
||||
particleSystem = new CCParticleSystemQuad();
|
||||
}
|
||||
|
|
|
@ -287,9 +287,9 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes)
|
|||
quantityNodes = 0;
|
||||
|
||||
CCMenuItemFont::setFontSize(65);
|
||||
CCMenuItemFont *decrease = CCMenuItemFont::itemFromString(" - ", this, menu_selector(SpriteMainScene::onDecrease));
|
||||
CCMenuItemFont *decrease = CCMenuItemFont::itemWithString(" - ", this, menu_selector(SpriteMainScene::onDecrease));
|
||||
decrease->setColor(ccc3(0,200,20));
|
||||
CCMenuItemFont *increase = CCMenuItemFont::itemFromString(" + ", this, menu_selector(SpriteMainScene::onIncrease));
|
||||
CCMenuItemFont *increase = CCMenuItemFont::itemWithString(" + ", this, menu_selector(SpriteMainScene::onIncrease));
|
||||
increase->setColor(ccc3(0,200,20));
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(decrease, increase, NULL);
|
||||
|
@ -314,7 +314,7 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes)
|
|||
{
|
||||
char str[10] = {0};
|
||||
sprintf(str, "%d ", i);
|
||||
CCMenuItemFont* itemFont = CCMenuItemFont::itemFromString(str, this, menu_selector(SpriteMainScene::testNCallback));
|
||||
CCMenuItemFont* itemFont = CCMenuItemFont::itemWithString(str, this, menu_selector(SpriteMainScene::testNCallback));
|
||||
itemFont->setTag(i);
|
||||
pSubMenu->addChild(itemFont, 10);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ void PerformanceMainLayer::onEnter()
|
|||
CCMenuItemFont::setFontSize(24);
|
||||
for (int i = 0; i < MAX_COUNT; ++i)
|
||||
{
|
||||
CCMenuItemFont* pItem = CCMenuItemFont::itemFromString(testsName[i].c_str(), this,
|
||||
CCMenuItemFont* pItem = CCMenuItemFont::itemWithString(testsName[i].c_str(), this,
|
||||
menu_selector(PerformanceMainLayer::menuCallback));
|
||||
pItem->setPosition(ccp(s.width / 2, s.height - (i + 1) * LINE_SPACE));
|
||||
pMenu->addChild(pItem, kItemTagBasic + i);
|
||||
|
@ -96,7 +96,7 @@ void PerformBasicLayer::onEnter()
|
|||
|
||||
CCMenuItemFont::setFontName("Arial");
|
||||
CCMenuItemFont::setFontSize(24);
|
||||
CCMenuItemFont* pMainItem = CCMenuItemFont::itemFromString("Back", this,
|
||||
CCMenuItemFont* pMainItem = CCMenuItemFont::itemWithString("Back", this,
|
||||
menu_selector(PerformBasicLayer::toMainLayer));
|
||||
pMainItem->setPosition(ccp(s.width - 50, 25));
|
||||
CCMenu* pMenu = CCMenu::menuWithItems(pMainItem, NULL);
|
||||
|
@ -104,9 +104,9 @@ void PerformBasicLayer::onEnter()
|
|||
|
||||
if (m_bControlMenuVisible)
|
||||
{
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(PerformBasicLayer::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(PerformBasicLayer::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(PerformBasicLayer::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(PerformBasicLayer::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(PerformBasicLayer::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(PerformBasicLayer::nextCallback) );
|
||||
item1->setPosition( ccp( s.width/2 - 100,30) );
|
||||
item2->setPosition( ccp( s.width/2, 30) );
|
||||
item3->setPosition( ccp( s.width/2 + 100,30) );
|
||||
|
|
|
@ -102,9 +102,9 @@ void SpriteDemo::onEnter()
|
|||
l->setPosition( CCPointMake(s.width/2, s.height-80) );
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(SpriteDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(SpriteDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(SpriteDemo::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(SpriteDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(SpriteDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(SpriteDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
|
|
@ -71,9 +71,9 @@ void RenderTextureTestDemo::onEnter()
|
|||
l->setPosition( ccp(s.width/2, s.height-80) );
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage("Images/b1.png", "Images/b2.png", this, menu_selector(RenderTextureTestDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage("Images/r1.png","Images/r2.png", this, menu_selector(RenderTextureTestDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage("Images/f1.png", "Images/f2.png", this, menu_selector(RenderTextureTestDemo::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage("Images/b1.png", "Images/b2.png", this, menu_selector(RenderTextureTestDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage("Images/r1.png","Images/r2.png", this, menu_selector(RenderTextureTestDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage("Images/f1.png", "Images/f2.png", this, menu_selector(RenderTextureTestDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
@ -123,9 +123,9 @@ std::string RenderTextureTestDemo::subtitle()
|
|||
RenderTextureTest::RenderTextureTest()
|
||||
: m_brush(NULL)
|
||||
{
|
||||
if (CCConfiguration::sharedConfiguration()->getGlesVersion() <= GLES_VER_1_0)
|
||||
if (CCConfiguration::sharedConfiguration()->getGlesVersion() < GLES_VER_2_0)
|
||||
{
|
||||
CCMessageBox("The Opengl ES version is lower than 1.1, and the test may not run correctly.", "Cocos2d-x Hint");
|
||||
CCMessageBox("The Opengl ES version is lower than 2.0, and the test may not run correctly.", "Cocos2d-x Hint");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -251,8 +251,8 @@ RenderTextureSave::RenderTextureSave()
|
|||
|
||||
// Save Image menu
|
||||
CCMenuItemFont::setFontSize(16);
|
||||
CCMenuItem *item1 = CCMenuItemFont::itemFromString("Save Image", this, menu_selector(RenderTextureSave::saveImage));
|
||||
CCMenuItem *item2 = CCMenuItemFont::itemFromString("Clear", this, menu_selector(RenderTextureSave::clearImage));
|
||||
CCMenuItem *item1 = CCMenuItemFont::itemWithString("Save Image", this, menu_selector(RenderTextureSave::saveImage));
|
||||
CCMenuItem *item2 = CCMenuItemFont::itemWithString("Clear", this, menu_selector(RenderTextureSave::clearImage));
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, NULL);
|
||||
this->addChild(menu);
|
||||
menu->alignItemsVertically();
|
||||
|
|
|
@ -18,9 +18,9 @@ enum
|
|||
|
||||
SceneTestLayer1::SceneTestLayer1()
|
||||
{
|
||||
CCMenuItemFont* item1 = CCMenuItemFont::itemFromString( "Test pushScene", this, menu_selector(SceneTestLayer1::onPushScene) );
|
||||
CCMenuItemFont* item2 = CCMenuItemFont::itemFromString( "Test pushScene w/transition", this, menu_selector(SceneTestLayer1::onPushSceneTran) );
|
||||
CCMenuItemFont* item3 = CCMenuItemFont::itemFromString( "Quit", this, menu_selector(SceneTestLayer1::onQuit) );
|
||||
CCMenuItemFont* item1 = CCMenuItemFont::itemWithString( "Test pushScene", this, menu_selector(SceneTestLayer1::onPushScene) );
|
||||
CCMenuItemFont* item2 = CCMenuItemFont::itemWithString( "Test pushScene w/transition", this, menu_selector(SceneTestLayer1::onPushSceneTran) );
|
||||
CCMenuItemFont* item3 = CCMenuItemFont::itemWithString( "Quit", this, menu_selector(SceneTestLayer1::onQuit) );
|
||||
|
||||
CCMenu* menu = CCMenu::menuWithItems( item1, item2, item3, NULL );
|
||||
menu->alignItemsVertically();
|
||||
|
@ -103,9 +103,9 @@ SceneTestLayer2::SceneTestLayer2()
|
|||
{
|
||||
m_timeCounter = 0;
|
||||
|
||||
CCMenuItemFont* item1 = CCMenuItemFont::itemFromString( "replaceScene", this, menu_selector(SceneTestLayer2::onReplaceScene) );
|
||||
CCMenuItemFont* item2 = CCMenuItemFont::itemFromString( "replaceScene w/transition", this, menu_selector(SceneTestLayer2::onReplaceSceneTran) );
|
||||
CCMenuItemFont* item3 = CCMenuItemFont::itemFromString( "Go Back", this, menu_selector(SceneTestLayer2::onGoBack) );
|
||||
CCMenuItemFont* item1 = CCMenuItemFont::itemWithString( "replaceScene", this, menu_selector(SceneTestLayer2::onReplaceScene) );
|
||||
CCMenuItemFont* item2 = CCMenuItemFont::itemWithString( "replaceScene w/transition", this, menu_selector(SceneTestLayer2::onReplaceSceneTran) );
|
||||
CCMenuItemFont* item3 = CCMenuItemFont::itemWithString( "Go Back", this, menu_selector(SceneTestLayer2::onGoBack) );
|
||||
|
||||
CCMenu* menu = CCMenu::menuWithItems( item1, item2, item3, NULL );
|
||||
menu->alignItemsVertically();
|
||||
|
|
|
@ -88,9 +88,9 @@ void SchedulerTestLayer::onEnter()
|
|||
l->setPosition(ccp(s.width/2, s.height-80));
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage("Images/b1.png", "Images/b2.png", this, menu_selector(SchedulerTestLayer::backCallback));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage("Images/r1.png","Images/r2.png", this, menu_selector(SchedulerTestLayer::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage("Images/f1.png", "Images/f2.png", this, menu_selector(SchedulerTestLayer::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage("Images/b1.png", "Images/b2.png", this, menu_selector(SchedulerTestLayer::backCallback));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage("Images/r1.png","Images/r2.png", this, menu_selector(SchedulerTestLayer::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage("Images/f1.png", "Images/f2.png", this, menu_selector(SchedulerTestLayer::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
|
@ -208,7 +208,7 @@ void SchedulerPauseResume::tick2(ccTime dt)
|
|||
|
||||
void SchedulerPauseResume::pause(ccTime dt)
|
||||
{
|
||||
CCScheduler::sharedScheduler()->pauseTarget(this);
|
||||
CCDirector::sharedDirector()->getScheduler()->pauseTarget(this);
|
||||
}
|
||||
|
||||
std::string SchedulerPauseResume::title()
|
||||
|
@ -310,7 +310,7 @@ void SchedulerUnscheduleAllHard::tick4(ccTime dt)
|
|||
|
||||
void SchedulerUnscheduleAllHard::unscheduleAll(ccTime dt)
|
||||
{
|
||||
CCScheduler::sharedScheduler()->unscheduleAllSelectors();
|
||||
CCDirector::sharedDirector()->getScheduler()->unscheduleAllSelectors();
|
||||
}
|
||||
|
||||
std::string SchedulerUnscheduleAllHard::title()
|
||||
|
|
|
@ -1 +1 @@
|
|||
ea35cf50d699b85c3eb96c756181f00f63c96d5b
|
||||
cdf36e6207270fa69d2377a36df318a2545b6833
|
|
@ -353,14 +353,6 @@ public:
|
|||
virtual std::string title();
|
||||
};
|
||||
|
||||
class SpriteBatchNodeChildren2: public SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
SpriteBatchNodeChildren2();
|
||||
virtual void onExit();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
class SpriteBatchNodeChildrenZ : public SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -132,9 +132,9 @@ void TextInputTest::onEnter()
|
|||
l->setPosition(ccp(s.width/2, s.height-80));
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage("Images/b1.png", "Images/b2.png", this, menu_selector(TextInputTest::backCallback));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage("Images/r1.png","Images/r2.png", this, menu_selector(TextInputTest::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage("Images/f1.png", "Images/f2.png", this, menu_selector(TextInputTest::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage("Images/b1.png", "Images/b2.png", this, menu_selector(TextInputTest::backCallback));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage("Images/r1.png","Images/r2.png", this, menu_selector(TextInputTest::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage("Images/f1.png", "Images/f2.png", this, menu_selector(TextInputTest::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
|
|
|
@ -138,9 +138,9 @@ void TextureDemo::onEnter()
|
|||
l->setPosition(ccp(s.width/2, s.height-80));
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(TextureDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(TextureDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(TextureDemo::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(TextureDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(TextureDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(TextureDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
|
@ -941,7 +941,7 @@ void TexturePixelFormat::onEnter()
|
|||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLayerColor *background = CCLayerColor::layerWithColorWidthHeight(ccc4(128,128,128,255), s.width, s.height);
|
||||
CCLayerColor *background = CCLayerColor::layerWithColor(ccc4(128,128,128,255), s.width, s.height);
|
||||
addChild(background, -1);
|
||||
|
||||
// RGBA 8888 image (32-bit)
|
||||
|
|
|
@ -816,11 +816,11 @@ TMXIsoZorder::TMXIsoZorder()
|
|||
map->addChild(m_tamara, map->getChildren()->count() );
|
||||
m_tamara->retain();
|
||||
int mapWidth = map->getMapSize().width * map->getTileSize().width;
|
||||
m_tamara->setPositionInPixels(ccp( mapWidth/2,0));
|
||||
m_tamara->setPosition(CC_POINT_PIXELS_TO_POINTS(ccp( mapWidth/2,0)));
|
||||
m_tamara->setAnchorPoint(ccp(0.5f,0));
|
||||
|
||||
|
||||
CCActionInterval* move = CCMoveBy::actionWithDuration(10, ccpMult(ccp(300,250), 1/CC_CONTENT_SCALE_FACTOR()));
|
||||
CCActionInterval* move = CCMoveBy::actionWithDuration(10, ccp(300,250));
|
||||
CCActionInterval* back = move->reverse();
|
||||
CCFiniteTimeAction* seq = CCSequence::actions(move, back,NULL);
|
||||
m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*) seq) );
|
||||
|
@ -841,7 +841,8 @@ void TMXIsoZorder::onExit()
|
|||
|
||||
void TMXIsoZorder::repositionSprite(ccTime dt)
|
||||
{
|
||||
CCPoint p = m_tamara->getPositionInPixels();
|
||||
CCPoint p = m_tamara->getPosition();
|
||||
p = CC_POINT_POINTS_TO_PIXELS(p);
|
||||
CCNode *map = getChildByTag(kTagTileMap);
|
||||
|
||||
// there are only 4 layers. (grass and 3 trees layers)
|
||||
|
@ -885,7 +886,7 @@ TMXOrthoZorder::TMXOrthoZorder()
|
|||
m_tamara->setAnchorPoint(ccp(0.5f,0));
|
||||
|
||||
|
||||
CCActionInterval* move = CCMoveBy::actionWithDuration(10, ccpMult(ccp(400,450), 1/CC_CONTENT_SCALE_FACTOR() ));
|
||||
CCActionInterval* move = CCMoveBy::actionWithDuration(10, ccp(400,450));
|
||||
CCActionInterval* back = move->reverse();
|
||||
CCFiniteTimeAction* seq = CCSequence::actions(move, back,NULL);
|
||||
m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq));
|
||||
|
@ -900,7 +901,8 @@ TMXOrthoZorder::~TMXOrthoZorder()
|
|||
|
||||
void TMXOrthoZorder::repositionSprite(ccTime dt)
|
||||
{
|
||||
CCPoint p = m_tamara->getPositionInPixels();
|
||||
CCPoint p = m_tamara->getPosition();
|
||||
p = CC_POINT_POINTS_TO_PIXELS(p);
|
||||
CCNode* map = getChildByTag(kTagTileMap);
|
||||
|
||||
// there are only 4 layers. (grass and 3 trees layers)
|
||||
|
@ -964,8 +966,10 @@ void TMXIsoVertexZ::repositionSprite(ccTime dt)
|
|||
{
|
||||
// tile height is 64x32
|
||||
// map size: 30x30
|
||||
CCPoint p = m_tamara->getPositionInPixels();
|
||||
m_tamara->setVertexZ( -( (p.y+32) /16) );
|
||||
CCPoint p = m_tamara->getPosition();
|
||||
p = CC_POINT_POINTS_TO_PIXELS(p);
|
||||
float newZ = -(p.y+32) /16;
|
||||
m_tamara->setVertexZ( newZ );
|
||||
}
|
||||
|
||||
void TMXIsoVertexZ::onEnter()
|
||||
|
@ -1032,7 +1036,8 @@ void TMXOrthoVertexZ::repositionSprite(ccTime dt)
|
|||
{
|
||||
// tile height is 101x81
|
||||
// map size: 12x12
|
||||
CCPoint p = m_tamara->getPositionInPixels();
|
||||
CCPoint p = m_tamara->getPosition();
|
||||
p = CC_POINT_POINTS_TO_PIXELS(p);
|
||||
m_tamara->setVertexZ( -( (p.y+81) /81) );
|
||||
}
|
||||
|
||||
|
@ -1280,9 +1285,9 @@ TileDemo::TileDemo(void)
|
|||
m_subtitle->retain();
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(TileDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(TileDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(TileDemo::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(TileDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(TileDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(TileDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
|
|
@ -220,9 +220,9 @@ CCTransitionScene* createTransition(int nIndex, ccTime t, CCScene* s)
|
|||
case 24: return CCTransitionSlideInB::transitionWithDuration(t, s);
|
||||
case 25:
|
||||
{
|
||||
if (CCConfiguration::sharedConfiguration()->getGlesVersion() <= GLES_VER_1_0)
|
||||
if (CCConfiguration::sharedConfiguration()->getGlesVersion() < GLES_VER_2_0)
|
||||
{
|
||||
CCMessageBox("The Opengl ES version is lower than 1.1, and TransitionCrossFade may not run correctly, it is ignored.", "Cocos2d-x Hint");
|
||||
CCMessageBox("The Opengl ES version is lower than 2.0, and TransitionCrossFade may not run correctly, it is ignored.", "Cocos2d-x Hint");
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
|
@ -233,27 +233,27 @@ CCTransitionScene* createTransition(int nIndex, ccTime t, CCScene* s)
|
|||
break;
|
||||
case 26:
|
||||
{
|
||||
if (CCConfiguration::sharedConfiguration()->getGlesVersion() <= GLES_VER_1_0)
|
||||
if (CCConfiguration::sharedConfiguration()->getGlesVersion() < GLES_VER_2_0)
|
||||
{
|
||||
CCMessageBox("The Opengl ES version is lower than 1.1, and TransitionRadialCCW may not run correctly, it is ignored.", "Cocos2d-x Hint");
|
||||
CCMessageBox("The Opengl ES version is lower than 2.0, and TransitionRadialCCW may not run correctly, it is ignored.", "Cocos2d-x Hint");
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CCTransitionRadialCCW::transitionWithDuration(t,s);
|
||||
return NULL;// TODO: CCTransitionRadialCCW::transitionWithDuration(t,s);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 27:
|
||||
{
|
||||
if (CCConfiguration::sharedConfiguration()->getGlesVersion() <= GLES_VER_1_0)
|
||||
if (CCConfiguration::sharedConfiguration()->getGlesVersion() < GLES_VER_2_0)
|
||||
{
|
||||
CCMessageBox("The Opengl ES version is lower than 1.1, and TransitionRadialCW may not run correctly, it is ignored.", "Cocos2d-x Hint");
|
||||
CCMessageBox("The Opengl ES version is lower than 2.0, and TransitionRadialCW may not run correctly, it is ignored.", "Cocos2d-x Hint");
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CCTransitionRadialCW::transitionWithDuration(t,s);
|
||||
return NULL;// TODO: CCTransitionRadialCW::transitionWithDuration(t,s);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -305,9 +305,9 @@ TestLayer1::TestLayer1(void)
|
|||
addChild( label);
|
||||
|
||||
// menu
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(TestLayer1::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(TestLayer1::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(TestLayer1::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(TestLayer1::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(TestLayer1::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(TestLayer1::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
@ -410,9 +410,9 @@ TestLayer2::TestLayer2()
|
|||
addChild( label);
|
||||
|
||||
// menu
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(TestLayer2::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(TestLayer2::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(TestLayer2::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(TestLayer2::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(TestLayer2::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(TestLayer2::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
|
|
@ -74,9 +74,9 @@ void ZwoptexTest::onEnter()
|
|||
l->setPosition(ccp(s.width/2, s.height-80));
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(ZwoptexTest::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(ZwoptexTest::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(ZwoptexTest::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(ZwoptexTest::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(ZwoptexTest::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemWithNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(ZwoptexTest::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
|
@ -132,7 +132,7 @@ void ZwoptexGenericTest::onEnter()
|
|||
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("zwoptex/grossini.plist");
|
||||
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("zwoptex/grossini-generic.plist");
|
||||
|
||||
CCLayerColor *layer1 = CCLayerColor::layerWithColorWidthHeight(ccc4(255, 0, 0, 255), 85, 121);
|
||||
CCLayerColor *layer1 = CCLayerColor::layerWithColor(ccc4(255, 0, 0, 255), 85, 121);
|
||||
layer1->setPosition(ccp(s.width/2-80 - (85.0f * 0.5f), s.height/2 - (121.0f * 0.5f)));
|
||||
addChild(layer1);
|
||||
|
||||
|
@ -143,7 +143,7 @@ void ZwoptexGenericTest::onEnter()
|
|||
sprite1->setFlipX(false);
|
||||
sprite1->setFlipY(false);
|
||||
|
||||
CCLayerColor *layer2 = CCLayerColor::layerWithColorWidthHeight(ccc4(255, 0, 0, 255), 85, 121);
|
||||
CCLayerColor *layer2 = CCLayerColor::layerWithColor(ccc4(255, 0, 0, 255), 85, 121);
|
||||
layer2->setPosition(ccp(s.width/2+80 - (85.0f * 0.5f), s.height/2 - (121.0f * 0.5f)));
|
||||
addChild(layer2);
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ static TestScene* CreateTestScene(int nIdx)
|
|||
pScene = new ActionsTestScene(); break;
|
||||
case TEST_TRANSITIONS:
|
||||
pScene = new TransitionsTestScene(); break;
|
||||
case TEST_PROGRESS_ACTIONS:
|
||||
pScene = new ProgressActionsTestScene(); break;
|
||||
//TODO: case TEST_PROGRESS_ACTIONS:
|
||||
// pScene = new ProgressActionsTestScene(); break;
|
||||
case TEST_EFFECTS:
|
||||
pScene = new EffectTestScene(); break;
|
||||
case TEST_CLICK_AND_MOVE:
|
||||
|
@ -53,16 +53,17 @@ static TestScene* CreateTestScene(int nIdx)
|
|||
case TEST_INTERVAL:
|
||||
pScene = new IntervalTestScene(); break;
|
||||
case TEST_CHIPMUNK:
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
pScene = new ChipmunkTestScene(); break;
|
||||
#else
|
||||
#ifdef MARMALADEUSECHIPMUNK
|
||||
#if (MARMALADEUSECHIPMUNK == 1)
|
||||
pScene = new ChipmunkTestScene();
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
// TODO:
|
||||
// #if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
// pScene = new ChipmunkTestScene(); break;
|
||||
// #else
|
||||
// #ifdef MARMALADEUSECHIPMUNK
|
||||
// #if (MARMALADEUSECHIPMUNK == 1)
|
||||
// pScene = new ChipmunkTestScene();
|
||||
// #endif
|
||||
// break;
|
||||
// #endif
|
||||
// #endif
|
||||
case TEST_LABEL:
|
||||
pScene = new AtlasTestScene(); break;
|
||||
case TEST_TEXT_INPUT:
|
||||
|
@ -76,9 +77,9 @@ static TestScene* CreateTestScene(int nIdx)
|
|||
case TEST_TEXTURE2D:
|
||||
pScene = new TextureTestScene(); break;
|
||||
case TEST_BOX2D:
|
||||
pScene = new Box2DTestScene(); break;
|
||||
//TODO: pScene = new Box2DTestScene(); break;
|
||||
case TEST_BOX2DBED:
|
||||
pScene = new Box2dTestBedScene(); break;
|
||||
//TODO: pScene = new Box2dTestBedScene(); break;
|
||||
case TEST_EFFECT_ADVANCE:
|
||||
pScene = new EffectAdvanceScene(); break;
|
||||
case TEST_HIRES:
|
||||
|
@ -131,7 +132,7 @@ TestController::TestController()
|
|||
: m_tBeginPos(CCPointZero)
|
||||
{
|
||||
// add close menu
|
||||
CCMenuItemImage *pCloseItem = CCMenuItemImage::itemFromNormalImage(s_pPathClose, s_pPathClose, this, menu_selector(TestController::closeCallback) );
|
||||
CCMenuItemImage *pCloseItem = CCMenuItemImage::itemWithNormalImage(s_pPathClose, s_pPathClose, this, menu_selector(TestController::closeCallback) );
|
||||
CCMenu* pMenu =CCMenu::menuWithItems(pCloseItem, NULL);
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
|
|
Loading…
Reference in New Issue