Merge pull request #694 from minggo/iss959_touch_id

fixed #959: make touch id correct on android
This commit is contained in:
minggo 2012-01-30 22:57:04 -08:00
commit a02e3b8c60
7 changed files with 26 additions and 35 deletions

View File

@ -282,9 +282,10 @@ public class Cocos2dxGLSurfaceView extends GLSurfaceView {
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_POINTER_DOWN:
final int idPointerDown = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
final float xPointerDown = event.getX(idPointerDown);
final float yPointerDown = event.getY(idPointerDown);
final int indexPointerDown = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
final int idPointerDown = event.getPointerId(indexPointerDown);
final float xPointerDown = event.getX(indexPointerDown);
final float yPointerDown = event.getY(indexPointerDown);
queueEvent(new Runnable() {
@Override
@ -318,9 +319,10 @@ public class Cocos2dxGLSurfaceView extends GLSurfaceView {
break;
case MotionEvent.ACTION_POINTER_UP:
final int idPointerUp = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
final float xPointerUp = event.getX(idPointerUp);
final float yPointerUp = event.getY(idPointerUp);
final int indexPointUp = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
final int idPointerUp = event.getPointerId(indexPointUp);
final float xPointerUp = event.getX(indexPointUp);
final float yPointerUp = event.getY(indexPointUp);
queueEvent(new Runnable() {
@Override

View File

@ -282,9 +282,10 @@ public class Cocos2dxGLSurfaceView extends GLSurfaceView {
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_POINTER_DOWN:
final int idPointerDown = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
final float xPointerDown = event.getX(idPointerDown);
final float yPointerDown = event.getY(idPointerDown);
final int indexPointerDown = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
final int idPointerDown = event.getPointerId(indexPointerDown);
final float xPointerDown = event.getX(indexPointerDown);
final float yPointerDown = event.getY(indexPointerDown);
queueEvent(new Runnable() {
@Override
@ -318,9 +319,10 @@ public class Cocos2dxGLSurfaceView extends GLSurfaceView {
break;
case MotionEvent.ACTION_POINTER_UP:
final int idPointerUp = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
final float xPointerUp = event.getX(idPointerUp);
final float yPointerUp = event.getY(idPointerUp);
final int indexPointUp = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
final int idPointerUp = event.getPointerId(indexPointUp);
final float xPointerUp = event.getX(indexPointUp);
final float yPointerUp = event.getY(indexPointUp);
queueEvent(new Runnable() {
@Override

View File

@ -72,8 +72,6 @@ namespace cocos2d{
*/
static CCMenu*menuWithItem(CCMenuItem* item);
/** initializes an empty CCMenu */
bool init();
/** initializes a CCMenu with it's items */
bool initWithItems(CCMenuItem* item, va_list args);

View File

@ -48,13 +48,7 @@ namespace cocos2d{
CCMenu* CCMenu::node()
{
CCMenu *menu = new CCMenu();
if (menu && menu->init()) {
menu->autorelease();
return menu;
}
CC_SAFE_DELETE(menu)
return 0;
return menuWithItem(NULL);
}
CCMenu * CCMenu::menuWithItems(CCMenuItem* item, ...)
@ -78,11 +72,6 @@ namespace cocos2d{
return menuWithItems(item, NULL);
}
bool CCMenu::init()
{
return initWithItems(NULL, NULL);
}
bool CCMenu::initWithItems(CCMenuItem* item, va_list args)
{
if (CCLayer::init())

View File

@ -1 +1 @@
aab1f3b11ba297c9558f3f4aefa80696fed4dca6
dc88d6cf4d6bc69fa1a45ec938a134f5e9e9524d

View File

@ -282,9 +282,10 @@ public class Cocos2dxGLSurfaceView extends GLSurfaceView {
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_POINTER_DOWN:
final int idPointerDown = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
final float xPointerDown = event.getX(idPointerDown);
final float yPointerDown = event.getY(idPointerDown);
final int indexPointerDown = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
final int idPointerDown = event.getPointerId(indexPointerDown);
final float xPointerDown = event.getX(indexPointerDown);
final float yPointerDown = event.getY(indexPointerDown);
queueEvent(new Runnable() {
@Override
@ -318,9 +319,10 @@ public class Cocos2dxGLSurfaceView extends GLSurfaceView {
break;
case MotionEvent.ACTION_POINTER_UP:
final int idPointerUp = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
final float xPointerUp = event.getX(idPointerUp);
final float yPointerUp = event.getY(idPointerUp);
final int indexPointUp = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
final int idPointerUp = event.getPointerId(indexPointUp);
final float xPointerUp = event.getX(indexPointUp);
final float yPointerUp = event.getY(indexPointUp);
queueEvent(new Runnable() {
@Override

View File

@ -53,8 +53,6 @@ namespace cocos2d{
ccColor3B getColor(void);
void setColor(ccColor3B color);
bool init();
static CCLayer *node(void);
void onEnter();
void onExit();