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;
}
댓글
댓글 쓰기