간단하게 데이터를 저장하기위해

UserDefault 클래스를 사용한다.

이때 주의점은 Key는 붙여써야 하는것 같다.

XML로 저장되는데 Key에 공백이 있는 경우 제대로 불러오질 못한다.



	UserDefault *def = UserDefault::getInstance();
	auto highScore = def->getIntegerForKey("HIGHSCORE_FLAPPY", 0);
	if (score > highScore)
	{
		highScore = score;
		def->setIntegerForKey("HIGHSCORE_FLAPPY", highScore);
	}
	def->flush();	


Windows 플랫폼의 경우 아래와 같은 경로에 XML이 생긴다.

%UserLocal%\GameName\UserDefault.xml




'Cocos2D-X' 카테고리의 다른 글

색상(TintBy, TintTo)  (0) 2016.05.15
회전(RotateBy, RotateTo)  (0) 2016.05.09
스케일(ScaleBy, ScaleTo)  (0) 2016.05.09
어떤 지점에 놓음(Place)  (0) 2016.05.09
3차 베지어곡선(BezierBy, BezierTo)  (0) 2016.05.08
Posted by 빵원군
,

Grid 설정

GIMP 2016. 6. 1. 22:46

Grid 설정

Image - Configure Grid - Spacing 조정




'GIMP' 카테고리의 다른 글

모자이크처리  (0) 2015.11.30
Posted by 빵원군
,

색상(TintBy, TintTo)

Cocos2D-X 2016. 5. 15. 13:02

TintBy, TintTo

색상과 관련된 Action인데 RGB 색상을 빼거나 합치는 느낌이다. 정확히는 더 공부해봐야 알듯..

 <원본>


<TintBy적용>


bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }

    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();

    mySprite = Sprite::create("HelloWorld.png");
    mySprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
    this->addChild(mySprite);
    
    //추가할 내용
	auto action = TintBy::create(3, 0, -255, 0);
	mySprite->runAction(action);

    return true;
}


'Cocos2D-X' 카테고리의 다른 글

간단하게 데이터 저장 - UserDefault 사용법  (0) 2016.06.15
회전(RotateBy, RotateTo)  (0) 2016.05.09
스케일(ScaleBy, ScaleTo)  (0) 2016.05.09
어떤 지점에 놓음(Place)  (0) 2016.05.09
3차 베지어곡선(BezierBy, BezierTo)  (0) 2016.05.08
Posted by 빵원군
,