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


C++ SpriteCache::SetMaxCacheSize方法代码示例

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


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

示例1: apply_config

void apply_config(const ConfigTree &cfg)
{
    {
#ifndef WINDOWS_VERSION
        usetup.digicard=INIreadint(cfg, "sound","digiid", DIGI_AUTODETECT);
        usetup.midicard=INIreadint(cfg, "sound","midiid", MIDI_AUTODETECT);
#else
        int idx = INIreadint(cfg, "sound","digiwinindx", -1);
        if (idx == 0)
            idx = DIGI_DIRECTAMX(0);
        else if (idx == 1)
            idx = DIGI_WAVOUTID(0);
        else if (idx == 2)
            idx = DIGI_NONE;
        else if (idx == 3) 
            idx = DIGI_DIRECTX(0);
        else 
            idx = DIGI_AUTODETECT;
        usetup.digicard = idx;

        idx = INIreadint(cfg, "sound","midiwinindx", -1);
        if (idx == 1)
            idx = MIDI_NONE;
        else if (idx == 2)
            idx = MIDI_WIN32MAPPER;
        else
            idx = MIDI_AUTODETECT;
        usetup.midicard = idx;
#endif
        psp_audio_multithreaded = INIreadint(cfg, "sound", "threaded", psp_audio_multithreaded);

        // Filter can also be set by command line
        // TODO: apply command line arguments to ConfigTree instead to override options read from config file
        const bool should_read_filter = usetup.Screen.Filter.ID.IsEmpty();
        // Legacy graphics settings has to be translated into new options;
        // they must be read first, to let newer options override them, if ones are present
        read_legacy_graphics_config(cfg, should_read_filter);

        // Graphics mode
        usetup.Screen.DriverID = INIreadstring(cfg, "graphics", "driver");

        usetup.Screen.DisplayMode.Windowed = INIreadint(cfg, "graphics", "windowed") > 0;
        const char *screen_sz_def_options[kNumScreenDef] = { "explicit", "scaling", "max" };
        usetup.Screen.DisplayMode.ScreenSize.SizeDef = usetup.Screen.DisplayMode.Windowed ? kScreenDef_ByGameScaling : kScreenDef_MaxDisplay;
        String screen_sz_def_str = INIreadstring(cfg, "graphics", "screen_def");
        for (int i = 0; i < kNumScreenDef; ++i)
        {
            if (screen_sz_def_str.CompareNoCase(screen_sz_def_options[i]) == 0)
            {
                usetup.Screen.DisplayMode.ScreenSize.SizeDef = (ScreenSizeDefinition)i;
                break;
            }
        }

        usetup.Screen.DisplayMode.ScreenSize.Size = Size(INIreadint(cfg, "graphics", "screen_width"),
                                                        INIreadint(cfg, "graphics", "screen_height"));
        usetup.Screen.DisplayMode.ScreenSize.MatchDeviceRatio = INIreadint(cfg, "graphics", "match_device_ratio", 1) != 0;
        // TODO: move to config overrides (replace values during config load)
#if defined(MAC_VERSION)
        usetup.Screen.Filter.ID = "none";
#else
        if (should_read_filter)
            usetup.Screen.Filter.ID = INIreadstring(cfg, "graphics", "filter", "StdScale");
        parse_scaling_option(INIreadstring(cfg, "graphics", "game_scale_fs", "proportional"), usetup.Screen.FsGameFrame);
        if (should_read_filter)
            parse_scaling_option(INIreadstring(cfg, "graphics", "game_scale_win", "max_round"), usetup.Screen.WinGameFrame);
#endif

        usetup.Screen.DisplayMode.RefreshRate = INIreadint(cfg, "graphics", "refresh");
        usetup.Screen.DisplayMode.VSync = INIreadint(cfg, "graphics", "vsync") > 0;
        usetup.RenderAtScreenRes = INIreadint(cfg, "graphics", "render_at_screenres") > 0;
        usetup.Supersampling = INIreadint(cfg, "graphics", "supersampling", 1);

        usetup.enable_antialiasing = INIreadint(cfg, "misc", "antialias") > 0;

        // This option is backwards (usevox is 0 if no_speech_pack)
        usetup.no_speech_pack = INIreadint(cfg, "sound", "usespeech", 1) == 0;

        usetup.user_data_dir = INIreadstring(cfg, "misc", "user_data_dir");
        usetup.shared_data_dir = INIreadstring(cfg, "misc", "shared_data_dir");

        usetup.translation = INIreadstring(cfg, "language", "translation");

        // TODO: move to config overrides (replace values during config load)
        // PSP: Don't let the setup determine the cache size as it is always too big.
#if !defined(PSP_VERSION)
        // the config file specifies cache size in KB, here we convert it to bytes
        spriteset.SetMaxCacheSize(INIreadint (cfg, "misc", "cachemax", DEFAULTCACHESIZE / 1024) * 1024);
#endif

        usetup.mouse_auto_lock = INIreadint(cfg, "mouse", "auto_lock") > 0;

        usetup.mouse_speed = INIreadfloat(cfg, "mouse", "speed", 1.f);
        if (usetup.mouse_speed <= 0.f)
            usetup.mouse_speed = 1.f;
        const char *mouse_ctrl_options[kNumMouseCtrlOptions] = { "never", "fullscreen", "always" };
        String mouse_str = INIreadstring(cfg, "mouse", "control", "fullscreen");
        for (int i = 0; i < kNumMouseCtrlOptions; ++i)
        {
            if (mouse_str.CompareNoCase(mouse_ctrl_options[i]) == 0)
//.........这里部分代码省略.........
开发者ID:adventuregamestudio,项目名称:ags,代码行数:101,代码来源:config.cpp


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