블로그 이미지
게임같은 인생 인생같은 게임 쿡지

카테고리

분류 전체보기 (12)
준&빈 (1)
나만의 개념 챙기기 (2)
My Story (0)
cocos2d-x (7)
My Games (0)
My_Work (0)
Etc (2)
Total
Today
Yesterday

iOS 개발중 멀티 터치 설정

iOS/Appcontroller.mm

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {


...

    [__glView setMultipleTouchEnabled:YES];     // 멀티 터치를 가능하게 한다.


HellowWoldScene.h


private:

    

    void ccTouchesBegan(cocos2d::CCSet *touches, cocos2d::CCEvent *event);

    void ccTouchesMoved(cocos2d::CCSet *touches, cocos2d::CCEvent *event);

    void ccTouchesEnded(cocos2d::CCSet *touches, cocos2d::CCEvent *event);



선언 (이걸 안해서 계속 "out-of-line"에러가 떴다.)



HellowWoldScene.cpp


void HelloWorld::ccTouchesBegan(CCSet *touches, CCEvent *event); 

void HelloWorld::ccTouchesMoved(CCSet *touches, CCEvent *event)

void HelloWorld::ccTouchesEnded(CCSet *touches, CCEvent *event)


정의해서 사용.



void HelloWorld::ccTouchesMoved(CCSet *touches, CCEvent *event)

{

    CCSetIterator it = touches->begin();

    

    CCPoint pt;

    CCTouch* touch;

    for( int iTouchCount = 0; iTouchCount < touches->count(); iTouchCount++ )

    {

        touch = (CCTouch*)(*it);

        pt = touch->locationInView( touch->view() );

        it++;

        

        printf( "Touch %i x:%i y:%i", iTouchCount, (int)pt.x, (int)pt.y );

    }

    printf( "\n" );

}




Posted by 알 수 없는 사용자
, |

최근에 달린 댓글

글 보관함