This commit is contained in:
natural-law 2011-07-08 15:57:46 +08:00
parent 810cf3f8c3
commit 602c5f1894
21 changed files with 160 additions and 18 deletions

View File

@ -9,6 +9,10 @@ enum
kTagSequence,
};
CCLayer* nextActionManagerAction();
CCLayer* backActionManagerAction();
CCLayer* restartActionManagerAction();
static int sceneIdx = -1;
#define MAX_LAYER 5

View File

@ -1,6 +1,10 @@
#include "ActionsTest.h"
#include "../testResource.h"
CCLayer* NextAction();
CCLayer* BackAction();
CCLayer* RestartAction();
static int s_nActionIdx = -1;
CCLayer* CreateLayer(int nIndex)
@ -376,19 +380,19 @@ void ActionSkewRotateScale::onEnter()
CCSize boxSize = CCSizeMake(100.0f, 100.0f);
CCColorLayer *box = CCColorLayer::layerWithColor(ccc4(255, 255, 0, 255));
CCLayerColor *box = CCLayerColor::layerWithColor(ccc4(255, 255, 0, 255));
box->setAnchorPoint(ccp(0, 0));
box->setPosition(ccp(190, 110));
box->setContentSize(boxSize);
static float markrside = 10.0f;
CCColorLayer *uL = CCColorLayer::layerWithColor(ccc4(255, 0, 0, 255));
CCLayerColor *uL = CCLayerColor::layerWithColor(ccc4(255, 0, 0, 255));
box->addChild(uL);
uL->setContentSize(CCSizeMake(markrside, markrside));
uL->setPosition(ccp(0.f, boxSize.height - markrside));
uL->setAnchorPoint(ccp(0, 0));
CCColorLayer *uR = CCColorLayer::layerWithColor(ccc4(0, 0, 255, 255));
CCLayerColor *uR = CCLayerColor::layerWithColor(ccc4(0, 0, 255, 255));
box->addChild(uR);
uR->setContentSize(CCSizeMake(markrside, markrside));
uR->setPosition(ccp(boxSize.width - markrside, boxSize.height - markrside));

View File

@ -30,12 +30,12 @@ bool Bug1159Layer::init()
CCLayerColor *sprite_a = CCLayerColor::layerWithColorWidthHeight(ccc4(255, 0, 0, 255), 700, 700);
sprite_a->setAnchorPoint(ccp(0.5f, 0.5f));
sprite_a->setIsRelativeAnchorPoint(true);
sprite_a->setPosition(ccp(0.0, s.height/2));
sprite_a->setPosition(ccp(0.0f, s.height/2));
addChild(sprite_a);
sprite_a->runAction(CCRepeatForever::actionWithAction((CCActionInterval*) CCSequence::actions(
CCMoveTo::actionWithDuration(1.0f, ccp(1024.0, 384.0)),
CCMoveTo::actionWithDuration(1.0f, ccp(0.0, 384.0)),
CCMoveTo::actionWithDuration(1.0f, ccp(1024.0f, 384.0f)),
CCMoveTo::actionWithDuration(1.0f, ccp(0.0f, 384.0f)),
NULL)));
CCLayerColor *sprite_b = CCLayerColor::layerWithColorWidthHeight(ccc4(0, 0, 255, 255), 400, 400);
@ -46,7 +46,7 @@ bool Bug1159Layer::init()
CCMenuItemLabel *label = CCMenuItemLabel::itemWithLabel(CCLabelTTF::labelWithString("Flip Me", "Helvetica", 24), this, menu_selector(Bug1159Layer::callBack));
CCMenu *menu = CCMenu::menuWithItems(label, NULL);
menu->setPosition(ccp(s.width - 200, 50.0));
menu->setPosition(ccp(s.width - 200.0f, 50.0f));
addChild(menu);
return true;

View File

@ -5,6 +5,8 @@
#include "Bug-1174.h"
int check_for_error( CCPoint p1, CCPoint p2, CCPoint p3, CCPoint p4, float s, float t );
int check_for_error( CCPoint p1, CCPoint p2, CCPoint p3, CCPoint p4, float s, float t )
{
// the hit point is p3 + t * (p4 - p3);

View File

@ -9,6 +9,11 @@ enum
kTagSlider,
};
CCLayer* nextCocosNodeAction();
CCLayer* backCocosNodeAction();
CCLayer* restartCocosNodeAction();
//------------------------------------------------------------------
//
// TestCocosNodeDemo

View File

@ -3,6 +3,10 @@
#define MAX_LAYER 1
CCLayer* nextDirectorTestCase();
CCLayer* backDirectorTestCase();
CCLayer* restartDirectorTestCase();
static int sceneIdx=-1;
static ccDeviceOrientation s_currentOrientation = CCDeviceOrientationPortrait;

View File

@ -7,6 +7,10 @@ enum {
kTagSlider = 1,
};
CCLayer* nextEaseAction();
CCLayer* backEaseAction();
CCLayer* restartEaseAction();
//------------------------------------------------------------------
//
// SpriteEase

View File

@ -244,6 +244,10 @@ static int sceneIdx = -1;
#define MAX_LAYER 6
CCLayer* nextEffectAdvanceAction();
CCLayer* backEffectAdvanceAction();
CCLayer* restartEffectAdvanceAction();
CCLayer* createEffectAdvanceLayer(int nIndex)
{
switch(nIndex)

View File

@ -4,6 +4,10 @@
#define MAX_LAYERS 2;
static int sceneIdx = -1;
CCLayer* nextHiResAction();
CCLayer* restartHiResAction();
CCLayer* backHiResAction();
CCLayer* createHiResLayer(int idx)
{
CCLayer* pLayer = NULL;

View File

@ -33,6 +33,10 @@ enum
IDC_BACK,
IDC_RESTART
};
CCLayer* nextAtlasAction();
CCLayer* backAtlasAction();
CCLayer* restartAtlasAction();
static int sceneIdx = -1;
@ -351,6 +355,12 @@ std::string LabelAtlasColorTest::subtitle()
//------------------------------------------------------------------
//
// Atlas3
//
// Use any of these editors to generate BMFonts:
// http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
// http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
// http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
// http://www.angelcode.com/products/bmfont/ (Free, Windows only)
//
//------------------------------------------------------------------
Atlas3::Atlas3()
@ -429,6 +439,12 @@ std::string Atlas3::subtitle()
//------------------------------------------------------------------
//
// Atlas4
//
// Use any of these editors to generate BMFonts:
// http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
// http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
// http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
// http://www.angelcode.com/products/bmfont/ (Free, Windows only)
//
//------------------------------------------------------------------
Atlas4::Atlas4()
@ -515,6 +531,12 @@ std::string Atlas4::subtitle()
//------------------------------------------------------------------
//
// Atlas5
//
// Use any of these editors to generate BMFonts:
// http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
// http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
// http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
// http://www.angelcode.com/products/bmfont/ (Free, Windows only)
//
//------------------------------------------------------------------
@ -541,6 +563,12 @@ std::string Atlas5::subtitle()
//------------------------------------------------------------------
//
// Atlas6
//
// Use any of these editors to generate BMFonts:
// http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
// http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
// http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
// http://www.angelcode.com/products/bmfont/ (Free, Windows only)
//
//------------------------------------------------------------------
@ -578,16 +606,14 @@ std::string Atlas6::subtitle()
//------------------------------------------------------------------
//
// AtlasBitmapColor
//
// Use any of these editors to generate BMFonts:
// http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
// http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
// http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
// http://www.angelcode.com/products/bmfont/ (Free, Windows only)
//
//------------------------------------------------------------------
/*
* Use any of these editors to generate bitmap font atlas:
* http://www.n4te.com/hiero/hiero.jnlp
* http://slick.cokeandcode.com/demos/hiero.jnlp
* http://www.angelcode.com/products/bmfont/
*/
AtlasBitmapColor::AtlasBitmapColor()
{
CCSize s = CCDirector::sharedDirector()->getWinSize();
@ -626,6 +652,12 @@ std::string AtlasBitmapColor::subtitle()
//------------------------------------------------------------------
//
// AtlasFastBitmap
//
// Use any of these editors to generate BMFonts:
// http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
// http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
// http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
// http://www.angelcode.com/products/bmfont/ (Free, Windows only)
//
//------------------------------------------------------------------
@ -660,6 +692,12 @@ std::string AtlasFastBitmap::subtitle()
//------------------------------------------------------------------
//
// BitmapFontMultiLine
//
// Use any of these editors to generate BMFonts:
// http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
// http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
// http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
// http://www.angelcode.com/products/bmfont/ (Free, Windows only)
//
//------------------------------------------------------------------
BitmapFontMultiLine::BitmapFontMultiLine()
@ -767,7 +805,7 @@ std::string LabelsEmpty::title()
std::string LabelsEmpty::subtitle()
{
return "3 empty labels: LabelAtlas, Label and BitmapFontAtlas";
return "3 empty labels: LabelAtlas, LabelTTF and LabelBMFont";
}
//------------------------------------------------------------------

View File

@ -6,6 +6,10 @@ enum
kTagLayer = 1,
};
CCLayer* nextTestAction();
CCLayer* backTestAction();
CCLayer* restartTestAction();
static int sceneIdx = -1;
#define MAX_LAYER 4

View File

@ -28,6 +28,7 @@ MenuLayer1::MenuLayer1()
CCMenuItemFont::setFontSize( 30 );
CCMenuItemFont::setFontName("Courier New");
setIsTouchEnabled(true);
// Font Item
CCSprite* spriteNormal = CCSprite::spriteWithFile(s_MenuItem, CCRectMake(0,23*2,115,23));
@ -51,7 +52,7 @@ MenuLayer1::MenuLayer1()
// Font Item
CCMenuItem *item4 = CCMenuItemFont::itemFromString("I toggle enable items", this, menu_selector(MenuLayer1::menuCallbackEnable) );
// Label Item (BitmapFontAtlas)
// Label Item (CCLabelBMFont)
CCLabelBMFont* label = CCLabelBMFont::labelWithString("configuration", "fonts/bitmapFontTest3.fnt");
CCMenuItemLabel* item5 = CCMenuItemLabel::itemWithLabel(label, this, menu_selector(MenuLayer1::menuCallbackConfig));
@ -105,6 +106,28 @@ MenuLayer1::MenuLayer1()
}
void MenuLayer1::registerWithTouchDispatcher()
{
CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this, kCCMenuTouchPriority+1, true);
}
bool MenuLayer1::ccTouchBegan(CCTouch *touch, CCEvent * pEvent)
{
return true;
}
void MenuLayer1::ccTouchEnded(CCTouch *touch, CCEvent * pEvent)
{
}
void MenuLayer1::ccTouchCancelled(CCTouch *touch, CCEvent * pEvent)
{
}
void MenuLayer1::ccTouchMoved(CCTouch *touch, CCEvent * pEvent)
{
}
MenuLayer1::~MenuLayer1()
{
m_disabledItem->release();
@ -120,8 +143,19 @@ void MenuLayer1::menuCallbackConfig(CCObject* sender)
((CCLayerMultiplex*)m_pParent)->switchTo(3);
}
void MenuLayer1::allowTouches(ccTime dt)
{
CCTouchDispatcher::sharedDispatcher()->setPriority(kCCMenuTouchPriority+1, this);
unscheduleAllSelectors();
CCLog("TOUCHES ALLOWED AGAIN");
}
void MenuLayer1::menuCallbackDisabled(CCObject* sender)
{
// hijack all touch events for 5 seconds
CCTouchDispatcher::sharedDispatcher()->setPriority(kCCMenuTouchPriority-1, this);
schedule(schedule_selector(MenuLayer1::allowTouches), 5.0f);
CCLog("TOUCHES DISABLED FOR 5 SECONDS");
}
void MenuLayer1::menuCallbackEnable(CCObject* sender)

View File

@ -14,6 +14,13 @@ public:
~MenuLayer1();
public:
virtual void registerWithTouchDispatcher();
virtual bool ccTouchBegan(CCTouch *touch, CCEvent * pEvent);
virtual void ccTouchEnded(CCTouch *touch, CCEvent * pEvent);
virtual void ccTouchCancelled(CCTouch *touch, CCEvent * pEvent);
virtual void ccTouchMoved(CCTouch *touch, CCEvent * pEvent);
void allowTouches(ccTime dt);
void menuCallback(CCObject* pSender);
void menuCallbackConfig(CCObject* pSender);
void menuCallbackDisabled(CCObject* pSender);

View File

@ -1,6 +1,10 @@
#include "MotionStreakTest.h"
#include "../testResource.h"
CCLayer* nextMotionAction();
CCLayer* backMotionAction();
CCLayer* restartMotionAction();
//------------------------------------------------------------------
//
// MotionStreakTest1

View File

@ -7,6 +7,10 @@ enum
kTagGrossini,
};
CCLayer* nextParallaxAction();
CCLayer* backParallaxAction();
CCLayer* restartParallaxAction();
//------------------------------------------------------------------
//
// Parallax1

View File

@ -12,6 +12,10 @@ enum
kTagLabelAtlas = 1,
};
CCLayer* nextParticleAction();
CCLayer* backParticleAction();
CCLayer* restartParticleAction();
//------------------------------------------------------------------
//
// DemoFirework

View File

@ -5,6 +5,10 @@ static int sceneIdx = -1;
#define MAX_LAYER 3
CCLayer* nextAction();
CCLayer* backAction();
CCLayer* restartAction();
CCLayer* createLayer(int nIndex)
{
switch(nIndex)

View File

@ -8,6 +8,10 @@ enum {
#define MAX_TESTS 8
static int sceneIdx = -1;
CCLayer* nextSchedulerTest();
CCLayer* backSchedulerTest();
CCLayer* restartSchedulerTest();
CCLayer* createSchedulerTest(int nIndex)
{
CCLayer* pLayer = NULL;

View File

@ -1 +1 @@
a269232296e7dc61dea36f970051f49e0e3de527
3dfc0a1466d723c0efd4186440040fa78c875e13

View File

@ -6,6 +6,10 @@ enum
kTagTileMap = 1,
};
CCLayer* nextTileMapAction();
CCLayer* backTileMapAction();
CCLayer* restartTileMapAction();
//------------------------------------------------------------------
//
// TileMapTest

View File

@ -5,6 +5,10 @@
static int sceneIdx = -1;
CCLayer* nextZwoptexTest();
CCLayer* backZwoptexTest();
CCLayer* restartZwoptexTest();
CCLayer* createZwoptexLayer(int nIndex)
{
switch(nIndex)