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

C++ NGL_ASSERT函数代码示例

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

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



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

示例1: mName

nuiUniformDesc::nuiUniformDesc(const nglString& rName, GLenum Type, int count, GLuint Location, nuiShaderProgram* pProgram)
: mName(rName), mType(Type), mCount(count), mLocation(Location), mChanged(false)
{
  switch (mType)
  {
    case GL_FLOAT:              mValues.mpFloats  = new float[1 * count];  break;
    case GL_FLOAT_VEC2:         mValues.mpFloats  = new float[2 * count];  break;
    case GL_FLOAT_VEC3:         mValues.mpFloats  = new float[3 * count];  break;
    case GL_FLOAT_VEC4:         mValues.mpFloats  = new float[4 * count];  break;

    case GL_INT:                mValues.mpInts    = new int32[1 * count];  break;
    case GL_INT_VEC2:           mValues.mpInts    = new int32[2 * count];  break;
    case GL_INT_VEC3:           mValues.mpInts    = new int32[3 * count];  break;
    case GL_INT_VEC4:           mValues.mpInts    = new int32[4 * count];  break;
    case GL_UNSIGNED_INT:       mValues.mpInts    = new int32[1 * count];  break;

    case GL_FLOAT_MAT2:         mValues.mpFloats  = new float[2 * 2 * count];  break;
    case GL_FLOAT_MAT3:         mValues.mpFloats  = new float[3 * 3 * count];  break;
    case GL_FLOAT_MAT4:         mValues.mpFloats  = new float[4 * 4 * count];  break;

    case GL_SAMPLER_2D:         mValues.mpInts    = new int32[1 * count];  break;
    case GL_SAMPLER_CUBE:       mValues.mpInts    = new int32[1 * count];  break;

    default:
      NGL_ASSERT(0);
  }

  if (pProgram)
  {
    switch (mType)
    {
      case GL_FLOAT:
      case GL_FLOAT_VEC2:
      case GL_FLOAT_VEC3:
      case GL_FLOAT_VEC4:
      case GL_FLOAT_MAT2:
      case GL_FLOAT_MAT3:
      case GL_FLOAT_MAT4:
        glGetUniformfv(pProgram->GetProgram(), mLocation, mValues.mpFloats);
        break;

      case GL_INT:
      case GL_INT_VEC2:
      case GL_INT_VEC3:
      case GL_INT_VEC4:
      case GL_UNSIGNED_INT:
      case GL_SAMPLER_2D:
      case GL_SAMPLER_CUBE:
        glGetUniformiv(pProgram->GetProgram(), mLocation, mValues.mpInts);
        break;

      default:
        NGL_ASSERT(0);
    }
  }
}
开发者ID:hamedmohammadi,项目名称:nui3,代码行数:56,代码来源:nuiUniformDesc.cpp


示例2: NGL_ASSERT

void nuiComboBox::ReparentTree(nuiTreeNode* pTree)
{
  NGL_ASSERT(pTree);
  nuiWidgetPtr pWidget = pTree->GetElement();
  NGL_ASSERT(pWidget);

  pWidget->SetLayout(nuiRect(0.f,0.f, GetRect().GetWidth()-mHandleWidth, GetRect().GetHeight()));

  if (pWidget->GetParent() != this)
  {
    AddChild(pWidget);
    pWidget->InvalidateLayout();
  }

  if (GetSelectedWidget() == pWidget)
  {
    if (!pWidget->IsVisible())
      pWidget->SetVisible(true);
  }
  else 
  {
    if (pWidget->IsVisible())
      pWidget->SetVisible(false);
  }

  uint32 count = pTree->GetChildrenCount();
  for (uint32 i = 0; i < count; i++)
  {
    nuiTreeNode* pNode = dynamic_cast<nuiTreeNode*>(pTree->GetChild(i));
    NGL_ASSERT(pNode);
    ReparentTree(pNode);
  }
}
开发者ID:YetToCome,项目名称:nui3,代码行数:33,代码来源:nuiComboBox.cpp


示例3: while

void nuiSpriteDef::Uninit()
{
  std::map<nglString, nuiSpriteDef*>::iterator it = mSpriteMap.begin();
  std::map<nglString, nuiSpriteDef*>::iterator end = mSpriteMap.end();

  std::vector<nuiSpriteDef*> temp;
  
  while (it != end)
  {
    nuiSpriteDef* pDef = it->second;
    pDef->CheckValid();
    //pDef->Release();
    temp.push_back(pDef);
    ++it;
  }
  
  for (int32 i = 0; i < temp.size(); i++)
  {
    nuiSpriteDef* pDef = temp[i];
    pDef->Release();
  }

  NGL_ASSERT(mSpriteMap.empty());
  NGL_ASSERT(!nuiSprite::mSpriteCounter);

}
开发者ID:jbl2024,项目名称:nui3,代码行数:26,代码来源:nuiSpriteView.cpp


示例4: NGL_ASSERT

//**************************************************************************************************************
//
// nuiComboBox
//
void nuiDefaultDecoration::ComboBox(nuiWidget* pWidget)
{
 
  nuiStateDecoration* pDeco = (nuiStateDecoration*)nuiDecoration::Get(_T("nuiDefaultDecorationComboBox"));
  if (pDeco)
  {
    pWidget->SetDecoration(pDeco, eDecorationBorder);
    return;
  }
  
  nuiTexture* pTex = nuiTexture::GetTexture("ComboUp");
  NGL_ASSERT(pTex);
  nuiFrame* pFrame = new nuiFrame(_T("nuiDefaultDecorationComboBoxUp"), pTex, nuiRect(12,4,2,10));
  pFrame->EnableBorder(false);
      
  pTex = nuiTexture::GetTexture("ComboDown");
  NGL_ASSERT(pTex);
  pFrame = new nuiFrame(_T("nuiDefaultDecorationComboBoxDown"), pTex, nuiRect(12,4,2,10));
  pFrame->EnableBorder(false);
    
  
  
  nuiStateDecoration* pState = new nuiStateDecoration(_T("nuiDefaultDecorationComboBox"));
  pState->SetState(nuiStateEnabled  | nuiStateReleased, nuiDecoration::Get(_T("nuiDefaultDecorationComboBoxUp")));
  pState->SetState(nuiStateEnabled  | nuiStateSelected, nuiDecoration::Get(_T("nuiDefaultDecorationComboBoxDown")));
  pWidget->SetDecoration(pState, eDecorationBorder);
  pWidget->SetUserHeight(18);
  
  pWidget->SetColor(eSelectedTextFg, nuiColor(32,32,32));
  
}
开发者ID:hamedmohammadi,项目名称:nui3,代码行数:35,代码来源:nuiDefaultDecoration.cpp


示例5: attr

void nuiLayout::SetProperty(const nglString& rName, const nglString& rValue)
{
  nuiAttribBase attr(GetAttribute(rName));
  if (attr.IsValid())
  {
    attr.FromString(rValue);
    return;
  }

  if (rName.CompareLeft("VAnchors_", true) == 0 || rName.CompareLeft("HAnchors_", true) == 0)
  {
    // Create an attribute for this anchor, unless it exists already
    AddAttribute(new LayoutAnchorValue(rName, this));
    {
      nuiAttribBase attr(GetAttribute(rName));
      NGL_ASSERT(attr.IsValid());
      attr.FromString(rValue);
    }
  }
  else if (rName.CompareLeft("VAnchorsType_", true) == 0 || rName.CompareLeft("HAnchorsType_", true) == 0)
  {
    // Create an attribute for this anchor, unless it exists already
    AddAttribute(new nuiAttribute<nuiAnchorType>(rName, this));
    {
      nuiAttribBase attr(GetAttribute(rName));
      NGL_ASSERT(attr.IsValid());
      attr.FromString(rValue);
    }
  }
  else
  {
    nuiObject::SetProperty(rName, rValue);
  }

}
开发者ID:JamesLinus,项目名称:nui3,代码行数:35,代码来源:nuiLayout.cpp


示例6: NGL_ASSERT

double nuiRange::GetUnitValue() const
{
  NGL_ASSERT(IsValid());
  const double v = ConvertToUnit(GetValue());
  NGL_ASSERT(finite(v));
  return v;
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:7,代码来源:nuiRange.cpp


示例7: switch

void nuiDrawContext::DrawArray(nuiRenderArray* pArray)
{
  uint32 size = pArray->GetSize();
  if (!size)
  {
    pArray->Release();
    return;
  }

#ifdef _DEBUG_
  {
    // Error checking:
    if (!pArray->GetIndexArrayCount())
    {
      switch (pArray->GetMode())
      {
        case GL_POINTS:
          NGL_ASSERT(size);
          break;
        case GL_LINES:
          NGL_ASSERT(!(size & 1));
          break;
        case GL_LINE_LOOP:
          NGL_ASSERT(size > 1);
          break;
        case GL_LINE_STRIP:
          NGL_ASSERT(size > 1);
          break;
        case GL_TRIANGLES:
          NGL_ASSERT(size > 2 && !(size % 3));
          break;
        case GL_TRIANGLE_STRIP:
          NGL_ASSERT(size > 2);
          break;
        case GL_TRIANGLE_FAN:
          NGL_ASSERT(size > 2);
          break;
#ifndef _OPENGL_ES_
        case GL_QUADS:
          NGL_ASSERT(size > 3 && !(size % 4));
          break;
        case GL_QUAD_STRIP:
          NGL_ASSERT(size > 3);
          break;
        case GL_POLYGON:
          NGL_ASSERT(size > 3);
          break;
#endif
      }
    }
  }
#endif

  if (mStateChanges)
    mpPainter->SetState(mCurrentState);
  mStateChanges = 0;

  mpPainter->DrawArray(pArray);
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:59,代码来源:nuiDrawContext.cpp


示例8: NGL_ASSERT

bool PreferencesBase::GetBool(const nglString& rKey, const nglString& rName, PreferencesTarget target) const
{
  nuiXMLNode* pNode = mXml[target]->GetChild(rKey);
  
  NGL_ASSERT(pNode);
  NGL_ASSERT(pNode->HasAttribute(rName));
  
  return pNode->GetAttribute(rName).Compare(_T("false"));
}
开发者ID:YetToCome,项目名称:nui3,代码行数:9,代码来源:PreferencesBase.cpp


示例9: NGL_LOG

void nuiAudioDevice_DS_ProcessingTh::Process(uint pos)
{
  NGL_LOG(_T("nuiAudioDevice_DS_ProcessingTh"), NGL_LOG_DEBUG, _T("Process Thread received Event %d\n"), pos);

  int16* pBuf1=NULL;
  int16* pBuf2=NULL;
  DWORD size1=0;
  DWORD size2=0;
  DWORD bufferBytes = mBufferSize * mInputNbChannels * sizeof(int16);

  if (!mpRingBuffer->GetWritable())
    return;

  //
  // lock the input buffer if any,
  // and read data from it to the local buffer
  //
  if (  mpDSInputBuffer 
    && mpDSInputBuffer->Lock(pos * bufferBytes /* offset */, bufferBytes /*size*/, (LPVOID*)&pBuf1, &size1, (LPVOID*)&pBuf2, &size2, 0)
    )
  {
    if (!pBuf1 || !size1)
    {
      //NGL_LOG(_T("nuiAudioDevice_DS_ProcessingTh"), NGL_LOG_ERROR, _T("Process error : could not lock any part of the input buffer\n"));
      NGL_ASSERT(0);
      return;
    }

    // check that we got the right size
    NGL_ASSERT((size1+size2) == bufferBytes);


    // copy input data into local buffer
    memcpy(mpLocalBuf, pBuf1, size1);
    if (pBuf2)
      memcpy(mpLocalBuf+size1, pBuf2, size2);

    // convert int16 buffer to float buffer
    for (uint32 ch=0; ch < mInputNbChannels; ch++)
    {
      nuiAudioConvert_INint16ToDEfloat(mpLocalBuf, const_cast<float*>(mFloatInputBuf[ch]), ch, mInputNbChannels, mBufferSize); 
    }
  }


  // call user audio process function
  mpProcessFunction(mFloatInputBuf, mFloatOutputBuf, mBufferSize);

  // copy output buffer contents to ringbuffer
  uint32 nbWrite = WriteToRingBuf(mFloatOutputBuf, mBufferSize, mOutputNbChannels);

  // release DS input buffer
  if (mpDSInputBuffer)
    mpDSInputBuffer->Unlock(pBuf1, size1, pBuf2, size2);
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:55,代码来源:nuiAudioDevice_DirectSound.cpp


示例10: _T

void nuiDefaultDecoration::TabView_Contents(nuiTabView* pView, nuiWidget* pContents)
{
  nglString decoName = _T("nuiDefaultDecorationTabTopContents");
  
  nuiRect frameRect;
  
  const char* deco = "TabTopContents";
  
  switch (pView->GetTabPosition())
  {
    case nuiTop:
      decoName = _T("nuiDefaultDecorationTabTopContents");
      deco = "TabTopContents";
      frameRect = nuiRect(4,5,2,4);
      break;
      
    case nuiLeft:
      decoName = _T("nuiDefaultDecorationTabLeftContents");
      deco = "TabLeftContents";
      frameRect = nuiRect(5,4,4,2);
      break;
      
    case nuiRight:
      decoName = _T("nuiDefaultDecorationTabRightContents");
      deco = "TabRightContents";
      frameRect = nuiRect(5,4,4,2);
      break;
      
    case nuiBottom:
      decoName = _T("nuiDefaultDecorationTabBottomContents");
      deco = "TabBottomContents";
      frameRect = nuiRect(4,5,2,4);
      break;

    default:
      NGL_ASSERT(0);
      break;
  }
  
  nuiFrame* pDeco = (nuiFrame*)nuiDecoration::Get(decoName);
  if (pDeco)
  {
    pContents->SetDecoration(pDeco, eDecorationBorder);
    return;
  }
  
  nuiTexture* pTex = nuiTexture::GetTexture(deco);
  NGL_ASSERT(pTex);
  pDeco = new nuiFrame(decoName, pTex, frameRect);
    
  pContents->SetDecoration(pDeco, eDecorationBorder);
  
}
开发者ID:hamedmohammadi,项目名称:nui3,代码行数:53,代码来源:nuiDefaultDecoration.cpp


示例11: switch

void nuiUniformDesc::Set(const int32* pV, int32 count, bool apply)
{
  switch (mType)
  {
    case GL_INT:            NGL_ASSERT(count <= (int32)mCount * 1); break;
    case GL_INT_VEC2:       NGL_ASSERT(count <= (int32)mCount * 2); break;
    case GL_INT_VEC3:       NGL_ASSERT(count <= (int32)mCount * 3); break;
    case GL_INT_VEC4:       NGL_ASSERT(count <= (int32)mCount * 4); break;

    case GL_UNSIGNED_INT:   NGL_ASSERT(count <= (int32)mCount * 4); break;
    case GL_SAMPLER_2D:     NGL_ASSERT(count <= (int32)mCount * 4); break;
    case GL_SAMPLER_CUBE:   NGL_ASSERT(count <= (int32)mCount * 4); break;

    default:
      NGL_ASSERT(0);
  }

  bool same = true;
  for (int32 i = 0; i < count; i++)
  {
    const GLint v1 = mValues.mpInts[i];
    const GLint v2 = pV[i];

    mValues.mpInts[i] = v2;
    same = same && (v1 == v2);
  }

  mChanged = mChanged || !same;


  if (apply)
    Apply();
}
开发者ID:hamedmohammadi,项目名称:nui3,代码行数:33,代码来源:nuiUniformDesc.cpp


示例12: NGL_ASSERT

void nglTimer::Stop()
{
  if (mRunning)
  {
    NGL_ASSERT(mpCFRunLoopTimer);
    CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent();
    NGL_ASSERT(mpCFRunLoop == currentRunLoop);
    CFRunLoopRemoveTimer(currentRunLoop, mpCFRunLoopTimer, kCFRunLoopCommonModes);
    if (mpCFRunLoopTimer)
      CFRelease(mpCFRunLoopTimer);
    mpCFRunLoopTimer = NULL;
  }
  mRunning = false;
}
开发者ID:YetToCome,项目名称:nui3,代码行数:14,代码来源:nglTimer_CoreFoundation.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ NGL_OUT函数代码示例发布时间:2022-05-30
下一篇:
C++ NF_HOOK_THRESH函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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