issue #1555:menu can receive touch event now

This commit is contained in:
minggo 2012-11-16 14:51:48 +08:00
parent a4a53df159
commit b497143f93
5 changed files with 11 additions and 10 deletions

View File

@ -175,7 +175,6 @@ void CCLayer::setTouchEnabled(bool enabled)
} }
} }
void CCLayer::setTouchMode(ccTouchesMode mode) void CCLayer::setTouchMode(ccTouchesMode mode)
{ {
if(m_eTouchMode != mode) if(m_eTouchMode != mode)

View File

@ -137,6 +137,8 @@ bool CCMenu::initWithArray(CCArray* pArrayOfItems)
if (CCLayer::init()) if (CCLayer::init())
{ {
setTouchPriority(kCCMenuHandlerPriority); setTouchPriority(kCCMenuHandlerPriority);
setTouchMode(kCCTouchesOneByOne);
setTouchEnabled(true);
m_bEnabled = true; m_bEnabled = true;
// menu in the center of the screen // menu in the center of the screen

View File

@ -1 +1 @@
48a295775479bd5b7fc89114495885a002502849 25ba4a303b7a9a46a800ee741da634603e2a55d8

View File

@ -159,7 +159,7 @@ void CCControlSwitchSprite::draw()
ccGLEnableVertexAttribs(kCCVertexAttribFlag_PosColorTex); ccGLEnableVertexAttribs(kCCVertexAttribFlag_PosColorTex);
ccGLBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); ccGLBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
getShaderProgram()->setUniformForModelViewProjectionMatrix(); getShaderProgram()->setUniformsForBuiltins();
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture( GL_TEXTURE_2D, getTexture()->getName()); glBindTexture( GL_TEXTURE_2D, getTexture()->getName());

View File

@ -48,7 +48,7 @@ void GLESDebugDraw::initShader( void )
void GLESDebugDraw::DrawPolygon(const b2Vec2* old_vertices, int vertexCount, const b2Color& color) void GLESDebugDraw::DrawPolygon(const b2Vec2* old_vertices, int vertexCount, const b2Color& color)
{ {
mShaderProgram->use(); mShaderProgram->use();
mShaderProgram->setUniformForModelViewProjectionMatrix(); mShaderProgram->setUniformsForBuiltins();
b2Vec2* vertices = new b2Vec2[vertexCount]; b2Vec2* vertices = new b2Vec2[vertexCount];
for( int i=0;i<vertexCount;i++) for( int i=0;i<vertexCount;i++)
@ -72,7 +72,7 @@ void GLESDebugDraw::DrawPolygon(const b2Vec2* old_vertices, int vertexCount, con
void GLESDebugDraw::DrawSolidPolygon(const b2Vec2* old_vertices, int vertexCount, const b2Color& color) void GLESDebugDraw::DrawSolidPolygon(const b2Vec2* old_vertices, int vertexCount, const b2Color& color)
{ {
mShaderProgram->use(); mShaderProgram->use();
mShaderProgram->setUniformForModelViewProjectionMatrix(); mShaderProgram->setUniformsForBuiltins();
b2Vec2* vertices = new b2Vec2[vertexCount]; b2Vec2* vertices = new b2Vec2[vertexCount];
for( int i=0;i<vertexCount;i++) { for( int i=0;i<vertexCount;i++) {
@ -99,7 +99,7 @@ void GLESDebugDraw::DrawSolidPolygon(const b2Vec2* old_vertices, int vertexCount
void GLESDebugDraw::DrawCircle(const b2Vec2& center, float32 radius, const b2Color& color) void GLESDebugDraw::DrawCircle(const b2Vec2& center, float32 radius, const b2Color& color)
{ {
mShaderProgram->use(); mShaderProgram->use();
mShaderProgram->setUniformForModelViewProjectionMatrix(); mShaderProgram->setUniformsForBuiltins();
const float32 k_segments = 16.0f; const float32 k_segments = 16.0f;
int vertexCount=16; int vertexCount=16;
@ -130,7 +130,7 @@ void GLESDebugDraw::DrawCircle(const b2Vec2& center, float32 radius, const b2Col
void GLESDebugDraw::DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color) void GLESDebugDraw::DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color)
{ {
mShaderProgram->use(); mShaderProgram->use();
mShaderProgram->setUniformForModelViewProjectionMatrix(); mShaderProgram->setUniformsForBuiltins();
const float32 k_segments = 16.0f; const float32 k_segments = 16.0f;
int vertexCount=16; int vertexCount=16;
@ -167,7 +167,7 @@ void GLESDebugDraw::DrawSolidCircle(const b2Vec2& center, float32 radius, const
void GLESDebugDraw::DrawSegment(const b2Vec2& p1, const b2Vec2& p2, const b2Color& color) void GLESDebugDraw::DrawSegment(const b2Vec2& p1, const b2Vec2& p2, const b2Color& color)
{ {
mShaderProgram->use(); mShaderProgram->use();
mShaderProgram->setUniformForModelViewProjectionMatrix(); mShaderProgram->setUniformsForBuiltins();
mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r, color.g, color.b, 1); mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r, color.g, color.b, 1);
@ -199,7 +199,7 @@ void GLESDebugDraw::DrawTransform(const b2Transform& xf)
void GLESDebugDraw::DrawPoint(const b2Vec2& p, float32 size, const b2Color& color) void GLESDebugDraw::DrawPoint(const b2Vec2& p, float32 size, const b2Color& color)
{ {
mShaderProgram->use(); mShaderProgram->use();
mShaderProgram->setUniformForModelViewProjectionMatrix(); mShaderProgram->setUniformsForBuiltins();
mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r, color.g, color.b, 1); mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r, color.g, color.b, 1);
@ -229,7 +229,7 @@ void GLESDebugDraw::DrawString(int x, int y, const char *string, ...)
void GLESDebugDraw::DrawAABB(b2AABB* aabb, const b2Color& color) void GLESDebugDraw::DrawAABB(b2AABB* aabb, const b2Color& color)
{ {
mShaderProgram->use(); mShaderProgram->use();
mShaderProgram->setUniformForModelViewProjectionMatrix(); mShaderProgram->setUniformsForBuiltins();
mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r, color.g, color.b, 1); mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r, color.g, color.b, 1);