mirror of https://github.com/axmolengine/axmol.git
issue #1310: Tests project updated!.
This commit is contained in:
parent
a40dfa427a
commit
371b3f9938
|
@ -357,7 +357,7 @@ void CCDirector::setProjection(ccDirectorProjection kProjection)
|
|||
|
||||
case kCCDirectorProjection3D:
|
||||
{
|
||||
//cjh // reset the viewport if 3d proj & retina display
|
||||
//TODO: // reset the viewport if 3d proj & retina display
|
||||
// if( CC_CONTENT_SCALE_FACTOR() != 1.0f )
|
||||
// {
|
||||
// glViewport((GLint)-size.width/2, (GLint)-size.height/2, (GLsizei)(size.width * CC_CONTENT_SCALE_FACTOR()), (GLsizei)(size.height * CC_CONTENT_SCALE_FACTOR()) );
|
||||
|
@ -374,7 +374,7 @@ void CCDirector::setProjection(ccDirectorProjection kProjection)
|
|||
kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, zeye*2);
|
||||
// kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, 1500);
|
||||
|
||||
//cjh if (m_pobOpenGLView && m_pobOpenGLView->isIpad() && m_pobOpenGLView->getMainScreenScale() > 1.0f)
|
||||
//TODO: if (m_pobOpenGLView && m_pobOpenGLView->isIpad() && m_pobOpenGLView->getMainScreenScale() > 1.0f)
|
||||
// {
|
||||
// kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, zeye-size.height/2, zeye+size.height/2);
|
||||
// }
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#if CCB_READER_VERSION == 1
|
||||
|
||||
#include "CCBReader.h"
|
||||
#include "CCBCustomClass.h"
|
||||
|
||||
#if CCB_READER_VERSION == 1
|
||||
|
||||
USING_NS_CC;
|
||||
USING_NS_CC_EXT;
|
||||
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#if CCB_READER_VERSION == 2
|
||||
|
||||
#include "CCBReader.h"
|
||||
#include "CCBCustomClass.h"
|
||||
|
||||
#if CCB_READER_VERSION == 2
|
||||
|
||||
USING_NS_CC;
|
||||
USING_NS_CC_EXT;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
pDirector->setOpenGLView(&CCEGLView::sharedOpenGLView());
|
||||
|
||||
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
|
||||
// pDirector->enableRetinaDisplay(true);
|
||||
pDirector->enableRetinaDisplay(true);
|
||||
|
||||
// turn on display FPS
|
||||
pDirector->setDisplayStats(true);
|
||||
|
|
|
@ -34,7 +34,7 @@ CCAffineTransform PhysicsSprite::nodeToParentTransform(void)
|
|||
float x = pos.x * PTM_RATIO;
|
||||
float y = pos.y * PTM_RATIO;
|
||||
|
||||
if ( !getIsRelativeAnchorPoint() ) {
|
||||
if ( getIgnoreAnchorPointForPosition() ) {
|
||||
x += m_tAnchorPointInPoints.x;
|
||||
y += m_tAnchorPointInPoints.y;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ bool Bug1159Layer::init()
|
|||
|
||||
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->setIgnoreAnchorPointForPosition(false);
|
||||
sprite_a->setPosition(ccp(0.0f, s.height/2));
|
||||
addChild(sprite_a);
|
||||
|
||||
|
@ -40,7 +40,7 @@ bool Bug1159Layer::init()
|
|||
|
||||
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->setIgnoreAnchorPointForPosition(false);
|
||||
sprite_b->setPosition(ccp(s.width/2, s.height/2));
|
||||
addChild(sprite_b);
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ bool Bug914Layer::init()
|
|||
layer->setContentSize(CCSizeMake(i*100, i*100));
|
||||
layer->setPosition(ccp(size.width/2, size.height/2));
|
||||
layer->setAnchorPoint(ccp(0.5f, 0.5f));
|
||||
layer->setIsRelativeAnchorPoint(true);
|
||||
layer->setIgnoreAnchorPointForPosition(false);
|
||||
addChild(layer, -1-i);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ CCAffineTransform ChipmunkPhysicsSprite::nodeToParentTransform(void)
|
|||
CCFloat x = m_pBody->p.x;
|
||||
CCFloat y = m_pBody->p.y;
|
||||
|
||||
if ( !getIsRelativeAnchorPoint() ) {
|
||||
if ( getIgnoreAnchorPointForPosition() ) {
|
||||
x += m_tAnchorPointInPoints.x;
|
||||
y += m_tAnchorPointInPoints.y;
|
||||
}
|
||||
|
|
|
@ -76,8 +76,8 @@ m_nSoundId(0)
|
|||
setIsTouchEnabled(true);
|
||||
|
||||
// preload background music and effect
|
||||
SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic( CCFileUtils::fullPathFromRelativePath(MUSIC_FILE) );
|
||||
SimpleAudioEngine::sharedEngine()->preloadEffect( CCFileUtils::fullPathFromRelativePath(EFFECT_FILE) );
|
||||
SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic( CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(MUSIC_FILE) );
|
||||
SimpleAudioEngine::sharedEngine()->preloadEffect( CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(EFFECT_FILE) );
|
||||
|
||||
// set default volume
|
||||
SimpleAudioEngine::sharedEngine()->setEffectsVolume(0.5);
|
||||
|
@ -106,7 +106,7 @@ void CocosDenshionTest::menuCallback(CCObject * pSender)
|
|||
// play background music
|
||||
case 0:
|
||||
|
||||
SimpleAudioEngine::sharedEngine()->playBackgroundMusic(std::string(CCFileUtils::fullPathFromRelativePath(MUSIC_FILE)).c_str(), true);
|
||||
SimpleAudioEngine::sharedEngine()->playBackgroundMusic(std::string(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(MUSIC_FILE)).c_str(), true);
|
||||
break;
|
||||
// stop background music
|
||||
case 1:
|
||||
|
@ -137,11 +137,11 @@ void CocosDenshionTest::menuCallback(CCObject * pSender)
|
|||
break;
|
||||
// play effect
|
||||
case 6:
|
||||
m_nSoundId = SimpleAudioEngine::sharedEngine()->playEffect(std::string(CCFileUtils::fullPathFromRelativePath(EFFECT_FILE)).c_str());
|
||||
m_nSoundId = SimpleAudioEngine::sharedEngine()->playEffect(std::string(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(EFFECT_FILE)).c_str());
|
||||
break;
|
||||
// play effect
|
||||
case 7:
|
||||
m_nSoundId = SimpleAudioEngine::sharedEngine()->playEffect(std::string(CCFileUtils::fullPathFromRelativePath(EFFECT_FILE)).c_str(), true);
|
||||
m_nSoundId = SimpleAudioEngine::sharedEngine()->playEffect(std::string(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(EFFECT_FILE)).c_str(), true);
|
||||
break;
|
||||
// stop effect
|
||||
case 8:
|
||||
|
@ -149,7 +149,7 @@ void CocosDenshionTest::menuCallback(CCObject * pSender)
|
|||
break;
|
||||
// unload effect
|
||||
case 9:
|
||||
SimpleAudioEngine::sharedEngine()->unloadEffect(std::string(CCFileUtils::fullPathFromRelativePath(EFFECT_FILE)).c_str());
|
||||
SimpleAudioEngine::sharedEngine()->unloadEffect(std::string(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(EFFECT_FILE)).c_str());
|
||||
break;
|
||||
// add bakcground music volume
|
||||
case 10:
|
||||
|
|
|
@ -75,9 +75,9 @@ void FontTest::showFont(const char *pFont)
|
|||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelTTF *top = CCLabelTTF::labelWithString(pFont, pFont, 24);
|
||||
CCLabelTTF *left = CCLabelTTF::labelWithString("alignment left", CCSizeMake(s.width, 50), CCTextAlignmentLeft, pFont, 32);
|
||||
CCLabelTTF *center = CCLabelTTF::labelWithString("alignment center", CCSizeMake(s.width, 50), CCTextAlignmentCenter, pFont, 32);
|
||||
CCLabelTTF *right = CCLabelTTF::labelWithString("alignment right", CCSizeMake(s.width, 50), CCTextAlignmentRight, pFont, 32);
|
||||
CCLabelTTF *left = CCLabelTTF::labelWithString("alignment left", CCSizeMake(s.width, 50), kCCTextAlignmentLeft, pFont, 32);
|
||||
CCLabelTTF *center = CCLabelTTF::labelWithString("alignment center", CCSizeMake(s.width, 50), kCCTextAlignmentCenter, pFont, 32);
|
||||
CCLabelTTF *right = CCLabelTTF::labelWithString("alignment right", CCSizeMake(s.width, 50), kCCTextAlignmentRight, pFont, 32);
|
||||
|
||||
top->setPosition(ccp(s.width/2, 250));
|
||||
left->setPosition(ccp(s.width/2, 200));
|
||||
|
|
|
@ -912,9 +912,9 @@ LabelTTFTest::LabelTTFTest()
|
|||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
// CCLabelBMFont
|
||||
CCLabelTTF *left = CCLabelTTF::labelWithString("align left", CCSizeMake(s.width, 50), CCTextAlignmentLeft, "Marker Felt", 32);
|
||||
CCLabelTTF *center = CCLabelTTF::labelWithString("align center", CCSizeMake(s.width, 50), CCTextAlignmentCenter, "Marker Felt", 32);
|
||||
CCLabelTTF *right = CCLabelTTF::labelWithString("align right", CCSizeMake(s.width, 50), CCTextAlignmentRight, "Marker Felt", 32);
|
||||
CCLabelTTF *left = CCLabelTTF::labelWithString("align left", CCSizeMake(s.width, 50), kCCTextAlignmentLeft, "Marker Felt", 32);
|
||||
CCLabelTTF *center = CCLabelTTF::labelWithString("align center", CCSizeMake(s.width, 50), kCCTextAlignmentCenter, "Marker Felt", 32);
|
||||
CCLabelTTF *right = CCLabelTTF::labelWithString("align right", CCSizeMake(s.width, 50), kCCTextAlignmentRight, "Marker Felt", 32);
|
||||
|
||||
left->setPosition(ccp(s.width / 2, 200));
|
||||
center->setPosition(ccp(s.width / 2, 150));
|
||||
|
@ -941,7 +941,7 @@ LabelTTFMultiline::LabelTTFMultiline()
|
|||
|
||||
// CCLabelBMFont
|
||||
CCLabelTTF *center = CCLabelTTF::labelWithString("word wrap \"testing\" (bla0) bla1 'bla2' [bla3] (bla4) {bla5} {bla6} [bla7] (bla8) [bla9] 'bla0' \"bla1\"",
|
||||
CCSizeMake(s.width / 2, 200), CCTextAlignmentCenter, "MarkerFelt.ttc", 32);
|
||||
CCSizeMake(s.width / 2, 200), kCCTextAlignmentCenter, "MarkerFelt.ttc", 32);
|
||||
center->setPosition(ccp(s.width / 2, 150));
|
||||
|
||||
addChild(center);
|
||||
|
@ -1010,7 +1010,7 @@ BitmapFontMultiLineAlignment::BitmapFontMultiLineAlignment()
|
|||
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
// create and initialize a Label
|
||||
this->m_pLabelShouldRetain = CCLabelBMFont::labelWithString(LongSentencesExample, "fonts/markerFelt.fnt", size.width/1.5, CCTextAlignmentCenter);
|
||||
this->m_pLabelShouldRetain = CCLabelBMFont::labelWithString(LongSentencesExample, "fonts/markerFelt.fnt", size.width/1.5, kCCTextAlignmentCenter);
|
||||
this->m_pLabelShouldRetain->retain();
|
||||
|
||||
this->m_pArrowsBarShouldRetain = CCSprite::spriteWithFile("Images/arrowsBar.png");
|
||||
|
@ -1119,13 +1119,13 @@ void BitmapFontMultiLineAlignment::alignmentChanged(cocos2d::CCObject *sender)
|
|||
switch(item->getTag())
|
||||
{
|
||||
case LeftAlign:
|
||||
this->m_pLabelShouldRetain->setAlignment(CCTextAlignmentLeft);
|
||||
this->m_pLabelShouldRetain->setAlignment(kCCTextAlignmentLeft);
|
||||
break;
|
||||
case CenterAlign:
|
||||
this->m_pLabelShouldRetain->setAlignment(CCTextAlignmentCenter);
|
||||
this->m_pLabelShouldRetain->setAlignment(kCCTextAlignmentCenter);
|
||||
break;
|
||||
case RightAlign:
|
||||
this->m_pLabelShouldRetain->setAlignment(CCTextAlignmentRight);
|
||||
this->m_pLabelShouldRetain->setAlignment(kCCTextAlignmentRight);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1217,11 +1217,11 @@ BMFontOneAtlas::BMFontOneAtlas()
|
|||
{
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelBMFont *label1 = CCLabelBMFont::labelWithString("This is Helvetica", "fonts/helvetica-32.fnt", kCCLabelAutomaticWidth, CCTextAlignmentLeft, CCPointZero);
|
||||
CCLabelBMFont *label1 = CCLabelBMFont::labelWithString("This is Helvetica", "fonts/helvetica-32.fnt", kCCLabelAutomaticWidth, kCCTextAlignmentLeft, CCPointZero);
|
||||
addChild(label1);
|
||||
label1->setPosition(ccp(s.width/2, s.height/3*2));
|
||||
|
||||
CCLabelBMFont *label2 = CCLabelBMFont::labelWithString("And this is Geneva", "fonts/geneva-32.fnt", kCCLabelAutomaticWidth, CCTextAlignmentLeft, ccp(0, 128));
|
||||
CCLabelBMFont *label2 = CCLabelBMFont::labelWithString("And this is Geneva", "fonts/geneva-32.fnt", kCCLabelAutomaticWidth, kCCTextAlignmentLeft, ccp(0, 128));
|
||||
addChild(label2);
|
||||
label2->setPosition(ccp(s.width/2, s.height/3*1));
|
||||
}
|
||||
|
@ -1247,7 +1247,7 @@ BMFontUnicode::BMFontUnicode()
|
|||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelBMFont *label1 = CCLabelBMFont::labelWithString(spanish, "fonts/arial-unicode-26.fnt", 200, CCTextAlignmentLeft);
|
||||
CCLabelBMFont *label1 = CCLabelBMFont::labelWithString(spanish, "fonts/arial-unicode-26.fnt", 200, kCCTextAlignmentLeft);
|
||||
addChild(label1);
|
||||
label1->setPosition(ccp(s.width/2, s.height/4*3));
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ void LayerTest1::onEnter()
|
|||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLayerColor* layer = CCLayerColor::layerWithColor( ccc4(0xFF, 0x00, 0x00, 0x80), 200, 200);
|
||||
|
||||
layer->setIsRelativeAnchorPoint(true);
|
||||
layer->setIgnoreAnchorPointForPosition(false);
|
||||
layer->setPosition( CCPointMake(s.width/2, s.height/2) );
|
||||
addChild(layer, 1, kTagLayer);
|
||||
}
|
||||
|
@ -219,12 +219,12 @@ void LayerTest2::onEnter()
|
|||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCLayerColor* layer1 = CCLayerColor::layerWithColor( ccc4(255, 255, 0, 80), 100, 300);
|
||||
layer1->setPosition(CCPointMake(s.width/3, s.height/2));
|
||||
layer1->setIsRelativeAnchorPoint(true);
|
||||
layer1->setIgnoreAnchorPointForPosition(false);
|
||||
addChild(layer1, 1);
|
||||
|
||||
CCLayerColor* layer2 = CCLayerColor::layerWithColor( ccc4(0, 0, 255, 255), 100, 300);
|
||||
layer2->setPosition(CCPointMake((s.width/3)*2, s.height/2));
|
||||
layer2->setIsRelativeAnchorPoint(true);
|
||||
layer2->setIgnoreAnchorPointForPosition(false);
|
||||
addChild(layer2, 1);
|
||||
|
||||
CCActionInterval* actionTint = CCTintBy::actionWithDuration(2, -255, -127, 0);
|
||||
|
|
|
@ -476,7 +476,7 @@ bool SpriteBlur::initWithTexture(CCTexture2D* texture, const CCRect& rect)
|
|||
sub_[0] = sub_[1] = sub_[2] = sub_[3] = 0;
|
||||
|
||||
GLchar * fragSource = (GLchar*) CCString::stringWithContentsOfFile(
|
||||
CCFileUtils::fullPathFromRelativePath("Shaders/example_Blur.fsh"))->getCString();
|
||||
CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("Shaders/example_Blur.fsh"))->getCString();
|
||||
CCGLProgram* pProgram = new CCGLProgram();
|
||||
pProgram->initWithVertexShaderByteArray(ccPositionTextureColor_vert, fragSource);
|
||||
setShaderProgram(pProgram);
|
||||
|
@ -630,7 +630,7 @@ bool ShaderRetroEffect::init()
|
|||
{
|
||||
if( ShaderTestDemo::init() ) {
|
||||
|
||||
GLchar * fragSource = (GLchar*) CCString::stringWithContentsOfFile(CCFileUtils::fullPathFromRelativePath("Shaders/example_HorizontalColor.fsh"))->getCString();
|
||||
GLchar * fragSource = (GLchar*) CCString::stringWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("Shaders/example_HorizontalColor.fsh"))->getCString();
|
||||
CCGLProgram *p = new CCGLProgram();
|
||||
p->initWithVertexShaderByteArray(ccPositionTexture_vert, fragSource);
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
32985150da64bb4070f46022a1fb52ec24c22451
|
||||
30f90defc4364cbcd8e686f75010ac83a50fb386
|
|
@ -1478,14 +1478,14 @@ void FileUtilsTest::onEnter()
|
|||
#if 0 // TODO:(CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
// Testint CCFileUtils API
|
||||
bool ret = false;
|
||||
ret = CCFileUtils::iPhoneRetinaDisplayFileExistsAtPath("Images/bugs/test_issue_1179.png");
|
||||
ret = CCFileUtils::sharedFileUtils()->iPhoneRetinaDisplayFileExistsAtPath("Images/bugs/test_issue_1179.png");
|
||||
if( ret )
|
||||
CCLog("Test #3: retinaDisplayFileExistsAtPath: OK");
|
||||
else
|
||||
CCLog("Test #3: retinaDisplayFileExistsAtPath: FAILED");
|
||||
|
||||
|
||||
ret = CCFileUtils::iPhoneRetinaDisplayFileExistsAtPath("grossini-does_no_exist.png");
|
||||
ret = CCFileUtils::sharedFileUtils()->iPhoneRetinaDisplayFileExistsAtPath("grossini-does_no_exist.png");
|
||||
if( !ret )
|
||||
CCLog("Test #4: retinaDisplayFileExistsAtPath: OK");
|
||||
else
|
||||
|
|
|
@ -1254,7 +1254,7 @@ TMXOrthoFromXMLTest::TMXOrthoFromXMLTest()
|
|||
string resources = "TileMaps"; // partial paths are OK as resource paths.
|
||||
string file = resources + "/orthogonal-test1.tmx";
|
||||
|
||||
CCString* str = CCString::stringWithContentsOfFile(CCFileUtils::fullPathFromRelativePath(file.c_str()));
|
||||
CCString* str = CCString::stringWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(file.c_str()));
|
||||
CCAssert(str != NULL, "Unable to open file");
|
||||
|
||||
CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithXML(str->getCString() ,resources.c_str());
|
||||
|
|
Loading…
Reference in New Issue