当前位置: 首页>>代码示例>>C++>>正文


C++ CSimpleIniA类代码示例

本文整理汇总了C++中CSimpleIniA的典型用法代码示例。如果您正苦于以下问题:C++ CSimpleIniA类的具体用法?C++ CSimpleIniA怎么用?C++ CSimpleIniA使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CSimpleIniA类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loadCountryValues

void Config::loadCountryValues(string configFile, string country)
{
    CSimpleIniA iniObj;
    iniObj.SetMultiKey(true);
    iniObj.LoadFile(configFile.c_str());
    CSimpleIniA* ini = &iniObj;

    minPlateSizeWidthPx = getInt(ini, "", "min_plate_size_width_px", 100);
    minPlateSizeHeightPx = getInt(ini, "", "min_plate_size_height_px", 100);

    multiline = 	getBoolean(ini, "", "multiline",		false);

    string invert_val = getString(ini, "", "invert", "auto");

    if (invert_val == "always")
    {
        auto_invert = false;
        always_invert = true;
    }
    else if (invert_val == "never")
    {
        auto_invert = false;
        always_invert = false;
    }
    else
    {
        auto_invert = true;
        always_invert = false;
    }

    plateWidthMM = getFloat(ini, "", "plate_width_mm", 100);
    plateHeightMM = getFloat(ini, "", "plate_height_mm", 100);

    charHeightMM = getAllFloats(ini, "", "char_height_mm");
    charWidthMM = getAllFloats(ini, "", "char_width_mm");

    // Compute the average char height/widths
    avgCharHeightMM = 0;
    avgCharWidthMM = 0;
    for (unsigned int i = 0; i < charHeightMM.size(); i++)
    {
        avgCharHeightMM += charHeightMM[i];
        avgCharWidthMM += charWidthMM[i];
    }
    avgCharHeightMM /= charHeightMM.size();
    avgCharWidthMM /= charHeightMM.size();

    charWhitespaceTopMM = getFloat(ini, "", "char_whitespace_top_mm", 100);
    charWhitespaceBotMM = getFloat(ini, "", "char_whitespace_bot_mm", 100);
    charWhitespaceBetweenLinesMM = getFloat(ini, "", "char_whitespace_between_lines_mm", 5);

    templateWidthPx = getInt(ini, "", "template_max_width_px", 100);
    templateHeightPx = getInt(ini, "", "template_max_height_px", 100);

    charAnalysisMinPercent = getFloat(ini, "", "char_analysis_min_pct", 0);
    charAnalysisHeightRange = getFloat(ini, "", "char_analysis_height_range", 0);
    charAnalysisHeightStepSize = getFloat(ini, "", "char_analysis_height_step_size", 0);
    charAnalysisNumSteps = getInt(ini, "", "char_analysis_height_num_steps", 0);

    segmentationMinSpeckleHeightPercent = getFloat(ini, "", "segmentation_min_speckle_height_percent", 0);
    segmentationMinBoxWidthPx = getInt(ini, "", "segmentation_min_box_width_px", 0);
    segmentationMinCharHeightPercent = getFloat(ini, "", "segmentation_min_charheight_percent", 0);
    segmentationMaxCharWidthvsAverage = getFloat(ini, "", "segmentation_max_segment_width_percent_vs_average", 0);

    plateLinesSensitivityVertical = getFloat(ini, "", "plateline_sensitivity_vertical", 0);
    plateLinesSensitivityHorizontal = getFloat(ini, "", "plateline_sensitivity_horizontal", 0);

    ocrLanguage = getString(ini, "", "ocr_language", "none");

    postProcessRegexLetters = getString(ini, "", "postprocess_regex_letters", "\\pL");
    postProcessRegexNumbers = getString(ini, "", "postprocess_regex_numbers", "\\pN");

    ocrImageWidthPx = round(((float) templateWidthPx) * ocrImagePercent);
    ocrImageHeightPx = round(((float)templateHeightPx) * ocrImagePercent);
    stateIdImageWidthPx = round(((float)templateWidthPx) * stateIdImagePercent);
    stateIdimageHeightPx = round(((float)templateHeightPx) * stateIdImagePercent);

    postProcessMinCharacters = getInt(ini, "", "postprocess_min_characters", 4);
    postProcessMaxCharacters = getInt(ini, "", "postprocess_max_characters", 8);
}
开发者ID:josephgodwinkimani,项目名称:openalpr,代码行数:80,代码来源:config.cpp

示例2: main

int main(int argc, const char * argv[]) {
    CSimpleIniA ini;
    
    ini.SetUnicode();
    if (ini.LoadFile("config.ini") == SI_FILE) {
        std::cout<< KWARN "Warning:" <<KREST << " Cannot load config.ini. Default setting is used.\n\n";
    }

    bool gui = true;
    
    uint16_t port = atoi(ini.GetValue("server", "port", stringize(SERVER_DEFAULT_PORT)));
    uint32_t numThreads = atoi(ini.GetValue("server", "threads", stringize(SERVER_DEFAULT_NUM_THREADS)));
    
    int width = atoi(ini.GetValue("camera", "width", stringize(CAM_DEFAULT_WIDTH)));
    int height = atoi(ini.GetValue("camera", "height", stringize(CAM_DEFAULT_HEIGHT)));
    uint32_t wait = atoi(ini.GetValue("camera", "wait", stringize(CAM_WAIT)));
    int dev = atoi(ini.GetValue("camera", "device", stringize(CAM_DEV)));
    
    const char* unlockPin = ini.GetValue("gpio", "unlock", GPIO_DEFAULT_UNLOCK);
    const char* errorPin = ini.GetValue("gpio", "error", GPIO_DEFAULT_ERROR);
    
    const char* rsapath = ini.GetValue("safety", "pem", SAFETY_DEFAULT_RSA_FILE);
    const char* passwd = ini.GetValue("safety", "password", SAFETY_DEFAULT_PASSWD);
    
    uint32_t qrexp = atoi(ini.GetValue("misc", "qrexpire", stringize(MISC_DEFAULT_QR_EXP)));
    
    for (int i = 1; i < argc; i++) {
        const char* arg = argv[i];
        
        if (strcmp(arg, "--help") == 0) {
            printf("%s", HELP_STRING);
            exit(0);
        } else if (strcmp(arg, "--nogui") == 0) {
            gui = false;
        } else {
            std::cerr<<KERR <<"Error:" << KREST << "unknown argument \""<<arg<<'"'<<std::endl;
            exit(2);
        }
    }
    
    ServerThreads::qrexp = qrexp;
    ServerThreads::port = port;
    ServerThreads::numThreads = numThreads;
    ServerThreads::gpioUnlock = unlockPin;
    ServerThreads::gpioError = errorPin;
    ServerThreads::rsaFile = rsapath;

    if (signal(SIGINT, sigHandler) == SIG_ERR)
        std::cerr<<"Can't catch SIGINT\n";
    
    pthread_t serverThreadId;
    pthread_create(&serverThreadId, nullptr, ServerThreads::startServer, nullptr);
    
    const char* apnRsaFile = ini.GetValue("apn", "pem", APN_DEFAULT_RSA_FILE);
    
    APNClient::DefaultClient.host = ini.GetValue("apn", "host", APN_DEFAULT_HOST);
    APNClient::DefaultClient.port = atoi(ini.GetValue("apn", "port", stringize(APN_DEFAULT_PORT)));
    APNClient::DefaultClient.rsa = rsaFromFile(apnRsaFile, true);
    
    REPL::cleanupFn = cleanup;
    REPL::password = passwd;
    pthread_t replThreadId;
    pthread_create(&replThreadId, nullptr, REPL::startLoop, nullptr);
    
    pthread_t btThreadId;
    pthread_create(&btThreadId, nullptr, BluetoothThread::startLoop, nullptr);
    
    CameraLoop::loop(dev, width, height, gui, wait);
    
    return 1;
}
开发者ID:equinox1993,项目名称:Smarter-Lock,代码行数:71,代码来源:main.cpp

示例3: loadCommonValues

void Config::loadCommonValues(string configFile)
{

    CSimpleIniA iniObj;
    iniObj.LoadFile(configFile.c_str());
    CSimpleIniA* ini = &iniObj;

    runtimeBaseDir = getString(ini, "", "runtime_dir", "/usr/share/openalpr/runtime_data");

    std::string detectorString = getString(ini, "", "detector", "lbpcpu");
    std::transform(detectorString.begin(), detectorString.end(), detectorString.begin(), ::tolower);

    if (detectorString.compare("lbpcpu") == 0)
        detector = DETECTOR_LBP_CPU;
    else if (detectorString.compare("lbpgpu") == 0)
        detector = DETECTOR_LBP_GPU;
    else if (detectorString.compare("lbpopencl") == 0)
        detector = DETECTOR_LBP_OPENCL;
    else if (detectorString.compare("morphcpu") == 0)
        detector = DETECTOR_MORPH_CPU;
    else
    {
        std::cerr << "Invalid detector specified: " << detectorString << ".  Using default" << std::endl;
        detector = DETECTOR_LBP_CPU;
    }

    detection_iteration_increase = getFloat(ini, "", "detection_iteration_increase", 1.1);
    detectionStrictness = getInt(ini, "", "detection_strictness", 3);
    maxPlateWidthPercent = getFloat(ini, "", "max_plate_width_percent", 100);
    maxPlateHeightPercent = getFloat(ini, "", "max_plate_height_percent", 100);
    maxDetectionInputWidth = getInt(ini, "", "max_detection_input_width", 1280);
    maxDetectionInputHeight = getInt(ini, "", "max_detection_input_height", 768);

    mustMatchPattern = getBoolean(ini, "", "must_match_pattern", false);

    skipDetection = getBoolean(ini, "", "skip_detection", false);

    prewarp = getString(ini, "", "prewarp", "");

    maxPlateAngleDegrees = getInt(ini, "", "max_plate_angle_degrees", 15);


    ocrImagePercent = getFloat(ini, "", "ocr_img_size_percent", 100);
    stateIdImagePercent = getFloat(ini, "", "state_id_img_size_percent", 100);

    ocrMinFontSize = getInt(ini, "", "ocr_min_font_point", 100);

    postProcessMinConfidence = getFloat(ini, "", "postprocess_min_confidence", 100);
    postProcessConfidenceSkipLevel = getFloat(ini, "", "postprocess_confidence_skip_level", 100);

    debugGeneral = 	getBoolean(ini, "", "debug_general",		false);
    debugTiming = 	getBoolean(ini, "", "debug_timing",		false);
    debugPrewarp = 	getBoolean(ini, "", "debug_prewarp",		false);
    debugDetector = 	getBoolean(ini, "", "debug_detector",		false);
    debugStateId = 	getBoolean(ini, "", "debug_state_id",		false);
    debugPlateLines = 	getBoolean(ini, "", "debug_plate_lines", 	false);
    debugPlateCorners = 	getBoolean(ini, "", "debug_plate_corners", 	false);
    debugCharSegmenter = 	getBoolean(ini, "", "debug_char_segment", 	false);
    debugCharAnalysis =	getBoolean(ini, "", "debug_char_analysis",	false);
    debugColorFiler = 	getBoolean(ini, "", "debug_color_filter", 	false);
    debugOcr = 		getBoolean(ini, "", "debug_ocr", 		false);
    debugPostProcess = 	getBoolean(ini, "", "debug_postprocess", 	false);
    debugShowImages = 	getBoolean(ini, "", "debug_show_images",	false);
    debugPauseOnFrame = 	getBoolean(ini, "", "debug_pause_on_frame",	false);

}
开发者ID:josephgodwinkimani,项目名称:openalpr,代码行数:66,代码来源:config.cpp

示例4: main

int32_t main (int32_t argc, char **argv)
{
    OTLog::vOutput(0, "\n\nWelcome to Open Transactions... Test Server -- version %s\n"
                   "(transport build: OTMessage -> TCP -> SSL)\n"
                   "IF YOU PREFER TO USE XmlRpc with HTTP, then rebuild from main folder like this:\n\n"
                   "cd ..; make clean; make rpc\n\n",
                   OTLog::Version());

    // -----------------------------------------------------------------------

    // This object handles all the actual transaction notarization details.
    // (This file you are reading is a wrapper for OTServer, which adds the transport layer.)
    OTServer theServer;

    // -----------------------------------------------------------------------

#ifdef _WIN32
    WSADATA wsaData;
    WORD wVersionRequested = MAKEWORD( 2, 2 );
    int32_t err = WSAStartup( wVersionRequested, &wsaData );

    /* Tell the user that we could not find a usable		*/
    /* Winsock DLL.											*/

    OT_ASSERT_MSG((err == 0), "WSAStartup failed!\n");


    /*	Confirm that the WinSock DLL supports 2.2.			*/
    /*	Note that if the DLL supports versions greater		*/
    /*	than 2.2 in addition to 2.2, it will still return	*/
    /*	2.2 in wVersion since that is the version we		*/
    /*	requested.											*/

    bool bWinsock = (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2);

    /* Tell the user that we could not find a usable */
    /* WinSock DLL.                                  */

    if (!bWinsock) WSACleanup();  // do cleanup.
    OT_ASSERT_MSG((!bWinsock), "Could not find a usable version of Winsock.dll\n");

    /* The Winsock DLL is acceptable. Proceed to use it. */
    /* Add network programming using Winsock here */
    /* then call WSACleanup when done using the Winsock dll */
    OTLog::vOutput(0,"The Winsock 2.2 dll was found okay\n");
#endif

    OTLog::vOutput(0, "\n\nWelcome to Open Transactions, version %s.\n\n", OTLog::Version());

    // -----------------------------------------------------------------------
    // The beginnings of an INI file!!

#ifndef _WIN32 // if UNIX (NOT windows)
    wordexp_t exp_result;
    wordexp(OT_INI_FILE_DEFAULT, &exp_result, 0);

    const OTString strIniFileDefault(exp_result.we_wordv[0]);

    wordfree(&exp_result);
#else
    const OTString strIniFileDefault(OT_INI_FILE_DEFAULT);
#endif

    OTString strPath(SERVER_PATH_DEFAULT);

    {
        CSimpleIniA ini;

        SI_Error rc = ini.LoadFile(strIniFileDefault.Get());

        if (rc >=0)
        {
            const char * pVal = ini.GetValue("paths", "server_path", SERVER_PATH_DEFAULT); // todo stop hardcoding.

            if (NULL != pVal)
            {
                strPath.Set(pVal);
                OTLog::vOutput(0, "Reading ini file (%s). \n Found Server data_folder path: %s \n",
                               strIniFileDefault.Get(), strPath.Get());
            }
            else
            {
                strPath.Set(SERVER_PATH_DEFAULT);
                OTLog::vOutput(0, "Reading ini file (%s): \n Failed reading Server data_folder path. Using: %s \n",
                               strIniFileDefault.Get(), strPath.Get());
            }
        }
        else
        {
            strPath.Set(SERVER_PATH_DEFAULT);
            OTLog::vOutput(0, "Unable to load ini file (%s) to find data_folder path\n Will assume that server data_folder is at path: %s \n",
                           strIniFileDefault.Get(), strPath.Get());
        }
    }
    // -----------------------------------------------------------------------

    OTString strCAFile, strDHFile, strKeyFile;
    //, strSSLPassword;

    if (argc < 1)
//.........这里部分代码省略.........
开发者ID:BugFreeSoftware,项目名称:Open-Transactions,代码行数:101,代码来源:testserver.cpp

示例5: loadSettings

bool SettingsManager::loadSettings()
{
    CSimpleIniA ini;
    ini.SetUnicode();
    ini.LoadFile("CONFIG.ini");

    if(ini.IsEmpty())
        {return false;}

    m_settings = new SettingsObject();

    m_settings->FRAME_TITLE = ini.GetValue("FRAME", "TITLE", "");
    m_settings->FRAME_FULLSCREEN = ini.GetBoolValue("FRAME", "FULLSCREEN", false);
    m_settings->FRAME_RESOLUTION_FULLSCREEN_X = ini.GetLongValue("FRAME", "RESOLUTION_FULLSCREEN_X", 0);
    m_settings->FRAME_RESOLUTION_FULLSCREEN_Y = ini.GetLongValue("FRAME", "RESOLUTION_FULLSCREEN_Y", 0);
    m_settings->FRAME_RESOLUTION_WINDOWED_X = ini.GetLongValue("FRAME", "RESOLUTION_WINDOWED_X", 0);
    m_settings->FRAME_RESOLUTION_WINDOWED_Y = ini.GetLongValue("FRAME", "RESOLUTION_WINDOWED_Y", 0);
    m_settings->FRAME_VIEW_X = ini.GetLongValue("FRAME", "VIEW_X", 0);
    m_settings->FRAME_VIEW_Y = ini.GetLongValue("FRAME", "VIEW_Y", 0);

    m_settings->WORLD_GRAVITY = (float)ini.GetDoubleValue("WORLD", "GRAVITY", 0);

    m_settings->PLAYER_SPEED_SIDE = (float)ini.GetDoubleValue("PLAYER", "SPEED_SIDE", 0);
    m_settings->PLAYER_SPEED_SIDE_HALTING = (float)ini.GetDoubleValue("PLAYER", "SPEED_SIDE_HALTING", 0);
    m_settings->PLAYER_SPEED_JUMP = (float)ini.GetDoubleValue("PLAYER", "SPEED_JUMP", 0);
    m_settings->PLAYER_SPEED_DOWN = (float)ini.GetDoubleValue("PLAYER", "SPEED_DOWN", 0);
    m_settings->PLAYER_HEALTH = (float)ini.GetDoubleValue("PLAYER", "HEALTH", 0);
    m_settings->PLAYER_SWORD_SWING_TIME = (float)ini.GetDoubleValue("PLAYER", "SWORD_SWING_TIME", 0);
    m_settings->PLAYER_HIT_TIME_LIMIT_MELEE = (float)ini.GetDoubleValue("PLAYER", "HIT_TIME_LIMIT_MELEE", 0);
    m_settings->PLAYER_KNOCKBACK_SPEED_X_INIT = (float)ini.GetDoubleValue("PLAYER", "KNOCKBACK_SPEED_X_INIT", 0);
    m_settings->PLAYER_KNOCKBACK_SPEED_X_DECREASE = (float)ini.GetDoubleValue("PLAYER", "KNOCKBACK_SPEED_X_DECREASE", 0);
    m_settings->PLAYER_KNOCKBACK_SPEED_Y = (float)ini.GetDoubleValue("PLAYER", "KNOCKBACK_SPEED_Y", 0);

    m_settings->DAMAGE_ENEMY_PLACEHOLDER_TO_PLAYER = (float)ini.GetDoubleValue("DAMAGE", "ENEMY_PLACEHOLDER_TO_PLAYER", 0);
    m_settings->DAMAGE_ENEMY_TROLL_TO_PLAYER = (float)ini.GetDoubleValue("DAMAGE", "ENEMY_TROLL_TO_PLAYER", 0);
    m_settings->DAMAGE_PLAYER_TO_ENEMY_PLACEHOLDER = (float)ini.GetDoubleValue("DAMAGE", "PLAYER_TO_ENEMY_PLACEHOLDER", 0);
    m_settings->DAMAGE_PLAYER_TO_ENEMY_TROLL = (float)ini.GetDoubleValue("DAMAGE", "PLAYER_TO_ENEMY_TROLL", 0);
    m_settings->DAMAGE_ENEMY_PROJECTILE_TO_PLAYER = (float)ini.GetDoubleValue("DAMAGE", "ENEMY_PROJECTILE_TO_PLAYER", 0);
    m_settings->DAMAGE_PLAYER_TO_ENEMY_SHOOTER = (float)ini.GetDoubleValue("DAMAGE", "PLAYER_TO_ENEMY_SHOOTER", 0);
    m_settings->DAMAGE_ENEMY_BASE_TO_PLAYER = (float)ini.GetDoubleValue("DAMAGE", "ENEMY_BASE_TO_PLAYER", 0);
    m_settings->DAMAGE_PLAYER_TO_ENEMY_GOBLIN = (float)ini.GetDoubleValue("DAMAGE", "PLAYER_TO_ENEMY_TROLL", 0);

    m_settings->ENEMY_TROLL_HEALTH = (float)ini.GetDoubleValue("ENEMY_TROLL", "HEALTH", 0);
    m_settings->ENEMY_TROLL_HIT_TIME_LIMIT_MELEE = (float)ini.GetDoubleValue("ENEMY_TROLL", "HIT_TIME_LIMIT_MELEE", 0);
    m_settings->ENEMY_TROLL_SPEED_SIDE = (float)ini.GetDoubleValue("ENEMY_TROLL", "SPEED_SIDE", 0);
    m_settings->ENEMY_TROLL_HITBOX_SIZE_X = (float)ini.GetDoubleValue("ENEMY_TROLL", "HITBOX_SIZE_X", 0);
    m_settings->ENEMY_TROLL_HITBOX_SIZE_Y = (float)ini.GetDoubleValue("ENEMY_TROLL", "HITBOX_SIZE_Y", 0);
    m_settings->ENEMY_TROLL_HITBOX_LOCAL_POSITION_X = (float)ini.GetDoubleValue("ENEMY_TROLL", "HITBOX_LOCAL_POSITION_X", 0);
    m_settings->ENEMY_TROLL_HITBOX_LOCAL_POSITION_Y = (float)ini.GetDoubleValue("ENEMY_TROLL", "HITBOX_LOCAL_POSITION_Y", 0);
    m_settings->ENEMY_TROLL_AI_CHANGE_LIMIT_TIME = (float)ini.GetDoubleValue("ENEMY_TROLL", "AI_CHANGE_LIMIT_TIME", 0);
    m_settings->ENEMY_TROLL_AI_WALKING_BACKWARDS_DISTANCE_LIMIT = (float)ini.GetDoubleValue("ENEMY_TROLL", "AI_WALKING_BACKWARDS_DISTANCE_LIMIT", 0);
    m_settings->ENEMY_TROLL_ATTACK_STAGE_1_TIME = (float)ini.GetDoubleValue("ENEMY_TROLL", "ATTACK_STAGE_1_TIME", 0);
    m_settings->ENEMY_TROLL_ATTACK_STAGE_2_TIME = (float)ini.GetDoubleValue("ENEMY_TROLL", "ATTACK_STAGE_2_TIME", 0);

    m_settings->ENEMY_GOBLIN_HEALTH = (float)ini.GetDoubleValue("ENEMY_GOBLIN", "HEALTH", 0);
    m_settings->ENEMY_GOBLIN_SPEED_SIDE = (float)ini.GetDoubleValue("ENEMY_GOBLIN", "SPEED_SIDE", 0);
    m_settings->ENEMY_GOBLIN_BOMB_SPAWN_TIME = (float)ini.GetDoubleValue("ENEMY_GOBLIN", "BOMB_SPAWN_TIME", 0);
    m_settings->ENEMY_GOBLIN_BOMB_AOE_DURATION = (float)ini.GetDoubleValue("ENEMY_GOBLIN", "BOMB_AOE_DURATION", 0);
    m_settings->ENEMY_GOBLIN_BOMB_BLAST_AREA_SIZE = (float)ini.GetDoubleValue ("ENEMY_GOBLIN", "BOMB_BLAST_AREA_SIZE", 0);

    m_settings->ENEMY_SHOOTER_SHOOT_TIME = (float)ini.GetDoubleValue("ENEMY_SHOOTER", "SHOOT_TIME", 0);
    m_settings->ENEMY_SHOOTER_PROJECTILE_PARTICLE_SPAWN_TIME = (float)ini.GetDoubleValue("ENEMY_SHOOTER", "PROJECTILE_PARTICLE_SPAWN_TIME", 0);
    m_settings->ENEMY_SHOOTER_PROJETILE_SPEED = (float)ini.GetDoubleValue("ENEMY_SHOOTER", "PROJETILE_SPEED", 0);
    m_settings->ENEMY_SHOOTER_PROJECTILE_LIFE_TIME = (float)ini.GetDoubleValue("ENEMY_SHOOTER", "PROJECTILE_LIFE_TIME", 0);

    m_settings->ENEMY_BASE_HEALTH = (float)ini.GetDoubleValue("ENEMY_BASE", "HEALTH", 0);
    m_settings->ENEMY_BASE_SPEED_BASE = (float)ini.GetDoubleValue("ENEMY_BASE", "SPEED_BASE", 0);
    m_settings->ENEMY_BASE_SPEED_MIN_MULTIPLIER = (float)ini.GetDoubleValue("ENEMY_BASE", "SPEED_MIN_MULTIPLIER", 0);
    m_settings->ENEMY_BASE_SPEED_MAX_MULTIPLIER = (float)ini.GetDoubleValue("ENEMY_BASE", "SPEED_MAX_MULTIPLIER", 0);

    m_settings->PARTICLES_MAX_INIT_SPEED = (float)ini.GetDoubleValue("PARTICLES", "MAX_INIT_SPEED", 0);

    m_settings->SCORE_KILL_TROLL = ini.GetLongValue("SCORE", "KILL_TROLL", 0);
    m_settings->SCORE_KILL_GOBLIN = ini.GetLongValue("SCORE", "KILL_GOBLIN", 0);
    m_settings->SCORE_KILL_SHOOTER = ini.GetLongValue("SCORE", "KILL_SHOOTER", 0);
    m_settings->SCORE_KILL_BASE = ini.GetLongValue("SCORE", "KILL_BASE", 0);
    m_settings->SCORE_TIME_LIMIT = (float)ini.GetDoubleValue("SCORE", "TIME_LIMIT", 0);

    m_settings->HIGHSCORE_NAME = ini.GetValue("HIGHSCORE", "NAME", "");
    m_settings->HIGHSCORE2_NAME = ini.GetValue("HIGHSCORE2", "NAME", "");
    m_settings->HIGHSCORE3_NAME = ini.GetValue("HIGHSCORE3", "NAME", "");
    m_settings->HIGHSCORE_SCORE = ini.GetLongValue("HIGHSCORE", "SCORE", 0);
    m_settings->HIGHSCORE2_SCORE = ini.GetLongValue("HIGHSCORE2", "SCORE", 0);
    m_settings->HIGHSCORE3_SCORE = ini.GetLongValue("HIGHSCORE3", "SCORE", 0);

    return true;
}
开发者ID:Axelrantila,项目名称:HeroFall,代码行数:87,代码来源:SettingsManager.cpp

示例6: saveSettings

bool SettingsManager::saveSettings()
{
    
    CSimpleIniA ini;
    ini.SetUnicode();
    ini.LoadFile("CONFIG.ini");

    if(ini.IsEmpty())
        {return false;}

    ini.SetValue("HIGHSCORE", "NAME", m_settings->HIGHSCORE_NAME.c_str());
    ini.SetLongValue("HIGHSCORE", "SCORE", m_settings->HIGHSCORE_SCORE);
    ini.SetValue("HIGHSCORE2", "NAME", m_settings->HIGHSCORE2_NAME.c_str());
    ini.SetLongValue("HIGHSCORE2", "SCORE", m_settings->HIGHSCORE2_SCORE);
    ini.SetValue("HIGHSCORE3", "NAME", m_settings->HIGHSCORE3_NAME.c_str());
    ini.SetLongValue("HIGHSCORE3", "SCORE", m_settings->HIGHSCORE3_SCORE);

    //Save the file
    if(ini.SaveFile("CONFIG.ini") < 0)
        {return false;}
    return true;
}
开发者ID:Axelrantila,项目名称:HeroFall,代码行数:22,代码来源:SettingsManager.cpp

示例7: warning

void ScriptSettings::Read(ScriptControls* scriptControl) {
#pragma warning(push)
#pragma warning(disable: 4244) // Make everything doubles later...
    CSimpleIniA ini;
    ini.SetUnicode();
    ini.LoadFile(SETTINGSFILE);

    ini.GetBoolValue("OPTIONS", "Enable", true);
    // [OPTIONS]
    EnableManual        = ini.GetBoolValue("OPTIONS", "Enable", true);
    ShiftMode           = ini.GetLongValue("OPTIONS", "ShiftMode", 0);
    SimpleBike          = ini.GetBoolValue("OPTIONS", "SimpleBike", false);
    EngDamage           = ini.GetBoolValue("OPTIONS", "EngineDamage", false);
    EngStall            = ini.GetBoolValue("OPTIONS", "EngineStalling", false);
    EngBrake            = ini.GetBoolValue("OPTIONS", "EngineBraking", false);
    ClutchCatching      = ini.GetBoolValue("OPTIONS", "ClutchCatching", false);
    ClutchShifting      = ini.GetBoolValue("OPTIONS", "ClutchShifting", false);
    ClutchShiftingS     = ini.GetBoolValue("OPTIONS", "ClutchShiftingS", false);
    DefaultNeutral      = ini.GetBoolValue("OPTIONS", "DefaultNeutral", true);
    
    ClutchCatchpoint    = ini.GetDoubleValue("OPTIONS", "ClutchCatchpoint", 15.0) / 100.0f;
    StallingThreshold   = ini.GetDoubleValue("OPTIONS", "StallingThreshold", 75.0) / 100.0f;
    RPMDamage           = ini.GetDoubleValue("OPTIONS", "RPMDamage", 15.0) / 100.0f;
    MisshiftDamage      = ini.GetDoubleValue("OPTIONS", "MisshiftDamage", 10.0);

    AutoLookBack        = ini.GetBoolValue("OPTIONS", "AutoLookBack", false);
    AutoGear1           = ini.GetBoolValue("OPTIONS", "AutoGear1", false);
    HillBrakeWorkaround = ini.GetBoolValue("OPTIONS", "HillBrakeWorkaround", false);
    
    UITips              = ini.GetBoolValue("OPTIONS", "UITips", true);
    UITips_OnlyNeutral  = ini.GetBoolValue("OPTIONS", "UITips_OnlyNeutral", false);
    UITips_X            = ini.GetDoubleValue("OPTIONS", "UITips_X", 95.0) / 100.0f;
    UITips_Y            = ini.GetDoubleValue("OPTIONS", "UITips_Y", 95.0) / 100.0f;
    UITips_Size         = ini.GetDoubleValue("OPTIONS", "UITips_Size", 15.0) / 100.0f;
    UITips_TopGearC_R   = ini.GetLongValue("OPTIONS", "UITips_TopGearC_R", 255);
    UITips_TopGearC_G   = ini.GetLongValue("OPTIONS", "UITips_TopGearC_G", 255);
    UITips_TopGearC_B   = ini.GetLongValue("OPTIONS", "UITips_TopGearC_B", 255);

    CrossScript         = ini.GetBoolValue("OPTIONS", "CrossScript", false);

    // [CONTROLLER]
    scriptControl->ControlXbox[static_cast<int>(ScriptControls::ControllerControlType::Toggle)]  = ini.GetValue("CONTROLLER", "Toggle", "DpadRight");
    scriptControl->ControlXbox[static_cast<int>(ScriptControls::ControllerControlType::ToggleH)] = ini.GetValue("CONTROLLER", "ToggleShift", "B");
    scriptControl->CToggleTime = ini.GetLongValue("CONTROLLER", "ToggleTime", 500);

    int tval = ini.GetLongValue("CONTROLLER", "TriggerValue", 75);
    if (tval > 100 || tval < 0) {
        tval = 75;
    }
    scriptControl->SetXboxTrigger(tval);

    scriptControl->ControlXbox[static_cast<int>(ScriptControls::ControllerControlType::ShiftUp)]   = ini.GetValue("CONTROLLER", "ShiftUp", "A");
    scriptControl->ControlXbox[static_cast<int>(ScriptControls::ControllerControlType::ShiftDown)] = ini.GetValue("CONTROLLER", "ShiftDown", "X");
    scriptControl->ControlXbox[static_cast<int>(ScriptControls::ControllerControlType::Clutch)]    = ini.GetValue("CONTROLLER", "Clutch", "LeftThumbDown");
    scriptControl->ControlXbox[static_cast<int>(ScriptControls::ControllerControlType::Engine)]    = ini.GetValue("CONTROLLER", "Engine", "DpadDown");
    scriptControl->ControlXbox[static_cast<int>(ScriptControls::ControllerControlType::Throttle)]  = ini.GetValue("CONTROLLER", "Throttle", "RightTrigger");
    scriptControl->ControlXbox[static_cast<int>(ScriptControls::ControllerControlType::Brake)]     = ini.GetValue("CONTROLLER", "Brake", "LeftTrigger");

    // [KEYBOARD]
    
    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::Toggle)]        = str2key(ini.GetValue("KEYBOARD", "Toggle", "VK_OEM_5"));
    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::ToggleH)]       = str2key(ini.GetValue("KEYBOARD", "ToggleH", "VK_OEM_6"));
    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::ShiftUp)]       = str2key(ini.GetValue("KEYBOARD", "ShiftUp", "SHIFT"));
    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::ShiftDown)]     = str2key(ini.GetValue("KEYBOARD", "ShiftDown", "CTRL"));
    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::Clutch)]        = str2key(ini.GetValue("KEYBOARD", "Clutch", "X"));
    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::Engine)]        = str2key(ini.GetValue("KEYBOARD", "Engine", "C"));

    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::Throttle)]      = str2key(ini.GetValue("KEYBOARD", "Throttle", "W"));
    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::Brake)]         = str2key(ini.GetValue("KEYBOARD", "Brake", "S"));

    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::HR)]            = str2key(ini.GetValue("KEYBOARD", "HR", "NUM0"));
    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::H1)]            = str2key(ini.GetValue("KEYBOARD", "H1", "NUM1"));
    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::H2)]            = str2key(ini.GetValue("KEYBOARD", "H2", "NUM2"));
    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::H3)]            = str2key(ini.GetValue("KEYBOARD", "H3", "NUM3"));
    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::H4)]            = str2key(ini.GetValue("KEYBOARD", "H4", "NUM4"));
    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::H5)]            = str2key(ini.GetValue("KEYBOARD", "H5", "NUM5"));
    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::H6)]            = str2key(ini.GetValue("KEYBOARD", "H6", "NUM6"));
    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::H7)]            = str2key(ini.GetValue("KEYBOARD", "H7", "NUM7"));
    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::H8)]            = str2key(ini.GetValue("KEYBOARD", "H8", "NUM8"));
    scriptControl->KBControl[static_cast<int>(ScriptControls::KeyboardControlType::HN)]            = str2key(ini.GetValue("KEYBOARD", "HN", "NUM9"));

    // [WHEELOPTIONS]
    WheelEnabled = ini.GetBoolValue("WHEELOPTIONS", "Enable", false);
    WheelWithoutManual = ini.GetBoolValue("WHEELOPTIONS", "WheelWithoutManual", true);

    FFEnable = ini.GetBoolValue("WHEELOPTIONS", "FFEnable", true);
    FFGlobalMult =	ini.GetDoubleValue("WHEELOPTIONS", "FFGlobalMult", 100.0) / 100.0f;
    DamperMax =		ini.GetLongValue("WHEELOPTIONS", "DamperMax", 50);
    DamperMin = ini.GetLongValue("WHEELOPTIONS", "DamperMin", 20);
    TargetSpeed = ini.GetLongValue("WHEELOPTIONS", "DamperTargetSpeed", 10);
    FFPhysics = ini.GetDoubleValue("WHEELOPTIONS", "PhysicsStrength", 100.0) / 100.0f;
    CenterStrength = ini.GetDoubleValue("WHEELOPTIONS", "CenterStrength", 100.0) / 100.0f;
    DetailStrength = ini.GetDoubleValue("WHEELOPTIONS", "DetailStrength", 100.0) / 1.0f;

    // [WHEELCONTROLS]
    scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::Toggle)]          =	ini.GetLongValue("WHEELCONTROLS", "Toggle", 17);
    scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::ToggleH)]         =	ini.GetLongValue("WHEELCONTROLS", "ToggleH", 6);

    scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::ShiftUp)]         =	ini.GetLongValue("WHEELCONTROLS", "ShiftUp", 4);
    scriptControl->WheelControl[static_cast<int>(ScriptControls::WheelControlType::ShiftDown)]       =	ini.GetLongValue("WHEELCONTROLS", "ShiftDown", 5);
//.........这里部分代码省略.........
开发者ID:E66666666,项目名称:GTAVManualTransmission,代码行数:101,代码来源:ScriptSettings.cpp


注:本文中的CSimpleIniA类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。