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


C++ THSpriteSheet类代码示例

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


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

示例1: l_spritesheet_count

static int l_spritesheet_count(lua_State *L)
{
    THSpriteSheet* pSheet = luaT_testuserdata<THSpriteSheet>(L);

    lua_pushinteger(L, pSheet->getSpriteCount());
    return 1;
}
开发者ID:mounirlamouri,项目名称:CorsixTH,代码行数:7,代码来源:th_lua_gfx.cpp

示例2: l_spritesheet_isvisible

static int l_spritesheet_isvisible(lua_State *L)
{
    THSpriteSheet* pSheet = luaT_testuserdata<THSpriteSheet>(L);
    size_t iSprite = luaL_checkinteger(L, 2);
    THColour oDummy;
    lua_pushboolean(L, pSheet->getSpriteAverageColour(iSprite, &oDummy) ? 1:0);
    return 1;
}
开发者ID:mounirlamouri,项目名称:CorsixTH,代码行数:8,代码来源:th_lua_gfx.cpp

示例3: l_spritesheet_hittest

static int l_spritesheet_hittest(lua_State *L)
{
    THSpriteSheet* pSheet = luaT_testuserdata<THSpriteSheet>(L);
    size_t iSprite = luaL_checkinteger(L, 2);
    int iX = static_cast<int>(luaL_checkinteger(L, 3));
    int iY = static_cast<int>(luaL_checkinteger(L, 4));
    uint32_t iFlags = static_cast<uint32_t>(luaL_optinteger(L, 5, 0));
    return pSheet->hitTestSprite(iSprite, iX, iY, iFlags);
}
开发者ID:mounirlamouri,项目名称:CorsixTH,代码行数:9,代码来源:th_lua_gfx.cpp

示例4: l_spritesheet_hittest

static int l_spritesheet_hittest(lua_State *L)
{
    THSpriteSheet* pSheet = luaT_testuserdata<THSpriteSheet>(L);
    unsigned int iSprite = (unsigned int)luaL_checkinteger(L, 2);
    int iX = luaL_checkint(L, 3);
    int iY = luaL_checkint(L, 4);
    unsigned long iFlags = (unsigned long)luaL_optint(L, 5, 0);
    return pSheet->hitTestSprite(iSprite, iX, iY, iFlags);
}
开发者ID:koanxd,项目名称:CorsixTH,代码行数:9,代码来源:th_lua_gfx.cpp

示例5: l_spritesheet_set_pal

static int l_spritesheet_set_pal(lua_State *L)
{
    THSpriteSheet* pSheet = luaT_testuserdata<THSpriteSheet>(L);
    THPalette* pPalette = luaT_testuserdata<THPalette>(L, 2);
    lua_settop(L, 2);

    pSheet->setPalette(pPalette);
    luaT_setenvfield(L, 1, "palette");
    return 1;
}
开发者ID:mounirlamouri,项目名称:CorsixTH,代码行数:10,代码来源:th_lua_gfx.cpp

示例6: l_spritesheet_draw

static int l_spritesheet_draw(lua_State *L)
{
    THSpriteSheet* pSheet = luaT_testuserdata<THSpriteSheet>(L);
    THRenderTarget* pCanvas = luaT_testuserdata<THRenderTarget>(L, 2);
    int iSprite = static_cast<int>(luaL_checkinteger(L, 3)); // No array adjustment

    pSheet->drawSprite(pCanvas, iSprite, static_cast<int>(luaL_optinteger(L, 4, 0)), static_cast<int>(luaL_optinteger(L, 5, 0)), static_cast<int>(luaL_optinteger(L, 6, 0)));

    lua_settop(L, 1);
    return 1;
}
开发者ID:mounirlamouri,项目名称:CorsixTH,代码行数:11,代码来源:th_lua_gfx.cpp

示例7: l_spritesheet_size

static int l_spritesheet_size(lua_State *L)
{
    THSpriteSheet* pSheet = luaT_testuserdata<THSpriteSheet>(L);
    size_t iSprite = luaL_checkinteger(L, 2); // No array adjustment
    if(iSprite < 0 || iSprite >= pSheet->getSpriteCount())
        return luaL_argerror(L, 2, "Sprite index out of bounds");

    unsigned int iWidth, iHeight;
    pSheet->getSpriteSizeUnchecked(iSprite, &iWidth, &iHeight);

    lua_pushinteger(L, iWidth);
    lua_pushinteger(L, iHeight);
    return 2;
}
开发者ID:mounirlamouri,项目名称:CorsixTH,代码行数:14,代码来源:th_lua_gfx.cpp

示例8: l_spritesheet_load

static int l_spritesheet_load(lua_State *L)
{
    THSpriteSheet* pSheet = luaT_testuserdata<THSpriteSheet>(L);
    size_t iDataLenTable, iDataLenChunk;
    const uint8_t* pDataTable = luaT_checkfile(L, 2, &iDataLenTable);
    const uint8_t* pDataChunk = luaT_checkfile(L, 3, &iDataLenChunk);
    bool bComplex = lua_toboolean(L, 4) != 0;
    THRenderTarget* pSurface = luaT_testuserdata<THRenderTarget>(L, 5, luaT_upvalueindex(1), false);

    if(pSheet->loadFromTHFile(pDataTable, iDataLenTable, pDataChunk, iDataLenChunk, bComplex, pSurface))
        lua_pushboolean(L, 1);
    else
        lua_pushboolean(L, 0);

    return 1;
}
开发者ID:mounirlamouri,项目名称:CorsixTH,代码行数:16,代码来源:th_lua_gfx.cpp


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