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


C++ SDL_strcasecmp函数代码示例

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


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

示例1: GetScaleQuality

static D3DTEXTUREFILTERTYPE
GetScaleQuality(void)
{
    const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);

    if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
        return D3DTEXF_POINT;
    } else if (*hint == '1' || SDL_strcasecmp(hint, "linear") == 0) {
        return D3DTEXF_LINEAR;
    } else {
        return D3DTEXF_ANISOTROPIC;
    }
}
开发者ID:BabyFlower,项目名称:SurveillanceClientOnMobile,代码行数:13,代码来源:SDL_render_d3d.c

示例2: SDL_GameControllerAddMapping

/*
 * Add or update an entry into the Mappings Database
 */
int
SDL_GameControllerAddMapping(const char *mappingString)
{
    char *pchGUID;
    char *pchName;
    char *pchMapping;
    SDL_JoystickGUID jGUID;
    ControllerMapping_t *pControllerMapping;
    SDL_bool is_xinput_mapping = SDL_FALSE;

    pchGUID = SDL_PrivateGetControllerGUIDFromMappingString(mappingString);
    if (!pchGUID) {
        return SDL_SetError("Couldn't parse GUID from %s", mappingString);
    }
    if (!SDL_strcasecmp(pchGUID, "xinput")) {
        is_xinput_mapping = SDL_TRUE;
    }
    jGUID = SDL_JoystickGetGUIDFromString(pchGUID);
    SDL_free(pchGUID);

    pchName = SDL_PrivateGetControllerNameFromMappingString(mappingString);
    if (!pchName) {
        return SDL_SetError("Couldn't parse name from %s", mappingString);
    }

    pchMapping = SDL_PrivateGetControllerMappingFromMappingString(mappingString);
    if (!pchMapping) {
        SDL_free(pchName);
        return SDL_SetError("Couldn't parse %s", mappingString);
    }

    pControllerMapping = SDL_PrivateGetControllerMappingForGUID(&jGUID);

    if (pControllerMapping) {
        /* Update existing mapping */
        SDL_free(pControllerMapping->name);
        pControllerMapping->name = pchName;
        SDL_free(pControllerMapping->mapping);
        pControllerMapping->mapping = pchMapping;
        /* refresh open controllers */
        SDL_PrivateGameControllerRefreshMapping(pControllerMapping);
        return 0;
    } else {
        pControllerMapping = SDL_malloc(sizeof(*pControllerMapping));
        if (!pControllerMapping) {
            SDL_free(pchName);
            SDL_free(pchMapping);
            return SDL_OutOfMemory();
        }
        if (is_xinput_mapping) {
            s_pXInputMapping = pControllerMapping;
        }
        pControllerMapping->guid = jGUID;
        pControllerMapping->name = pchName;
        pControllerMapping->mapping = pchMapping;
        pControllerMapping->next = s_pSupportedControllers;
        s_pSupportedControllers = pControllerMapping;
        return 1;
    }
}
开发者ID:BraveSirAndrew,项目名称:SDL2,代码行数:63,代码来源:SDL_gamecontroller.c

示例3: SDL_PrivateGameControllerAddMapping

/*
 * Add or update an entry into the Mappings Database with a priority
 */
static int
SDL_PrivateGameControllerAddMapping(const char *mappingString, SDL_ControllerMappingPriority priority)
{
    char *pchGUID;
    SDL_JoystickGUID jGUID;
    SDL_bool is_xinput_mapping = SDL_FALSE;
    SDL_bool is_emscripten_mapping = SDL_FALSE;
    SDL_bool existing = SDL_FALSE;
    ControllerMapping_t *pControllerMapping;

    if (!mappingString) {
        return SDL_InvalidParamError("mappingString");
    }

    pchGUID = SDL_PrivateGetControllerGUIDFromMappingString(mappingString);
    if (!pchGUID) {
        return SDL_SetError("Couldn't parse GUID from %s", mappingString);
    }
    if (!SDL_strcasecmp(pchGUID, "xinput")) {
        is_xinput_mapping = SDL_TRUE;
    }
    if (!SDL_strcasecmp(pchGUID, "emscripten")) {
        is_emscripten_mapping = SDL_TRUE;
    }
    jGUID = SDL_JoystickGetGUIDFromString(pchGUID);
    SDL_free(pchGUID);

    pControllerMapping = SDL_PrivateAddMappingForGUID(jGUID, mappingString, &existing, priority);
    if (!pControllerMapping) {
        return -1;
    }

    if (existing) {
        return 0;
    } else {
        if (is_xinput_mapping) {
            s_pXInputMapping = pControllerMapping;
        }
        if (is_emscripten_mapping) {
            s_pEmscriptenMapping = pControllerMapping;
        }
        return 1;
    }
}
开发者ID:abakobo,项目名称:monkey2,代码行数:47,代码来源:SDL_gamecontroller.c

示例4: SDL_strcasecmp

bool CFileProvider::extension(const std::string &filename,
                              const std::string &extension) {
   const char *fname = filename.c_str(), *ext = extension.c_str();

   if (strlen(fname) < strlen(ext) ||
         SDL_strcasecmp(fname + strlen(fname) - strlen(ext), ext))
      return false;
   else
      return true;
}
开发者ID:leafxixi,项目名称:sdlpal,代码行数:10,代码来源:fprovide.cpp

示例5: GetScaleQuality

static GLenum
GetScaleQuality(void)
{
    const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);

    if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
        return GL_NEAREST;
    } else {
        return GL_LINEAR;
    }
}
开发者ID:1vanK,项目名称:Urho3D,代码行数:11,代码来源:SDL_render_gles.c

示例6: SDL_TouchMouseEventsChanged

static void SDLCALL
SDL_TouchMouseEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{
    SDL_Mouse *mouse = (SDL_Mouse *)userdata;

    if (hint && (*hint == '0' || SDL_strcasecmp(hint, "false") == 0)) {
        mouse->touch_mouse_events = SDL_FALSE;
    } else {
        mouse->touch_mouse_events = SDL_TRUE;
    }
}
开发者ID:spurious,项目名称:SDL-mirror,代码行数:11,代码来源:SDL_mouse.c

示例7: GetScaleQuality

static int
GetScaleQuality(void)
{
    const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);

    if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
        return 0;
    } else {
        return 1;
    }
}
开发者ID:ifzz,项目名称:exsdk,代码行数:11,代码来源:SDL_render_sw.c

示例8: SDL_GameControllerGetAxisFromString

/*
 * convert a string to its enum equivalent
 */
SDL_GameControllerAxis SDL_GameControllerGetAxisFromString(const char *pchString)
{
    int entry;
    if (!pchString || !pchString[0])
        return SDL_CONTROLLER_AXIS_INVALID;

    for (entry = 0; map_StringForControllerAxis[entry]; ++entry) {
        if (!SDL_strcasecmp(pchString, map_StringForControllerAxis[entry]))
            return entry;
    }
    return SDL_CONTROLLER_AXIS_INVALID;
}
开发者ID:chagara,项目名称:ufoai,代码行数:15,代码来源:SDL_gamecontroller.c

示例9: SDL_GameControllerGetButtonFromString

/*
 * convert a string to its enum equivalent
 */
SDL_GameControllerButton SDL_GameControllerGetButtonFromString(const char *pchString)
{
    int entry;
    if (!pchString || !pchString[0])
        return SDL_CONTROLLER_BUTTON_INVALID;

    for (entry = 0; map_StringForControllerButton[entry]; ++entry) {
        if (SDL_strcasecmp(pchString, map_StringForControllerButton[entry]) == 0)
            return entry;
    }
    return SDL_CONTROLLER_BUTTON_INVALID;
}
开发者ID:chagara,项目名称:ufoai,代码行数:15,代码来源:SDL_gamecontroller.c

示例10: SDL_GetHintBoolean

SDL_bool
SDL_GetHintBoolean(const char *name, SDL_bool default_value)
{
    const char *hint = SDL_GetHint(name);
    if (!hint) {
        return default_value;
    }
    if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) {
        return SDL_FALSE;
    }
    return SDL_TRUE;
}
开发者ID:0-wiz-0,项目名称:mame,代码行数:12,代码来源:SDL_hints.c

示例11: StrCaseCmpIgnoreHyphen

/* String compare s1 and s2 ignoring leading hyphens */
static int
StrCaseCmpIgnoreHyphen(char* s1, char* s2)
{
    /* treat NULL pointer as empty strings */
    if(!s1)
        s1 = "";
    if(!s2)
        s2 = "";

    while(*s1 == '-')
        s1++;
    while(*s2 == '-')
        s2++;

    return SDL_strcasecmp(s1, s2);
}
开发者ID:BitPuffin,项目名称:NeoEditor,代码行数:17,代码来源:harness_argparser.c

示例12: SDL_GetScancodeFromName

SDL_Scancode SDL_GetScancodeFromName(const char *name)
{
    unsigned int i;

    if (!name || !*name) {
        return SDL_SCANCODE_UNKNOWN;
    }

    for (i = 0; i < SDL_arraysize(SDL_scancode_names); ++i) {
        if (!SDL_scancode_names[i]) {
            continue;
        }
        if (SDL_strcasecmp(name, SDL_scancode_names[i]) == 0) {
            return static_cast<SDL_Scancode>(i);
        }
    }

    return SDL_SCANCODE_UNKNOWN;
}
开发者ID:Heark,项目名称:wesnoth,代码行数:19,代码来源:keyboard.cpp

示例13: SDL_MouseTouchEventsChanged

static void SDLCALL
SDL_MouseTouchEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{
    SDL_Mouse *mouse = (SDL_Mouse *)userdata;

    if (hint == NULL || *hint == '\0') {
        /* Default */
#if defined(__ANDROID__) || (defined(__IPHONEOS__) && !defined(__TVOS__))
        mouse->mouse_touch_events = SDL_TRUE;
#else
        mouse->mouse_touch_events = SDL_FALSE;
#endif
    } else if (*hint == '1' || SDL_strcasecmp(hint, "true") == 0) {
        mouse->mouse_touch_events = SDL_TRUE;
    } else {
        mouse->mouse_touch_events = SDL_FALSE;
    }

    if (mouse->mouse_touch_events) {
        SDL_AddTouch(SDL_MOUSE_TOUCHID, SDL_TOUCH_DEVICE_DIRECT, "mouse_input");
    }
}
开发者ID:spurious,项目名称:SDL-mirror,代码行数:22,代码来源:SDL_mouse.c

示例14: CommonArg

int
CommonArg(CommonState * state, int index)
{
    char **argv = state->argv;

    if (SDL_strcasecmp(argv[index], "--video") == 0) {
        ++index;
        if (!argv[index]) {
            return -1;
        }
        state->videodriver = argv[index];
        return 2;
    }
    if (SDL_strcasecmp(argv[index], "--renderer") == 0) {
        ++index;
        if (!argv[index]) {
            return -1;
        }
        state->renderdriver = argv[index];
        return 2;
    }
    if (SDL_strcasecmp(argv[index], "--info") == 0) {
        ++index;
        if (!argv[index]) {
            return -1;
        }
        if (SDL_strcasecmp(argv[index], "all") == 0) {
            state->verbose |=
                (VERBOSE_VIDEO | VERBOSE_MODES | VERBOSE_RENDER |
                 VERBOSE_EVENT);
            return 2;
        }
        if (SDL_strcasecmp(argv[index], "video") == 0) {
            state->verbose |= VERBOSE_VIDEO;
            return 2;
        }
        if (SDL_strcasecmp(argv[index], "modes") == 0) {
            state->verbose |= VERBOSE_MODES;
            return 2;
        }
        if (SDL_strcasecmp(argv[index], "render") == 0) {
            state->verbose |= VERBOSE_RENDER;
            return 2;
        }
        if (SDL_strcasecmp(argv[index], "event") == 0) {
            state->verbose |= VERBOSE_EVENT;
            return 2;
        }
        return -1;
    }
    if (SDL_strcasecmp(argv[index], "--display") == 0) {
        ++index;
        if (!argv[index]) {
            return -1;
        }
        state->display = SDL_atoi(argv[index]);
        return 2;
    }
    if (SDL_strcasecmp(argv[index], "--fullscreen") == 0) {
        state->window_flags |= SDL_WINDOW_FULLSCREEN;
        state->num_windows = 1;
        return 1;
    }
    if (SDL_strcasecmp(argv[index], "--windows") == 0) {
        ++index;
        if (!argv[index] || !SDL_isdigit(*argv[index])) {
            return -1;
        }
        if (!(state->window_flags & SDL_WINDOW_FULLSCREEN)) {
            state->num_windows = SDL_atoi(argv[index]);
        }
        return 2;
    }
    if (SDL_strcasecmp(argv[index], "--title") == 0) {
        ++index;
        if (!argv[index]) {
            return -1;
        }
        state->window_title = argv[index];
        return 2;
    }
    if (SDL_strcasecmp(argv[index], "--center") == 0) {
        state->window_x = SDL_WINDOWPOS_CENTERED;
        state->window_y = SDL_WINDOWPOS_CENTERED;
        return 1;
    }
    if (SDL_strcasecmp(argv[index], "--position") == 0) {
        char *x, *y;
        ++index;
        if (!argv[index]) {
            return -1;
        }
        x = argv[index];
        y = argv[index];
        while (*y && *y != ',') {
            ++y;
        }
        if (!*y) {
            return -1;
        }
//.........这里部分代码省略.........
开发者ID:Cpasjuste,项目名称:SDL-13,代码行数:101,代码来源:common.c

示例15: ParseArg

/* parser an argument, updates the state object and returns the number of
   arguments processed; returns -1 on failure */
static int
ParseArg(char** argv, int index, SDLVisualTest_HarnessState* state)
{
    if(!argv || !argv[index] || !state)
        return 0;

    if(StrCaseCmpIgnoreHyphen("sutapp", argv[index]) == 0)
    {
        index++;
        if(!argv[index])
        {
            SDLTest_LogError("Arguments parsing error: Invalid argument for sutapp.");
            return -1;
        }
        SDL_strlcpy(state->sutapp, argv[index], MAX_PATH_LEN);
        SDLTest_Log("SUT Application: %s", state->sutapp);
        return 2;
    }
    else if(StrCaseCmpIgnoreHyphen("output-dir", argv[index]) == 0)
    {
        index++;
        if(!argv[index])
        {
            SDLTest_LogError("Arguments parsing error: Invalid argument for output-dir.");
            return -1;
        }
        SDL_strlcpy(state->output_dir, argv[index], MAX_PATH_LEN);
        SDLTest_Log("Screenshot Output Directory: %s", state->output_dir);
        return 2;
    }
    else if(StrCaseCmpIgnoreHyphen("verify-dir", argv[index]) == 0)
    {
        index++;
        if(!argv[index])
        {
            SDLTest_LogError("Arguments parsing error: Invalid argument for verify-dir.");
            return -1;
        }
        SDL_strlcpy(state->verify_dir, argv[index], MAX_PATH_LEN);
        SDLTest_Log("Screenshot Verification Directory: %s", state->verify_dir);
        return 2;
    }
    else if(StrCaseCmpIgnoreHyphen("sutargs", argv[index]) == 0)
    {
        index++;
        if(!argv[index])
        {
            SDLTest_LogError("Arguments parsing error: Invalid argument for sutargs.");
            return -1;
        }
        SDL_strlcpy(state->sutargs, argv[index], MAX_SUT_ARGS_LEN);
        SDLTest_Log("SUT Arguments: %s", state->sutargs);
        return 2;
    }
    else if(StrCaseCmpIgnoreHyphen("timeout", argv[index]) == 0)
    {
        int hr, min, sec;
        index++;
        if(!argv[index] || SDL_sscanf(argv[index], "%d:%d:%d", &hr, &min, &sec) != 3)
        {
            SDLTest_LogError("Arguments parsing error: Invalid argument for timeout.");
            return -1;
        }
        state->timeout = (((hr * 60) + min) * 60 + sec) * 1000;
        SDLTest_Log("Maximum Timeout for each SUT run: %d milliseconds",
                    state->timeout);
        return 2;
    }
    else if(StrCaseCmpIgnoreHyphen("parameter-config", argv[index]) == 0)
    {
        index++;
        if(!argv[index])
        {
            SDLTest_LogError("Arguments parsing error: Invalid argument for parameter-config.");
            return -1;
        }
        SDLTest_Log("SUT Parameters file: %s", argv[index]);
        SDLVisualTest_FreeSUTConfig(&state->sut_config);
        if(!SDLVisualTest_ParseSUTConfig(argv[index], &state->sut_config))
        {
            SDLTest_LogError("Failed to parse SUT parameters file");
            return -1;
        }
        return 2;
    }
    else if(StrCaseCmpIgnoreHyphen("variator", argv[index]) == 0)
    {
        index++;
        if(!argv[index])
        {
            SDLTest_LogError("Arguments parsing error: Invalid argument for variator.");
            return -1;
        }
        SDLTest_Log("Variator: %s", argv[index]);
        if(SDL_strcasecmp("exhaustive", argv[index]) == 0)
            state->variator_type = SDL_VARIATOR_EXHAUSTIVE;
        else if(SDL_strcasecmp("random", argv[index]) == 0)
            state->variator_type = SDL_VARIATOR_RANDOM;
//.........这里部分代码省略.........
开发者ID:BitPuffin,项目名称:NeoEditor,代码行数:101,代码来源:harness_argparser.c


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