• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ THSoundEffects类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: draw

void THAnimation::draw(THRenderTarget* pCanvas, int iDestX, int iDestY)
{
    if(AreFlagsSet(m_iFlags, THDF_Alpha50 | THDF_Alpha75))
        return;

    iDestX += m_iX;
    iDestY += m_iY;
    if(m_iSoundToPlay)
    {
        THSoundEffects *pSounds = THSoundEffects::getSingleton();
        if(pSounds)
            pSounds->playSoundAt(m_iSoundToPlay, iDestX, iDestY);
        m_iSoundToPlay = 0;
    }
    if(m_pManager)
    {
        if(m_iFlags & THDF_Crop)
        {
            THClipRect rcOld, rcNew;
            pCanvas->getClipRect(&rcOld);
            rcNew.y = rcOld.y;
            rcNew.h = rcOld.h;
            rcNew.x = iDestX + (m_iCropColumn - 1) * 32;
            rcNew.w = 64;
            IntersectTHClipRect(rcNew, rcOld);
            pCanvas->setClipRect(&rcNew);
            m_pManager->drawFrame(pCanvas, m_iFrame, m_oLayers, iDestX, iDestY,
                                  m_iFlags);
            pCanvas->setClipRect(&rcOld);
        }
        else
            m_pManager->drawFrame(pCanvas, m_iFrame, m_oLayers, iDestX, iDestY,
                                  m_iFlags);
    }
}
开发者ID:sydlawrence,项目名称:CorsixTH-HTML5-Port,代码行数:35,代码来源:th_gfx.cpp


示例2: l_soundfx_play

static int l_soundfx_play(lua_State *L)
{
    THSoundEffects *pEffects = luaT_testuserdata<THSoundEffects>(L);
    lua_settop(L, 5);
    lua_getfenv(L, 1);
    lua_pushliteral(L, "archive");
    lua_rawget(L, 6);
    THSoundArchive *pArchive = (THSoundArchive*)lua_touserdata(L, 7);
    if(pArchive == NULL)
    {
        return 0;
    }
    // l_soundarc_checkidx requires the archive at the bottom of the stack
    lua_replace(L, 1);
    size_t iIndex = l_soundarc_checkidx(L, 2, pArchive);
    if(iIndex == pArchive->getSoundCount())
        return 2;
    if(lua_isnil(L, 4))
    {
        pEffects->playSound(iIndex, luaL_checknumber(L, 3));
    }
    else
    {
        pEffects->playSoundAt(iIndex, luaL_checknumber(L, 3), luaL_checkint(L, 4), luaL_checkint(L, 5));
    }
    lua_pushboolean(L, 1);
    return 1;
}
开发者ID:Skyivories,项目名称:corsix-th,代码行数:28,代码来源:th_lua_sound.cpp


示例3: drawMorph

void THAnimation::drawMorph(THRenderTarget* pCanvas, int iDestX, int iDestY)
{
    if(AreFlagsSet(m_iFlags, THDF_Alpha50 | THDF_Alpha75))
        return;

    if(!m_pManager)
        return;

    iDestX += m_iX;
    iDestY += m_iY;
    if(m_iSoundToPlay)
    {
        THSoundEffects *pSounds = THSoundEffects::getSingleton();
        if(pSounds)
            pSounds->playSoundAt(m_iSoundToPlay, iDestX, iDestY);
        m_iSoundToPlay = 0;
    }

    THClipRect oClipRect;
    pCanvas->getClipRect(&oClipRect);
    THClipRect oMorphRect;
    CalculateMorphRect(oClipRect, oMorphRect, iDestY + m_pMorphTarget->m_iX,
                       iDestY + m_pMorphTarget->m_iY + 1);
    pCanvas->setClipRect(&oMorphRect);
    m_pManager->drawFrame(pCanvas, m_iFrame, m_oLayers, iDestX, iDestY,
                          m_iFlags);
    CalculateMorphRect(oClipRect, oMorphRect, iDestY + m_pMorphTarget->m_iY,
                       iDestY + m_pMorphTarget->m_iSpeedX);
    pCanvas->setClipRect(&oMorphRect);
    m_pManager->drawFrame(pCanvas, m_pMorphTarget->m_iFrame,
                          m_pMorphTarget->m_oLayers, iDestX,
                          iDestY, m_pMorphTarget->m_iFlags);
    pCanvas->setClipRect(&oClipRect);
}
开发者ID:sydlawrence,项目名称:CorsixTH-HTML5-Port,代码行数:34,代码来源:th_gfx.cpp


示例4: getSingleton

void THSoundEffects::_onChannelFinish(int iChannel)
{
    THSoundEffects *pThis = getSingleton();
    if(pThis == NULL)
        return;

    pThis->releaseChannel(iChannel);
}
开发者ID:MarkL1961,项目名称:CorsixTH,代码行数:8,代码来源:th_sound.cpp


示例5: l_soundfx_reserve_channel

static int l_soundfx_reserve_channel(lua_State *L)
{
    int iChannel;
    THSoundEffects *pEffects = luaT_testuserdata<THSoundEffects>(L);
    iChannel = pEffects->reserveChannel();
    lua_pushinteger(L, iChannel);
    return 1;
}
开发者ID:CzBiX,项目名称:CorsixTH,代码行数:8,代码来源:th_lua_sound.cpp


示例6: l_soundfx_set_archive

static int l_soundfx_set_archive(lua_State *L)
{
    THSoundEffects *pEffects = luaT_testuserdata<THSoundEffects>(L);
    THSoundArchive *pArchive = luaT_testuserdata<THSoundArchive>(L, 2);
    pEffects->setSoundArchive(pArchive);
    lua_settop(L, 2);
    luaT_setenvfield(L, 1, "archive");
    return 1;
}
开发者ID:Skyivories,项目名称:corsix-th,代码行数:9,代码来源:th_lua_sound.cpp


示例7: l_soundfx_play

static int l_soundfx_play(lua_State *L)
{
    THSoundEffects *pEffects = luaT_testuserdata<THSoundEffects>(L);
    lua_settop(L, 7);
    lua_getfenv(L, 1);
    lua_pushliteral(L, "archive");
    lua_rawget(L,8);
    THSoundArchive *pArchive = (THSoundArchive*)lua_touserdata(L, 9);
    if(pArchive == nullptr)
    {
        return 0;
    }
    // l_soundarc_checkidx requires the archive at the bottom of the stack
    lua_replace(L, 1);
    size_t iIndex = l_soundarc_checkidx(L, 2, pArchive);
    if(iIndex == pArchive->getSoundCount())
        return 2;
    if(lua_isnil(L, 4))
    {
        pEffects->playSound(iIndex, luaL_checknumber(L, 3));
    }
    else
    {
        pEffects->playSoundAt(iIndex, luaL_checknumber(L, 3), static_cast<int>(luaL_checkinteger(L, 4)), static_cast<int>(luaL_checkinteger(L, 5)));
    }
    //SDL SOUND_OVER Callback Timer:
    //6: unusedPlayedCallbackID
    if(!lua_isnil(L, 6))
    {
        //7: Callback delay
        int iPlayedCallbackDelay = 0; //ms
        if(!lua_isnil(L, 7))
            iPlayedCallbackDelay = static_cast<int>(luaL_checknumber(L, 7));

        if(m_iPlayedSoundCallbackIDsPointer == sizeof(m_a_iPlayedSoundCallbackIDs))
            m_iPlayedSoundCallbackIDsPointer = 0;

        m_a_iPlayedSoundCallbackIDs[m_iPlayedSoundCallbackIDsPointer] = static_cast<int>(luaL_checkinteger(L, 6));
        size_t interval = pArchive->getSoundDuration(iIndex) + iPlayedCallbackDelay;
        SDL_TimerID timersID = SDL_AddTimer(static_cast<Uint32>(interval),
                                            played_sound_callback,
                                            &(m_a_iPlayedSoundCallbackIDs[m_iPlayedSoundCallbackIDsPointer]));
        m_mapSoundTimers.insert(std::pair<int, SDL_TimerID>(m_a_iPlayedSoundCallbackIDs[m_iPlayedSoundCallbackIDsPointer], timersID));
        m_iPlayedSoundCallbackIDsPointer++;
    }

    lua_pushboolean(L, 1);
    return 1;
}
开发者ID:AntoineLemaire,项目名称:CorsixTH,代码行数:49,代码来源:th_lua_sound.cpp


示例8: drawChild

void THAnimation::drawChild(THRenderTarget* pCanvas, int iDestX, int iDestY)
{
    if(AreFlagsSet(m_iFlags, THDF_Alpha50 | THDF_Alpha75))
        return;
    if(AreFlagsSet(m_pParent->m_iFlags, THDF_Alpha50 | THDF_Alpha75))
        return;
    int iX = 0, iY = 0;
    m_pParent->getMarker(&iX, &iY);
    iX += m_iX + iDestX;
    iY += m_iY + iDestY;
    if(m_iSoundToPlay)
    {
        THSoundEffects *pSounds = THSoundEffects::getSingleton();
        if(pSounds)
            pSounds->playSoundAt(m_iSoundToPlay, iX, iY);
        m_iSoundToPlay = 0;
    }
    if(m_pManager)
        m_pManager->drawFrame(pCanvas, m_iFrame, m_oLayers, iX, iY, m_iFlags);
}
开发者ID:sydlawrence,项目名称:CorsixTH-HTML5-Port,代码行数:20,代码来源:th_gfx.cpp


示例9: l_soundfx_set_camera

static int l_soundfx_set_camera(lua_State *L)
{
    THSoundEffects *pEffects = luaT_testuserdata<THSoundEffects>(L);
    pEffects->setCamera(luaL_checkint(L, 2), luaL_checkint(L, 3), luaL_checkint(L, 4));
    return 0;
}
开发者ID:Skyivories,项目名称:corsix-th,代码行数:6,代码来源:th_lua_sound.cpp


示例10: l_soundfx_set_sound_effects_on

static int l_soundfx_set_sound_effects_on(lua_State *L)
{
    THSoundEffects *pEffects = luaT_testuserdata<THSoundEffects>(L);
    pEffects->setSoundEffectsOn(lua_toboolean(L, 2) != 0);
    return 1;
}
开发者ID:Skyivories,项目名称:corsix-th,代码行数:6,代码来源:th_lua_sound.cpp


示例11: l_soundfx_set_sound_volume

static int l_soundfx_set_sound_volume(lua_State *L)
{
    THSoundEffects *pEffects = luaT_testuserdata<THSoundEffects>(L);
    pEffects->setSoundEffectsVolume(luaL_checknumber(L, 2));
    return 1;
}
开发者ID:Skyivories,项目名称:corsix-th,代码行数:6,代码来源:th_lua_sound.cpp


示例12: l_soundfx_release_channel

static int l_soundfx_release_channel(lua_State *L)
{
    THSoundEffects *pEffects = luaT_testuserdata<THSoundEffects>(L);
    pEffects->releaseChannel(luaL_checkinteger(L, 2));
    return 1;
}
开发者ID:CzBiX,项目名称:CorsixTH,代码行数:6,代码来源:th_lua_sound.cpp


示例13: l_soundfx_set_camera

static int l_soundfx_set_camera(lua_State *L)
{
    THSoundEffects *pEffects = luaT_testuserdata<THSoundEffects>(L);
    pEffects->setCamera(static_cast<int>(luaL_checkinteger(L, 2)), static_cast<int>(luaL_checkinteger(L, 3)), static_cast<int>(luaL_checkinteger(L, 4)));
    return 0;
}
开发者ID:AntoineLemaire,项目名称:CorsixTH,代码行数:6,代码来源:th_lua_sound.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ THSpriteSheet类代码示例发布时间:2022-05-31
下一篇:
C++ THRenderTarget类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap