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


C++ THRenderTarget::create方法代码示例

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


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

示例1: l_surface_new

static int l_surface_new(lua_State *L)
{
    lua_remove(L, 1); // Value inserted by __call

    THRenderTargetCreationParams oParams = l_surface_creation_params(L, 1);
    THRenderTarget* pCanvas = luaT_stdnew<THRenderTarget>(L);
    if(pCanvas->create(&oParams))
        return 1;

    lua_pushnil(L);
    lua_pushstring(L, pCanvas->getLastError());
    return 2;
}
开发者ID:mounirlamouri,项目名称:CorsixTH,代码行数:13,代码来源:th_lua_gfx.cpp

示例2: l_surface_new

static int l_surface_new(lua_State *L)
{
    lua_remove(L, 1); // Value inserted by __call

    THRenderTargetCreationParams oParams;
    oParams.iWidth = luaL_checkint(L, 1);
    oParams.iHeight = luaL_checkint(L, 2);
    int iArg = 3;
    if(lua_type(L, iArg) == LUA_TNUMBER)
        oParams.iBPP = luaL_checkint(L, iArg++);
    else
        oParams.iBPP = 0;
    oParams.iSDLFlags = 0;
    oParams.bHardware = false;
    oParams.bDoubleBuffered = false;
    oParams.bFullscreen = false;
    oParams.bPresentImmediate = false;
    oParams.bReuseContext = false;
    oParams.bOpenGL = false;

#define FLAG(name, field, flag) \
    else if(stricmp(sOption, name) == 0) \
        oParams.field = true, oParams.iSDLFlags |= flag

    for(int iArgCount = lua_gettop(L); iArg <= iArgCount; ++iArg)
    {
        const char* sOption = luaL_checkstring(L, iArg);
        if(sOption[0] == 0)
            continue;
        FLAG("hardware"         , bHardware        , SDL_HWSURFACE );
        FLAG("doublebuf"        , bDoubleBuffered  , SDL_DOUBLEBUF );
        FLAG("fullscreen"       , bFullscreen      , SDL_FULLSCREEN);
        FLAG("present immediate", bPresentImmediate, 0             );
        FLAG("reuse context"    , bReuseContext    , 0             );
        FLAG("opengl"           , bOpenGL          , SDL_OPENGL    );
    }

#undef FLAG

#ifndef CORSIX_TH_USE_DX9_RENDERER
    if(SDL_WasInit(SDL_INIT_VIDEO))
    {
        char *sTitle, *sIcon;
        char *sTitle2 = NULL, *sIcon2 = NULL;
        size_t iLen;
        SDL_WM_GetCaption(&sTitle, &sIcon);
        if(sTitle)
        {
            iLen = strlen(sTitle) + 1;
            sTitle2 = (char*)malloc(iLen);
            memcpy(sTitle2, sTitle, iLen);
        }

        if(sIcon)
        {
            iLen = strlen(sIcon) + 1;
            sIcon2 = (char*)malloc(iLen);
            memcpy(sIcon2, sIcon, iLen);
        }

        SDL_QuitSubSystem(SDL_INIT_VIDEO);
        SDL_InitSubSystem(SDL_INIT_VIDEO);
        SDL_WM_SetCaption(sTitle2, sIcon2);

        free(sTitle2);
        free(sIcon2);
    }
#endif

    THRenderTarget* pCanvas = luaT_stdnew<THRenderTarget>(L);
    if(pCanvas->create(&oParams))
        return 1;

    lua_pushnil(L);
    lua_pushstring(L, pCanvas->getLastError());
    return 2;
}
开发者ID:koanxd,项目名称:CorsixTH,代码行数:77,代码来源:th_lua_gfx.cpp


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