coolsharp의 놀이터

'개발'에 해당되는 글 81건

  1. 2011.10.19 cocos2d for android - 태그로 노드 제어
  2. 2011.10.19 cocos2d for android - 앵커포인트와 차일드
  3. 2011.10.19 cocos2d for android - 터치 이벤트
  4. 2011.10.19 cocos2d for android - 텍스트 효과
  5. 2011.10.19 cocos2d for android - 비트맵 폰트
  6. 2011.10.19 cocos2d for android - CCLabelAtlas 색 주기
  7. 2011.10.19 cocos2d for andorid - CCLabelAtlas
  8. 2011.10.18 cocos2d for android - CCOrbitCamera
  9. 2011.10.18 cocos2d for android - 딜레이주기
  10. 2011.10.18 cocos2d for android - 온길로 돌아가라.
  11. 2011.10.18 cocos2d for android - 반복과 무한 반복
  12. 2011.10.18 cocos2d for andorid - 지치지 않는 무한 반복
  13. 2011.10.18 cocos2d for android - 액션 섞어 쓰기
  14. 2011.10.18 cocos2d for android - callback
  15. 2011.10.18 cocos2d for android - 액션 테스트
  16. 2011.10.18 cocos2d for android - animation
  17. 2011.10.18 cocos2d for android - Tint
  18. 2011.10.18 cocos2d for android - fade in, fade out
  19. 2011.10.18 cocos2d for android - blank
  20. 2011.10.18 cocos2d for android - 곡선 4
  21. 2011.10.18 cocos2d for android - 액션 테스트
  22. 2011.10.18 cocos2d for android - 크기 조절
  23. 2011.10.18 cocos2d for android - 회전
  24. 2011.10.18 cocos2d for android - 이동 테스트
  25. 2011.10.18 cocos2d for android - 사용자 변형 테스트
  26. 2011.10.18 cocos2d for android - Remove 2
  27. 2011.10.18 cocos2d for android - Pause
  28. 2011.10.18 cocos2d for android - CrashTest
  29. 2011.10.18 cocos2d for android - CCLayer astract class(CCLayer 추상 클레스)
  30. 2011.10.18 cocos2d for android 개발
    static class Test4 extends TestDemo {

        public Test4() {
            super();

            // 스프라이트 생성
            CCSprite sp1 = CCSprite.sprite("grossinis_sister1.png");
            CCSprite sp2 = CCSprite.sprite("grossinis_sister2.png");

            // 위치 지정
            sp1.setPosition(CGPoint.make(100, 160));
            sp2.setPosition(CGPoint.make(380, 160));

            // 차일드 등록
            addChild(sp1, 0, 2);
            addChild(sp2, 0, 3);

            // 2초 있다가 실행
            schedule("delay2", 2.0f);
            // 4초 있다가 실행
            schedule("delay4", 4.0f);
        }

        public void delay2(float dt) {
            // 태그로 차일드 얻어옴
            CCNode node = getChildByTag(2);
            CCIntervalAction action1 = CCRotateBy.action(1, 360);
            node.runAction(action1);
        }

        public void delay4(float dt) {
            unschedule("delay4");
            // 태그로 노드 삭제
            removeChildByTag(3, false);
        }

        public String title() {
            return "Tags";
        }
    }

Posted by coolsharp
    static class Test2 extends TestDemo {

        public void onEnter() {
            super.onEnter();

            // 스크린 크기 얻기
            CGSize s = CCDirector.sharedDirector().winSize();

            // 스프라이트 생성
            CCSprite sp1 = CCSprite.sprite("grossinis_sister1.png");
            CCSprite sp2 = CCSprite.sprite("grossinis_sister2.png");
            CCSprite sp3 = CCSprite.sprite("grossinis_sister1.png");
            CCSprite sp4 = CCSprite.sprite("grossinis_sister2.png");

            // 위치 지정
            sp1.setPosition(CGPoint.make(100, s.height / 2));
            sp2.setPosition(CGPoint.make(380, s.height / 2));
           
            addChild(sp1);
            addChild(sp2);

            // 차일드 크기 줄이기
            sp3.setScale(0.25f);
            sp4.setScale(0.25f);

            // 스프라이트 객체에 차일드 지정
            sp1.addChild(sp3);
            sp2.addChild(sp4);

            // 액션 설정 360도 돌리고 크기 2배 늘리고
            CCIntervalAction a1 = CCRotateBy.action(2, 360);
            CCIntervalAction a2 = CCScaleBy.action(2, 2);

            // 액션 젹용
            CCAction action1 = CCRepeatForever.action(CCSequence.actions(a1, a2, a2.reverse()));
            CCAction action2 = CCRepeatForever.action(CCSequence.actions(a1.copy(), a2.copy(), a2.reverse()));

            // 앵커 포인트 지정
            // 축이 어디인지 설정
            // 0, 0이면 왼쪽 하단
            // 1, 1이면 오른쪽 상단
            // 0.5f, 0.5f이면 중앙
            sp2.setAnchorPoint(0.5f, 0.5f);

            // 액션 실행
            sp1.runAction(action1);
            sp2.runAction(action2);
        }

        public String title() {
            return "anchorPoint and children";
        }
    }

Posted by coolsharp
    static class MainLayer extends CCLayer {
        static final int kTagSprite = 1;
        CCProgressTimer  progressTimer;

        public MainLayer() {

            // 터치 이벤트 활성
            this.setIsTouchEnabled(true);

            // 스프라이트 생성(주인공이라고 하지)
            CCSprite sprite = CCSprite.sprite("grossini.png");

            // 전체 화면을 깜밖일 레이어 생성
            CCLayer layer = CCColorLayer.node(new ccColor4B(255, 255, 0, 255));
            addChild(layer, -1);

            // 스프라이트 등록
            addChild(sprite, 1, kTagSprite);
            sprite.setPosition(CGPoint.make(20, 150));

            // 액션 실행
            // 4초동안 300, 48 만큼 100 높이로 점프하면서 옴
            sprite.runAction(CCJumpTo.action(4, CGPoint.make(300, 48), 100, 4));

            CCLabel lbl1 = CCLabel.makeLabel("Click on the screen", "DroidSans", 24);
            CCLabel lbl2 = CCLabel.makeLabel("to move and rotate Grossini", "DroidSans", 16);

            addChild(lbl1, 0);
            addChild(lbl2, 1);
            lbl1.setPosition(CGPoint.ccp(160, 240));
            lbl2.setPosition(CGPoint.ccp(160, 200));
           
            progressTimer = CCProgressTimer.progress("iso.png");
            this.addChild(progressTimer, 10);
            progressTimer.setPosition(160, 100);
            progressTimer.setType(CCProgressTimer.kCCProgressTimerTypeVerticalBarTB);
            progressTimer.setPercentage(50.0f);
           
            layer.runAction(CCRepeatForever.action(CCSequence.actions(CCFadeIn.action(1), CCFadeOut.action(1))));
        }

        @Override
        public boolean ccTouchesBegan(MotionEvent event) {
            // 현재 찍힌 좌표 계산
            CGPoint convertedLocation = CCDirector.sharedDirector()
                .convertToGL(CGPoint.make(event.getX(), event.getY()));

            // 노드 스프라이트 얻어오기
            CCNode s = getChildByTag(kTagSprite);
            // 모든 액션 중지
            s.stopAllActions();
            // 액션 실행(찍힌 위치로 가라)
            s.runAction(CCMoveTo.action(1.0f, convertedLocation));
          
            // 위치 얻어오기
            CGPoint pnt = s.getPosition();

            // 찍힌 위치를 기준으로 회전 각 계산
            float at = CGPoint.ccpCalcRotate(pnt, convertedLocation);

            // 회전하면서 가라(그냥 가면 이상하자너)
            s.runAction(CCRotateTo.action(0.1f, at));
           
            progressTimer.setPercentage(10.0f + progressTimer.getPercentage());

            return CCTouchDispatcher.kEventHandled;
        }

    }

Posted by coolsharp
    /*
     * 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/
     */
    /**
    * FileName : AtlasTest.java
    * Comment : 비트맵 폰트에 효과주기
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 19.
    */
    static class Atlas4 extends AtlasDemo {
        float time;
       
        public Atlas4() {
            super();

            // Upper Label
            CCBitmapFontAtlas label = CCBitmapFontAtlas.bitmapFontAtlas("Bitmap Font Atlas", "bitmapFontTest.fnt");
            addChild(label);

            CGSize s = CCDirector.sharedDirector().winSize();

            label.setPosition(CGPoint.ccp(s.width/2, s.height/2));
            label.setAnchorPoint(CGPoint.ccp(0.5f, 0.5f));


            // label의 첫번째 글자를 얻어옴
            CCSprite BChar = (CCSprite) label.getChildByTag(0);
            // label의 7번재 글자를 얻어옴
            CCSprite FChar = (CCSprite) label.getChildByTag(7);
            // label의 12번째 글자를 얻어옴
            CCSprite AChar = (CCSprite) label.getChildByTag(12);

            // 회전 효과 생성
            CCRotateBy rotate = CCRotateBy.action(2, 360);
            CCRepeatForever rot_4ever = CCRepeatForever.action(rotate);

            // 크기 조절 효과 생성
            CCScaleBy scale = CCScaleBy.action(2, 1.5f);
            CCScaleBy scale_back = scale.reverse();
            CCSequence scale_seq = CCSequence.actions(scale, scale_back);
            CCRepeatForever scale_4ever = CCRepeatForever.action(scale_seq);

            // 통통 뛰기 효과 생성
            CCJumpBy jump = CCJumpBy.action(0.5f, CGPoint.zero(), 60, 1);
            CCRepeatForever jump_4ever = CCRepeatForever.action(jump);

            CCFadeOut fade_out = CCFadeOut.action(1);
            CCFadeIn fade_in = CCFadeIn.action(1);
            CCSequence seq = CCSequence.actions(fade_out, fade_in);
            CCRepeatForever fade_4ever = CCRepeatForever.action(seq);

            BChar.runAction(rot_4ever);
            BChar.runAction(scale_4ever);
            FChar.runAction(jump_4ever);
            AChar.runAction(fade_4ever);


            // Bottom Label
            CCBitmapFontAtlas label2 = CCBitmapFontAtlas.bitmapFontAtlas("00.0", "bitmapFontTest.fnt");
            addChild(label2, 0, kTagBitmapAtlas2);
            label2.setPosition(CGPoint.ccp(s.width/2.0f, 80));

            CCSprite lastChar = (CCSprite)label2.getChildByTag(3);
            lastChar.runAction(rot_4ever.copy());

            schedule(new UpdateCallback() {
               
                @Override
                public void update(float d) {
                    step(d);
                }
            }, 0.1f);
        }

        public void draw(GL10 gl) {
            CGSize s = CCDirector.sharedDirector().winSize();
            CCDrawingPrimitives.ccDrawLine(gl, CGPoint.ccp(0, s.height/2), CGPoint.ccp(s.width, s.height/2) );
            CCDrawingPrimitives.ccDrawLine(gl, CGPoint.ccp(s.width/2, 0), CGPoint.ccp(s.width/2, s.height) );
        }

        public void step(float dt) {
            time += dt;
            String string = CCFormatter.format("%04.1f", time);

            CCBitmapFontAtlas label1 = (CCBitmapFontAtlas) getChildByTag(kTagBitmapAtlas2);
            label1.setString(string);
        }

        @Override
        public String title() {
            return "CCBitmapFontAtlas Atlas4";
        }

        public String subtitle() {
            return "Using fonts as CCSprite objects. Some characters should rotate.";
        }


    }

Posted by coolsharp
    /*
     * 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/
     */
    /**
    * FileName : AtlasTest.java
    * Comment : 비트맵 폰트 사용
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 19.
    */
    static class Atlas3 extends AtlasDemo {
        float time;
       
        public Atlas3() {
            super();

            // ColorLayer 생성
            CCColorLayer col = CCColorLayer.node(ccColor4B.ccc4(128,128,128,255));
            addChild(col, -10);

            // Bitmap Font 생성
            CCBitmapFontAtlas label1 = CCBitmapFontAtlas.bitmapFontAtlas("Test", "bitmapFontTest2.fnt");

            // testing anchors
            // 좌표를 설정할때 기준점 위치를 처음으로 설정
            label1.setAnchorPoint(CGPoint.ccp(0,0));
            addChild(label1, 0, kTagBitmapAtlas1);
            CCFadeOut fade = CCFadeOut.action(1.0f);
            CCFadeIn fade_in = fade.reverse();
            CCSequence seq = CCSequence.actions(fade, fade_in);
            CCRepeatForever repeat = CCRepeatForever.action(seq);
            label1.runAction(repeat);

            // VERY IMPORTANT
            // color and opacity work OK because bitmapFontAltas2 loads a BMP image (not a PNG image)
            // If you want to use both opacity and color, it is recommended to use NON premultiplied images like BMP images
            // Of course, you can also tell XCode not to compress PNG images, but I think it doesn't work as expected
            CCBitmapFontAtlas label2 = CCBitmapFontAtlas.bitmapFontAtlas("Test", "bitmapFontTest2.fnt");
            // testing anchors
            // 좌표를 설정할때 기준점 위치를 가운데로 설정
            // 특정 객체와 거리를 표시할때 무조건 0, 0이 아닌 앵커를 기준으로 거리가 계산 됨
            label2.setAnchorPoint(CGPoint.ccp(0.5f, 0.5f));
            // 빨간색
            label2.setColor(ccColor3B.ccRED);
            addChild(label2, 0, kTagBitmapAtlas2);
            label2.runAction(repeat.copy());

            CCBitmapFontAtlas label3 = CCBitmapFontAtlas.bitmapFontAtlas("Test", "bitmapFontTest2.fnt");
            // testing anchors
            // 좌표를 설정할때 기준점 위치를 우측 끝으로 설정
            label3.setAnchorPoint(CGPoint.ccp(1,1));
            addChild(label3, 0, kTagBitmapAtlas3);


            CGSize s = CCDirector.sharedDirector().winSize();   
            label1.setPosition(CGPoint.ccp(0,0));
            label2.setPosition(CGPoint.ccp( s.width/2, s.height/2));
            label3.setPosition(CGPoint.ccp( s.width, s.height));

            schedule(new UpdateCallback() {
               
                @Override
                public void update(float d) {
                    step(d);
                }
            });
        }

        public void step(float dt) {
            time += dt;
            String string = CCFormatter.format("%2.2f Test j", time);

            CCBitmapFontAtlas label1 = (CCBitmapFontAtlas) getChildByTag(kTagBitmapAtlas1);
            label1.setString(string);

            CCBitmapFontAtlas label2 = (CCBitmapFontAtlas) getChildByTag(kTagBitmapAtlas2);
            label2.setString(string);

            CCBitmapFontAtlas label3 = (CCBitmapFontAtlas) getChildByTag(kTagBitmapAtlas3);
            label3.setString(string);
        }

        @Override
        public String title() {
            return "CCBitmapFontAtlas Atlas3";
        }

        @Override
        public String subtitle() {
            return "Testing alignment. Testing opacity + tint";
        }
    }

Posted by coolsharp
    /**
    * FileName : AtlasTest.java
    * Comment : 비트맵을 이용한 텍스트
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 19.
    */
    static class LabelAtlasColorTest extends AtlasDemo {
        float time;

        /**
         * 색상을 줄 수 있다.
         */
        public LabelAtlasColorTest() {
            super();

            CCLabelAtlas label1 = CCLabelAtlas.label("123 Test",
                    "tuffy_bold_italic-charmap.png", 48, 64, ' ');
            addChild(label1, 0, kTagSprite1);
            label1.setPosition(CGPoint.ccp(10,100));
            label1.setOpacity(200);

            CCLabelAtlas label2 = CCLabelAtlas.label("0123456789",
                    "tuffy_bold_italic-charmap.png", 48, 64, ' ');
            addChild(label2, 0, kTagSprite2);
            label2.setPosition(CGPoint.ccp(10,200));
            // 이곳이 바로 키 포인트 빨간 색
            label2.setColor(ccColor3B.ccRED);

            CCFadeOut fade = CCFadeOut.action(1.0f);
            CCFadeIn fade_in = fade.reverse();
            CCSequence seq = CCSequence.actions(fade, fade_in);
            CCRepeatForever repeat = CCRepeatForever.action(seq);
            label2.runAction(repeat);

            schedule(new UpdateCallback() {
               
                @Override
                public void update(float d) {
                    step(d);
                }
            });
        }

        public void step(float dt) {
            time += dt;
            String string = CCFormatter.format("%2.2f Test", time);
            CCLabelAtlas label1 = (CCLabelAtlas) getChildByTag(kTagSprite1);
            label1.setString(string);

            CCLabelAtlas label2 = (CCLabelAtlas) getChildByTag(kTagSprite2);
            label2.setString(CCFormatter.format("%d", (int)time));   
        }

        public String title() {
            return "CCLabelAtlas LabelAtlasColorTest";
        }

        public String subtitle() {
            return "Opacity + Color should work at the same time";
        }
    }

Posted by coolsharp
    /**
    * FileName : AtlasTest.java
    * Comment : 비트맵 폰트
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 19.
    */
    static class LabelAtlasTest extends AtlasDemo {
        float time;

        /**
         * Constructor
         */
        public LabelAtlasTest() {
            super();
           
            // 123 Test라는 기본 텍스트에 tuffy_bold_italic-charmap_s.png라는 비트맵 폰트 파일을 대입한 라벨 생성함
            // 폰트당 크기는 넓이 48, 높이 64
            CCLabelAtlas label1 = CCLabelAtlas.label("123 Test", "tuffy_bold_italic-charmap.png", 48, 64, ' ');
            addChild(label1, 0, kTagSprite1);
            label1.setPosition(CGPoint.ccp(10, 100));
            // 이렇게 투명도를 지정할 수 있음
            label1.setOpacity(200);

            CCLabelAtlas label2 = CCLabelAtlas.label("0123456789", "tuffy_bold_italic-charmap.png", 48, 64, ' ');
            addChild(label2, 0, kTagSprite2);
            label2.setPosition(CGPoint.ccp(10, 200));
            label2.setOpacity(32);

            schedule(new UpdateCallback() {

                @Override
                public void update(float d) {
                    step(d);
                }
            });
        }

        public void step(float dt) {
            time += dt;
            String string = CCFormatter.format("%2.2f Test", time);
            CCLabelAtlas label1 = (CCLabelAtlas) getChildByTag(kTagSprite1);
            label1.setString(string);

            CCLabelAtlas label2 = (CCLabelAtlas) getChildByTag(kTagSprite2);
            label2.setString(CCFormatter.format("%d Time", (int)time));
        }

        @Override
        public String title() {
            return "CCLabelAtlas LabelAtlasTest";
        }

        public String subtitle() {
            return "Updating label should be fast";
        }
    }

Posted by coolsharp
    /**
    * FileName : ActionsTest.java
    * Comment : CCOrbitCamera
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionOrbit extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            centerSprites(3);

            // actionWithDuration:2
            // radius:1 deltaRadius:0 angleZ:0 deltaAngleZ:180 angleX:0
            // deltaAngleX:0];
            CCOrbitCamera orbit1 = CCOrbitCamera.action(2, 1, 0, 0, 180, 0, 0);
            CCSequence action1 = CCSequence.actions(orbit1, orbit1.reverse());

            CCOrbitCamera orbit2 = CCOrbitCamera.action(2, 1, 0, 0, 180, -45, 0);
            CCSequence action2 = CCSequence.actions(orbit2, orbit2.reverse());

            CCOrbitCamera orbit3 = CCOrbitCamera.action(2, 1, 0, 0, 180, 90, 0);
            CCSequence action3 = CCSequence.actions(orbit3, orbit3.reverse());

            kathia.runAction(CCRepeatForever.action(action1));
            tamara.runAction(CCRepeatForever.action(action2));
            grossini.runAction(CCRepeatForever.action(action3));

            CCMoveBy move = CCMoveBy.action(3, CGPoint.ccp(100, -100));
            CCMoveBy move_back = move.reverse();
            CCSequence seq = CCSequence.actions(move, move_back);
            CCRepeatForever rfe = CCRepeatForever.action(seq);
            kathia.runAction(rfe);
            tamara.runAction(rfe.copy());
            grossini.runAction(rfe.copy());
        }

        public String title() {
            return "OrbitCamera action";
        }
    }

Posted by coolsharp
    /**
    * FileName : ActionsTest.java
    * Comment : 딜레이 주기(좀비 게임 만들때 쓰면 되겠구만)
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionDelayTime extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            alignSpritesLeft(1);

            // 1초동안 지금 있는 기준에서 150만큼 이동
            CCMoveBy move = CCMoveBy.action(1, CGPoint.ccp(150, 0));
            // 2초간 딜레이 후 다시 150만큼 이동
            CCSequence action = CCSequence.actions(move, CCDelayTime.action(2), move);

            grossini.runAction(action);
        }

        public String title() {
            return "DelayTime: m + delay + m";
        }
    }

Posted by coolsharp
    /**
    * FileName : ActionsTest.java
    * Comment : 돌아온 길을 다시 돌아가라
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionReverse extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            alignSpritesLeft(1);

            // 2초동안 오른쪽으로 300만큼 50높이로 4번 뛰어라.
            CCJumpBy jump = CCJumpBy.action(2, CGPoint.ccp(300, 0), 50, 4);
            // 온길로 돌아가라.
            CCSequence action = CCSequence.actions(jump, jump.reverse());

            grossini.runAction(action);
        }

        public String title() {
            return "Reverse an action";
        }
    }
Posted by coolsharp
    /**
    * FileName : ActionsTest.java
    * Comment : 반복과 무한반복
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionRotateToRepeat extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            centerSprites(2);

            // 1초동안 90도로 회전
            // 1초동안 0도로 회전
            CCRotateTo act1 = CCRotateTo.action(1, 90);
            CCRotateTo act2 = CCRotateTo.action(1, 0);
            CCSequence seq = CCSequence.actions(act1, act2);
            // 무한반복
            CCRepeatForever rep1 = CCRepeatForever.action(seq);
            // 10회만 반하고 끝남
            CCRepeat rep2 = CCRepeat.action(seq.copy(), 10);

            tamara.runAction(rep1);
            kathia.runAction(rep2);
        }

Posted by coolsharp
    /**
    * FileName : ActionsTest.java
    * Comment : 지지지 않는 무한 반복
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionRepeatForever extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            centerSprites(1);

            // 1초 딜레이 후 콜백 호출
            CCSequence action = CCSequence.actions(CCDelayTime.action(1), CCCallFuncN.action(this, "repeatForever"));

            grossini.runAction(action);
        }

        /**
        * Comment : 무한 반복
        * @version : 1.0
        * @tags : @param sender
        * @date : 2011. 10. 18.
        */
        public void repeatForever(Object sender) {
            // 1초동안 360동 회전 무한 반복
            CCRepeatForever repeat = CCRepeatForever.action(CCRotateBy.action(1.0f, 360));

            ((CCNode) sender).runAction(repeat);
        }

        public String title() {
            return "CallFuncN + RepeatForever";
        }
    }

Posted by coolsharp
    /**
    * FileName : ActionsTest.java
    * Comment : CSpawn 테스트
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionSpawn extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            alignSpritesLeft(1);

            // 이것은 구미호 재주넘기
            // 2초동안 300px만큼 왼쪽으로 50 높이로 4번 뛰면서 동시에 2초동안 720도 재주넘기를 하여
            CCAction action = CCSpawn.actions(CCJumpBy.action(2, CGPoint.ccp(300, 0), 50, 4), CCRotateBy.action(2, 720));

            grossini.runAction(action);
        }

        public String title() {
            return "Spawn: Jump + Rotate";
        }
    }

Posted by coolsharp

cocos2d for android - callback

2011. 10. 18. 19:45 : 개발
    /**
    * FileName : ActionsTest.java
    * Comment : 콜백 테스트
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionSequence2 extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            alignSpritesLeft(1);

            // 보이지 않게 설정
            grossini.setVisible(false);

            // 200, 200에 위치하고 보인 후 100 만큼 오른쪽으로 이동
            CCSequence action = CCSequence.actions(CCPlace.action(CGPoint.ccp(200, 200)), CCShow.action(), CCMoveBy.action(1, CGPoint.ccp(100, 0)),
                    CCCallFunc.action(this, "callback1"), CCCallFuncN.action(this, "callback2"), CCCallFuncND.action(this, "callback3", Float.valueOf(1.0f)));

            grossini.runAction(action);
        }

        public void callback1() {
            CGSize s = CCDirector.sharedDirector().winSize();
            CCLabel label = CCLabel.makeLabel("callback 1 called", "DroidSans", 16);
            label.setPosition(CGPoint.ccp(s.width / 4 * 1, s.height / 2));

            addChild(label);
        }

        public void callback2(Object sender) {
            CGSize s = CCDirector.sharedDirector().winSize();
            CCLabel label = CCLabel.makeLabel("callback 2 called", "DroidSans", 16);
            label.setPosition(CGPoint.ccp(s.width / 4 * 2, s.height / 2));

            addChild(label);
        }

        public void callback3(Object sender, Object data) {
            CGSize s = CCDirector.sharedDirector().winSize();
            CCLabel label = CCLabel.makeLabel("callback 3 called", "DroidSans", 16);
            label.setPosition(CGPoint.ccp(s.width / 4 * 3, s.height / 2));

            addChild(label);
        }

        public String title() {
            return "Sequence of InstantActions";
        }
    }

Posted by coolsharp
    /**
    * FileName : ActionsTest.java
    * Comment : 액션 테스트
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionSequence extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            alignSpritesLeft(1);

            // 2초동안 240, 0까지 이동하고 동시에 2초동안 540도 회전(구미호같이?)
            CCSequence action = CCSequence.actions(CCMoveBy.action(2, CGPoint.ccp(240, 0)), CCRotateBy.action(2, 540));

            // 액션 지정
            grossini.runAction(action);
        }

        public String title() {
            return "Sequence: Move + Rotate";
        }
    }

Posted by coolsharp

cocos2d for android - animation

2011. 10. 18. 18:58 : 개발
    /**
    * FileName : ActionsTest.java
    * Comment : 애니메이션
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionAnimate extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            centerSprites(1);

            // 애니메이션 생성
            CCAnimation animation = CCAnimation.animation("dance");
            // 그림 로드 하면서 대입
            for (int i = 1; i < 15; i++)
                animation.addFrame(String.format("grossini_dance_%02d.png", i));

            // 3초간 애니메이션 진행
            CCAnimate action = CCAnimate.action(3, animation, false);
            CCAnimate action_back = action.reverse();

            grossini.runAction(CCSequence.actions(action, action_back));
        }

        public String title() {
            return "Animation";
        }
    }

Posted by coolsharp

cocos2d for android - Tint

2011. 10. 18. 18:57 : 개발
    /**
    * FileName : ActionsTest.java
    * Comment : 농도를 변경
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionTint extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            centerSprites(2);

            // To는 절대적으로 rgb에 맞는 농도가 변경되고 By는 현재의 값에서 rgb가 추가되어 색상이 변경
            // R값 255, B값 255로 농도 변경
            CCTintTo action1 = CCTintTo.action(2, ccColor3B.ccc3(255, 0, 255));
            // R값 -127, G값 -255, B값 -127로 농도 변경
            CCTintBy action2 = CCTintBy.action(2, ccColor3B.ccc3(-127, -255, -127));
            // 거꾸로
            CCTintBy action2Back = action2.reverse();

            tamara.runAction(action1);
            kathia.runAction(CCSequence.actions(action2, action2Back));
        }

        public String title() {
            return "TintTo / TintBy";
        }
    }

Posted by coolsharp
    /**
    * FileName : ActionsTest.java
    * Comment : 페이드 인, 페이드 아웃
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionFade extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            centerSprites(2);

            // 불투명도 설정 보이지 않게 설정
            tamara.setOpacity(0);
            // 1초간 페이드 인
            CCFadeIn action1 = CCFadeIn.action(1.0f);
            // 거꾸로
            CCFadeOut action1Back = action1.reverse();

            // 1초간 페이드 아웃
            CCFadeOut action2 = CCFadeOut.action(1.0f);
            // 거꾸로
            CCFadeIn action2Back = action2.reverse();

            // 액션 실행
            tamara.runAction(CCSequence.actions(action1, action1Back));
            kathia.runAction(CCSequence.actions(action2, action2Back));
        }

        public String title() {
            return "FadeIn / FadeOut";
        }
    }

Posted by coolsharp

cocos2d for android - blank

2011. 10. 18. 18:55 : 개발
    /**
    * FileName : ActionsTest.java
    * Comment : 깜밖임
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionBlink extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            centerSprites(2);

            // 2초간 10번 깜밖임
            CCBlink action1 = CCBlink.action(2, 10);
            // 2초간 5번 깜밖임
            CCBlink action2 = CCBlink.action(2, 5);

            tamara.runAction(action1);
            kathia.runAction(action2);
        }

        public String title() {
            return "Blink";
        }
    }

Posted by coolsharp

cocos2d for android - 곡선

2011. 10. 18. 18:51 : 개발
    /**
    * FileName : ActionsTest.java
    * Comment : 베이지 곡선 그리기
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionBezier extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            // 윈도우 크기 얻기
            CGSize s = CCDirector.sharedDirector().winSize();


            // sprite 1
            // Bezier 설정 객체 생성


            // http://en.wikipedia.org/wiki/User_talk:Twirlip 그림 3번 항목 참조
            // 그림에 보면 P0, P1, P2, P3가 있음
            // 현재 위치가 P0, controlPoint_1가 P1, controlPoint_2가 P2, endPosition가 P3
            CCBezierConfig bezier = new CCBezierConfig();
            // 첫번째 포인트 지정
            bezier.controlPoint_1 = CGPoint.ccp(0, s.height / 2);
            // 두번째 포인트 지정
            bezier.controlPoint_2 = CGPoint.ccp(300, -s.height / 2);
            // 종점 포인트 지정
            bezier.endPosition = CGPoint.ccp(300, 100);

            // Bezier 객체 생성
            // 3초간 위 설정대로 진행
            CCBezierBy bezierForward = CCBezierBy.action(3, bezier);
            // 역 방향 진행
            CCBezierBy bezierBack = bezierForward.reverse();
            // 액션 시퀀스 생성
            CCSequence seq = CCSequence.actions(bezierForward, bezierBack);
            // 무판 반복 rep 생성
            CCRepeatForever rep = CCRepeatForever.action(seq);

            // sprite 2
            // 현재 위치 지정
            tamara.setPosition(CGPoint.ccp(200, 160));
            CCBezierConfig bezier2 = new CCBezierConfig();
            bezier2.controlPoint_1 = CGPoint.ccp(100, s.height / 2);
            bezier2.controlPoint_2 = CGPoint.ccp(200, -s.height / 2);
            bezier2.endPosition = CGPoint.ccp(240, 160);

            CCBezierTo bezierTo1 = CCBezierTo.action(2, bezier2);

            // sprite 3
            kathia.setPosition(CGPoint.ccp(400, 160));
            CCBezierTo bezierTo2 = CCBezierTo.action(2, bezier2);

            grossini.runAction(rep);
            tamara.runAction(bezierTo1);
            kathia.runAction(bezierTo2);
        }

        public String title() {
            return "BezierBy / BezierTo";
        }
    }
Posted by coolsharp
    /**
    * FileName : ActionsTest.java
    * Comment : 액션 테스트
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionJump extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            // 통통 튀기
            // CCJumpTo와 CCJumpBy로 Jump를 설정할 수 있는데 To와 By의 차이점은 각각 position에 대한
            // 값의 절대적 상대적 차이로 설정된다. 즉, JumpTo는 절대적으로 설정한 position 위치로 Jump를 하면서
            // 이동을 하는데 JumpBy는 현재 위치에서 position으로 설정된 값만큼을 더한 위치로 Jump하면서 이동
            // 2초동안 300, 300의 위치로 높이는 50픽셀로 4번의 점프를 하면서 이동
            CCJumpTo actionTo = CCJumpTo.action(2, CGPoint.ccp(300, 300), 50, 4);
            // 2초동안 현재 위치에서 가로로만 300픽셀을 더한 위치로 높이는 50픽셀로 4번 점프를 하면서 이동
            CCJumpBy actionBy = CCJumpBy.action(2, CGPoint.ccp(300, 0), 50, 4);
            // 거꾸로
            CCJumpBy actionByBack = actionBy.reverse();
            // 2초동안 현재 위치에서 높이는 50픽셀로 4번 점프
            CCJumpBy actionUp = CCJumpBy.action(2, CGPoint.ccp(0, 0), 50, 4);

            tamara.runAction(actionTo);
            grossini.runAction(CCRepeatForever.action(CCSequence.actions(actionBy, actionByBack)));
            // 이놈은 무제한 액션이다 계속 반복을 하며 멈추지 않는다.
            kathia.runAction(CCRepeatForever.action(actionUp));
        }

        public String title() {
            return "JumpTo / JumpBy";
        }
    }

Posted by coolsharp
    /**
    * FileName : ActionsTest.java
    * Comment : 크기 조절 데모
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionScale extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            centerSprites(3);

            // 2초간 0.5배 축소
            CCScaleTo actionTo = CCScaleTo.action(2, 0.5f);
            // 2초간 2배 확대
            CCScaleBy actionBy = CCScaleBy.action(2, 2);
            // 2초간 넓이 0.25배 축소, 높이 4.5배 늘림
            CCScaleBy actionBy2 = CCScaleBy.action(2, 0.25f, 4.5f);
            // 2배 확대된 것을 원상복구
            CCScaleBy actionByBack = actionBy.reverse();

            // 2초간 0.5배 축소
            tamara.runAction(actionTo);
            // 2초간 2배 확대 후 2초간 원상 복구
            grossini.runAction(CCSequence.actions(actionBy, actionByBack));
            // 2초간 넓이 0.25배 축소, 높이 4.5배 늘림
            kathia.runAction(CCSequence.actions(actionBy2, actionBy2.reverse()));
        }

        public String title() {
            return "ScaleTo / ScaleBy";
        }

    }

Posted by coolsharp

cocos2d for android - 회전

2011. 10. 18. 18:46 : 개발
    /**
    * FileName : ActionsTest.java
    * Comment : 회전 테스트
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionRotate extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            centerSprites(3);

            // 2초간 시계방향 45도 회전
            CCRotateTo actionTo = CCRotateTo.action(2, 45);
            // 2초가 반시계 방향 45도 회전
            CCRotateTo actionTo2 = CCRotateTo.action(2, -45);
            // 2초간 0도로 회전
            CCRotateTo actionTo0 = CCRotateTo.action(2, 0);
            // 2초간 시계방향으로 45도 회전 한 다음 다시 2초간 0도로 복귀
            tamara.runAction(CCSequence.actions(actionTo, actionTo0));

            // 2초간 시계방향으로 360도 회전
            CCRotateBy actionBy = CCRotateBy.action(2, 360);
            // 2초간 반시계방향으로 360도 회전
            CCRotateBy actionByBack = actionBy.reverse();
            // 2초간 시계방향으로 360도 회전 한 다음 다시 2초간 반시계방향으로 360도 회전
            grossini.runAction(CCSequence.actions(actionBy, actionByBack));

            // 2초간 반시계 방향으로 45도 회전 한다음 다시 2초간 0도로 복귀
            kathia.runAction(CCSequence.actions(actionTo2, actionTo0.copy()));
        }

        public String title() {
            return "RotateTo / RotateBy";
        }

    }

Posted by coolsharp
    /**
    * FileName : ActionsTest.java
    * Comment : 이동 테스트
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionMove extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            centerSprites(3);

            // 사이즈 객체 생성(윈도우 크기 가져오기)
            CGSize s = CCDirector.sharedDirector().winSize();

            // Move 액션 객체 생성하며 값 지정(윈도우 넓이-40만큼, 윈도우 높이-40만큼)
            CCMoveTo actionTo = CCMoveTo.action(2, CGPoint.ccp(s.width - 40, s.height - 40));

            // 이동 객체 생성하며 값 지정(80, 80)만큼
            CCMoveBy actionBy = CCMoveBy.action(2, CGPoint.ccp(80, 80));
            // 이동 객체 생성(actionBy의 반대로 설정)
            CCMoveBy actionByBack = actionBy.reverse();

            // 액션 시작
            tamara.runAction(actionTo);
            grossini.runAction(CCSequence.actions(actionBy, actionByBack));
            kathia.runAction(CCMoveTo.action(1, CGPoint.ccp(40, 40)));
        }

        public String title() {
            return "MoveTo / MoveBy";
        }
    }

Posted by coolsharp
    /**
    * FileName : ActionsTest.java
    * Comment : 사용자 변형 테스트
    * @version : 1.0
    * @author : coolsharp
    * @date : 2011. 10. 18.
    */
    static class ActionManual extends ActionDemo {
        public void onEnter() {
            super.onEnter();

            CGSize s = CCDirector.sharedDirector().winSize();

            // 크기 지정
            tamara.setScaleX(1.0f);
            tamara.setScaleY(1.0f);
            tamara.setPosition(CGPoint.ccp(100, 70));
            // 투명도 지정
            tamara.setOpacity(228);

            // 회전
            grossini.setRotation(180);
            // 위치 지정
            grossini.setPosition(CGPoint.ccp(s.width / 2, s.height / 2));
            // 채널 색상 지정
            grossini.setColor(ccColor3B.ccc3(255, 0, 0));

            // 위치 지정
            kathia.setPosition(CGPoint.ccp(s.width - 100, s.height / 2));
            // 채널 색상 지정
            kathia.setColor(ccColor3B.ccBLUE);
        }

        public String title() {
            return "Manual Transformation";
        }
    }

Posted by coolsharp

cocos2d for android - Remove

2011. 10. 18. 18:42 : 개발
/**
* FileName : RemoveTest.java
* Comment : Move 콜백 객체 배우자
* @version : 1.0
* @author : coolsharp
* @date : 2011. 10. 18.
*/
public class RemoveTest extends com.coolsharp.test.game.ActionManager.ActionManagerDemo {
    public RemoveTest() {
        super();

        // 이동 객체 생성
        CCMoveBy move = CCMoveBy.action(5, CGPoint.ccp(200, 0));

        // 콜백 객체 생성
        CCCallFunc callback = CCCallFunc.action(this, "stopAction");

        // 시퀀스 액션 등록(이동 객체를 콜백으로 등록)
        CCSequence sequence = CCSequence.actions(move, callback);
        // 시퀀스 객체를 나중에 찾아 써야 하므로 이름표 지정
        sequence.setTag(com.coolsharp.test.coolsharp_cocos2d_test_Activity.kTagSequence);

        CCSprite child = CCSprite.sprite("grossini.png");
        child.setPosition(CGPoint.ccp(200, 200));
        this.addChild(child, 1, com.coolsharp.test.coolsharp_cocos2d_test_Activity.kTagGrossini);

        // 시퀀스 액션 시작
        child.runAction(sequence);
    }

    public void stopAction() {
        Log.i("coolsharp", "SA");
//        CCNode sprite = getChildByTag(com.coolsharp.test.coolsharp_cocos2d_test_Activity.kTagGrossini);
//        sprite.stopAction(com.coolsharp.test.coolsharp_cocos2d_test_Activity.kTagSequence);
    }

    public String title() {
        return "Remove Test";
    }

    public String subtitle() {
        return "Should not crash. Testing issue #841";
    }

Posted by coolsharp

cocos2d for android - Pause

2011. 10. 18. 18:40 : 개발
/**
* FileName : PauseTest.java
* Comment : 일시 정지 테스트
* @version : 1.0
* @author : coolsharp
* @date : 2011. 10. 18.
*/
public class PauseTest extends com.coolsharp.test.game.ActionManager.ActionManagerDemo {
    /**
     * 생성자
     */
    public PauseTest() {
        super();
    }

    /**
    * Comment : 진입
    * @version : 1.0
    * @tags :
    * @date : 2011. 10. 18.
    * @see org.cocos2d.layers.CCLayer#onEnter()
    */
    public void onEnter() {
        super.onEnter();

        Log.i("coolsharp", "onEnter");

        CCSprite grossini = CCSprite.sprite("grossini.png");

        // 자식을 추가
        addChild(grossini, 0, com.coolsharp.test.coolsharp_cocos2d_test_Activity.kTagGrossini);

        grossini.setPosition(CGPoint.ccp(200, 200));

        // 이동 명령 1.0초동안 150, 0 으로 이동
        // 이전 처럼 바로 runAction이 아님 점의 유의
        CCAction action = CCMoveBy.action(1.0f, CGPoint.ccp(150, 0));

        // Action Maanger에 Action 일시 정지 상태로 등록함
        CCActionManager.sharedManager().addAction(action, grossini, true);

        // 이 스케쥴을 3초 후로 지정
        this.schedule("unpause", 3);
    }

    public void unpause(float dt) {
        // 스케쥴 해지
        unschedule("unpause");
        CCNode node = getChildByTag(com.coolsharp.test.coolsharp_cocos2d_test_Activity.kTagGrossini);
        // 노드 인덱스로 노드 가져옴(모든 객체의 선조는 CCNode임)
        CCActionManager.sharedManager().resume(node);
        // 진행
    }

    @Override
    public String title() {
        return "Pause Test";
    }

    public String subtitle() {
        return "After 3 seconds grossini should move";
    }
}

Posted by coolsharp

cocos2d for android - CrashTest

2011. 10. 18. 18:38 : 개발
/**
* FileName : CrashTest.java
* Comment : 액션 매니저 데모
* @version : 1.0
* @author : coolsharp
* @date : 2011. 10. 18.
*/
public class CrashTest extends com.coolsharp.test.game.ActionManager.ActionManagerDemo {
    /**
     * Crash 테스트
     */
    public CrashTest() {
        super();

        // CCSprite 생성
        CCSprite grossini = CCSprite.sprite("grossini.png");
        // 위치 지정
        grossini.setPosition(CGPoint.ccp(200, 200));
        // 자식으로 추가
        addChild(grossini);

        // 1.5초 동안 360도 각도를 틀음
        grossini.runAction(CCRotateBy.action(1.5f, 360));
        // 1.5초의 딜레이, 1.5초의 페이드아웃, 1.5초의 페이드인, 1.5초의 페이드아웃, 1.5초의 페이드
        grossini.runAction(CCSequence.actions(CCDelayTime.action(1.5f), CCFadeOut.action(1.5f), CCFadeIn.action(1.5f), CCFadeOut.action(1.5f), CCFadeIn.action(1.5f)));

        // 1.5초 후 홀로 소멸됨
        // 소멸되면서 같은 이름의 함수 호출
        this.runAction(CCSequence.actions(CCDelayTime.action(1.4f), CCCallFunc.action(this, "removeFunc")));

    }

    /**
    * Comment : 자기 자신을 죽이고 다른 넘을 호출하는 함수
    * @version : 1.0
    * @tags :
    * @date : 2011. 10. 18.
    */
    public void removeFunc() {
        // 부모를 얻은 후 자기 자신을 소멸함
        this.getParent().removeChild(this, true);
        // 선조 클레스에서 선언된 다음 레이어 호출
        this.nextCallback(null);
    }

    /**
    * Comment : 윈래 기본 타이틀을 오버라이딩 함
    * @version : 1.0
    * @tags : @return
    * @date : 2011. 10. 18.
    * @see com.coolsharp.test.game.ActionManager.ActionManagerDemo#title()
    */
    @Override
    public String title() {
        return "Test 1. Should not crash";
    }

    /**
    * Comment : 서브 타이틀 오버라이딩
    * @version : 1.0
    * @tags : @return
    * @date : 2011. 10. 18.
    * @see com.coolsharp.test.game.ActionManager.ActionManagerDemo#subtitle()
    */
    @Override
    public String subtitle() {
        return "한글 테스트";
    }
}

Posted by coolsharp
public abstract class ActionManagerDemo extends CCLayer {
    CCTextureAtlas atlas;

    public ActionManagerDemo() {

        CGSize s = CCDirector.sharedDirector().winSize();

        // 가운데 텍스트
        CCLabel label = CCLabel.makeLabel(title(), "DroidSans", 32);
        addChild(label, 1);
        label.setPosition(CGPoint.make(s.width / 2, s.height / 2)); // 레이블이 표시될 위치

        // 상단 텍스트
        String subtitle = subtitle();
        if (subtitle != null) {
            CCLabel l = CCLabel.makeLabel(subtitle, "DroidSerif", 24);
            addChild(l, 1);
            l.setPosition(CGPoint.ccp(s.width / 2, s.height - 80));
        }

        // 하단 네비게이션 컨트롤
        CCMenuItemImage item1 = CCMenuItemImage.item("b1.png", "b2.png", this, "backCallback");
        CCMenuItemImage item2 = CCMenuItemImage.item("r1.png", "r2.png", this, "restartCallback");
        CCMenuItemImage item3 = CCMenuItemImage.item("f1.png", "f2.png", this, "nextCallback");

        // 메뉴 등록으로 하단 네비게이션 컨트롤 시작
        CCMenu menu = CCMenu.menu(item1, item2, item3);

        // 메뉴 위치 지정
        menu.setPosition(CGPoint.make(0, 0));
        // 아이템별 메뉴 위치 등록
        item1.setPosition(CGPoint.make(s.width / 2 - 100, 30));
        item2.setPosition(CGPoint.make(s.width / 2, 30));
        item3.setPosition(CGPoint.make(s.width / 2 + 100, 30));
        // 메뉴를 등록
        addChild(menu, 1);
    }

    /**
    * Comment : restart callback
    * @version : 1.0
    * @tags : @param sender
    * @date : 2011. 10. 18.
    */
    public void restartCallback(Object sender) {
        CCScene s = CCScene.node();
        s.addChild(coolsharp_cocos2d_test_Activity.restartAction());
        CCDirector.sharedDirector().replaceScene(s);
    }

    /**
    * Comment : next callback
    * @version : 1.0
    * @tags : @param sender
    * @date : 2011. 10. 18.
    */
    public void nextCallback(Object sender) {
        CCScene s = CCScene.node();
        s.addChild(coolsharp_cocos2d_test_Activity.nextAction());
        CCDirector.sharedDirector().replaceScene(s);
        Log.i("coolsharp", "next");
    }

    /**
    * Comment : back callback
    * @version : 1.0
    * @tags : @param sender
    * @date : 2011. 10. 18.
    */
    public void backCallback(Object sender) {
        CCScene s = CCScene.node();
        s.addChild(coolsharp_cocos2d_test_Activity.backAction());
        CCDirector.sharedDirector().replaceScene(s);
        Log.i("coolsharp", "back");
    }

    /**
    * Comment : title
    * @version : 1.0
    * @tags : @return
    * @date : 2011. 10. 18.
    */
    public String title() {
        return "No Title!";
    }

    /**
    * Comment : subtitle
    * @version : 1.0
    * @tags : @return
    * @date : 2011. 10. 18.
    */
    public String subtitle() {
        return null;
    }

Posted by coolsharp

cocos2d for android 개발

2011. 10. 18. 18:35 : 개발
제가 어제부터 게임 프로그래머의 길에 접어 들었습니다.

오늘부터 학습 내용을 하나씩하나씩 블로그에 올릴 예정 입니다.

Posted by coolsharp