간단하게 데이터를 저장하기위해
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 |



