'2014/01/02'에 해당되는 글 2건
- 2014.01.02 영어와 숫자만 가능하게 처리하기
- 2014.01.02 TextInputTest 예제 소스
//id 형식 체크
bool id_check(const char * text) {
const char c = *text;
if((c < '0' || c > '9') && (c < 'a' || c > 'z') && (c < 'A' || c > 'Z')) {
CCMessageBox("id는 영어와 숫자만 가능합니다","아이디체크");
return (false);
}
return true;
}
'잡다한것들전부 > 팁' 카테고리의 다른 글
| cocos2d-x 로딩 관련 (0) | 2014.01.06 |
|---|---|
| cocos2d-x 샘플 소스 소개 (0) | 2014.01.06 |
| 영어와 숫자만 가능하게 처리하기 (0) | 2014.01.02 |
| TextInputTest 예제 소스 (0) | 2014.01.02 |
| string::find와 string::npos 관계 (0) | 2013.12.24 |
| sd 카드 접근 (0) | 2013.12.23 |
cocos2d-x 샘플소스
모든 클래스는 TestScene 상속받음
runThisTest() 함수 실행
runThisTest 에서는 replaceScene 실행함
예)
void TextInputTestScene::runThisTest()
{
CCLayer* pLayer = nextTextInputTest();
addChild(pLayer);
CCDirector::sharedDirector()->replaceScene(this);
}
씬전환은 init 함수에서 바로 하면 에러가 난다. ->씬이 만들어지기전에 전환을 해버려서 에러
반드시 업데이트는 한번 돌리고 나서 해야된다.
TextFieldTTFDefaultTest 클래스에 딜리게이트 추가
class TextFieldTTFDefaultTest : public KeyboardNotificationLayer, public CCTextFieldDelegate
{
// CCTextFieldDelegate
virtual bool onTextFieldAttachWithIME(CCTextFieldTTF * sender);
virtual bool onTextFieldDetachWithIME(CCTextFieldTTF * sender);
virtual bool onTextFieldInsertText(CCTextFieldTTF * sender, const char * text, int nLen);
virtual bool onTextFieldDeleteBackward(CCTextFieldTTF * sender, const char * delText, int nLen);
virtual bool onDraw(CCTextFieldTTF * sender);
}
void TextFieldTTFDefaultTest::onEnter()
{
//CCTextFieldTTF 생성
CCTextFieldTTF * pTextField = CCTextFieldTTF::textFieldWithPlaceHolder("<click here for input>",
FONT_NAME,
FONT_SIZE);
addChild(pTextField);
//딜리게이트 추가
pTextField->setDelegate(this);
}
정리한것 TextInputLayer
'잡다한것들전부 > 팁' 카테고리의 다른 글
| cocos2d-x 샘플 소스 소개 (0) | 2014.01.06 |
|---|---|
| 영어와 숫자만 가능하게 처리하기 (0) | 2014.01.02 |
| TextInputTest 예제 소스 (0) | 2014.01.02 |
| string::find와 string::npos 관계 (0) | 2013.12.24 |
| sd 카드 접근 (0) | 2013.12.23 |
| c 와 c++ 관련 자료 (0) | 2013.12.19 |
TextInputTest.zip

