void ProjectConfig::resetToWelcome(void)
{
	m_isWelcome = true;

    //string path = SimulatorConfig::sharedDefaults()->getQuickCocos2dxRootPath();
    //path.append("player/welcome");
	//2014-04-03 zrong add path by enviroment.
#if defined(_WINDOWS)
	string path = "d:/works/yhq/projects/lulala";
	//string path = "d:/cocos2dx/quick/samples/filters";
	//string path = "d:/works/yhq/projects/test_player";
#else
	string path = "/Users/Team1201/works/yhq/projects/lulala";
   	//string path = "/Users/Team1201/cocos2dx/quick/samples/filters";
#endif
	//2014-04-03 zrong add done.

    SimulatorConfig::makeNormalizePath(&path);
    setProjectDir(path);
    setWritablePath(path);
    setScriptFile("$PROJDIR/scripts/main.lua");
    setFrameSize(CCSize(960, 640));
    setFrameScale(1.0f);
    setLoadPrecompiledFramework(false);
    setPackagePath("");
    setShowConsole(false);
    setWindowOffset(CCPointZero);
    setWriteDebugLogToFile(false);
}
void ProjectConfig::resetToWelcome(void)
{
	m_isWelcome = true;
    string path = SimulatorConfig::sharedDefaults()->getQuickCocos2dxRootPath();
    path.append("player/welcome");
    SimulatorConfig::makeNormalizePath(&path);
    setProjectDir(path);
    setWritablePath(path);
    setScriptFile("$PROJDIR/scripts/main.lua");
    setFrameSize(CCSize(960, 640));
    setFrameScale(1.0f);
    setLoadPrecompiledFramework(true);
    setPackagePath("");
    setShowConsole(true);
    setWindowOffset(CCPointZero);
    setWriteDebugLogToFile(false);
}
void ProjectConfig::parseCommandLine(vector<string>& args)
{
    vector<string>::iterator it = args.begin();
    while (it != args.end())
    {
        const string& arg = *it;

        if (arg.compare("-quick") == 0)
        {
            ++it;
            if (it == args.end()) break;
            SimulatorConfig::sharedDefaults()->setQuickCocos2dxRootPath((*it).c_str());
        }
        else if (arg.compare("-workdir") == 0)
        {
            ++it;
            if (it == args.end()) break;
            setProjectDir(*it);
            if (m_writablePath.length() == 0) setWritablePath(*it);
        }
        else if (arg.compare("-writable") == 0)
        {
            ++it;
            if (it == args.end()) break;
            setWritablePath(*it);
        }
        else if (arg.compare("-file") == 0)
        {
            ++it;
            if (it == args.end()) break;
            setScriptFile(*it);
        }
        else if (arg.compare("-package.path") == 0)
        {
            ++it;
            if (it == args.end()) break;
            setPackagePath(*it);
        }
        else if (arg.compare("-landscape") == 0)
        {
            setFrameSize(CCSize(DEFAULT_HEIGHT, DEFAULT_WIDTH));
        }
        else if (arg.compare("-portrait") == 0)
        {
            setFrameSize(CCSize(DEFAULT_WIDTH, DEFAULT_HEIGHT));
        }
        else if (arg.compare("-size") == 0)
        {
            ++it;
            if (it == args.end()) break;
            const string& sizeStr(*it);
            size_t pos = sizeStr.find('x');
            int width = 0;
            int height = 0;
            if (pos != sizeStr.npos && pos > 0)
            {
                string widthStr, heightStr;
                widthStr.assign(sizeStr, 0, pos);
                heightStr.assign(sizeStr, pos + 1, sizeStr.length() - pos);
                width = atoi(widthStr.c_str());
                height = atoi(heightStr.c_str());
                setFrameSize(CCSize(width, height));
            }
        }
        else if (arg.compare("-scale") == 0)
        {
            ++it;
            if (it == args.end()) break;
            float scale = atof((*it).c_str());
            setFrameScale(scale);
        }
        else if (arg.compare("-write-debug-log") == 0)
        {
            setWriteDebugLogToFile(true);
        }
        else if (arg.compare("-disable-write-debug-log") == 0)
        {
            setWriteDebugLogToFile(false);
        }
        else if (arg.compare("-console") == 0)
        {
            setShowConsole(true);
        }
        else if (arg.compare("-disable-console") == 0)
        {
            setShowConsole(false);
        }
        else if (arg.compare("-load-framework") == 0)
        {
            setLoadPrecompiledFramework(true);
        }
        else if (arg.compare("-disable-load-framework") == 0)
        {
            setLoadPrecompiledFramework(false);
        }
        else if (arg.compare("-offset") == 0)
        {
            ++it;
            if (it == args.end()) break;
            CCPoint pos = CCPointFromString((*it).c_str());
            setWindowOffset(pos);
        }
        else if (arg.compare("-debugger-ldt") == 0)
        {
            setDebuggerType(kCCLuaDebuggerLDT);
        }
        else if (arg.compare("-disable-debugger") == 0)
        {
            setDebuggerType(kCCLuaDebuggerNone);
        }
        else if (arg.compare("-relaunch-off") == 0)
        {
            setExitWhenRelaunch(true);
        }
        else if (arg.compare("-relaunch-on") == 0)
        {
            setExitWhenRelaunch(false);
        }

        ++it;
    }
}