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

C++ CX_ASSERT函数代码示例

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

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



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

示例1: cx_str_explode

cxu32 cx_str_explode (char **dst, cxu32 dstSize, const char *src, char delimiter)
{
    CX_ASSERT (dst);
    CX_ASSERT (src);

    cxu32 count = 0;

    const char *start = src;
    const char *found = strchr (start, delimiter);

    while (found)
    {
        CX_ASSERT (count < dstSize);

        dst [count++] = cx_strdup (start, found - start);

        start = found + 1;

        found = strchr (start, delimiter);
    }

    CX_ASSERT (count < dstSize);

    if (*start != '\0')
    {
        dst [count++] = cx_strdup (start, strlen (start));
    }

    return count;
}
开发者ID:uonyx,项目名称:now360,代码行数:30,代码来源:cx_string.c


示例2: CX_ASSERT

cxAtlas *cxAtlas::SetCoords(const cxArray *coords,const cxFrames *frames)
{
    CX_ASSERT(!Size().IsZero(), "size not set");
    cxInt size = frames->Num();
    SetCapacity(size);
    const cxInt *map = frames->Map();
    for(cxInt i = 0;i < size;i++){
        cxInt mapIdx = map[i];
        CX_ASSERT(mapIdx < coords->Size(), "map idx error");
        //get map tex
        cxTexCoord *coord = coords->At(mapIdx)->To<cxTexCoord>();
        if(coord->IsEmpty()){
            continue;
        }
        //trimmed box
        cxBoxPoint3F bp = coord->Trimmed(BoxPoint(), Size(), FlipX(), FlipY());
        if(bp.Size().IsZero()){
            continue;
        }
        //add render
        cxBoxRender &render = renders.Inc();
        render.SetVertices(bp);
        render.SetColor(Color());
        //get coord box
        const cxBoxCoord2F &tbox = coord->BoxCoord(Pixel(), FlipX(), FlipY());
        render.SetCoords(tbox);
    }
    return this;
}
开发者ID:cxuhua,项目名称:cxengine,代码行数:29,代码来源:cxAtlas.cpp


示例3: CX_ASSERT

//support key.key key.0.0.1, max 8 level
static json_t *jsonGetJson(json_t *json,cxConstChars key)
{
    CX_ASSERT(cxConstCharsOK(key), "key error");
    json_t *rv = json_object_get(json, key);
    if(rv != NULL){
        return rv;
    }
    cxChars ckey = allocator->strdup(key);
    cxInt num = 0;
    cxChars ckeys[16];
    cxChars src = ckey;
    ckeys[num++] = src;
    while (*src++ != '\0') {
        if(*src != '.')continue;
        CX_ASSERT(num < 16, ". opt too more");
        ckeys[num++] = src + 1;
        *src++ = '\0';
    }
    json_t *pv = json;
    cxInt index = 0;
    for(cxInt i=0; i < num;i ++){
        cxConstChars ckey = ckeys[i];
        if(cxKeyIsNumber(ckey, &index)){
            rv = json_array_get(pv, index);
        }else{
            rv = json_object_get(pv, ckey);
        }
        if(rv == NULL)break;
        pv = rv;
    }
    allocator->free(ckey);
    return rv;
}
开发者ID:fuguelike,项目名称:cxEngine,代码行数:34,代码来源:cxJson.c


示例4: CX_ASSERT

const cx_colour *_ui_intrinsic_colour_get (const ui_intrinsic_t *intr, ui_widget_state_t wstate)
{
  CX_ASSERT (intr);
  CX_ASSERT ((wstate >= UI_WIDGET_STATE_NORMAL) && (wstate < NUM_UI_WIDGET_STATES));
  
  return &intr->colour [wstate];
}
开发者ID:uonyx,项目名称:now360,代码行数:7,代码来源:ui.c


示例5: cx_str_utf8_to_unicode

cxu32 cx_str_utf8_to_unicode (cxu32 *dst, cxu32 dstSize, const char *utf8src)
{
    cxu32 dstLen = 0;

    cxu32 srcSize = strlen (utf8src); // data length

    CX_ASSERT ((srcSize < dstSize) && "dstSize too small");

    const cxu8 *src = (const cxu8 *) utf8src;

    cxi32 ss = srcSize;
#if CX_DEBUG
    cxi32 srcCount = 0;
#endif
    while ((ss > 0) && (dstLen < (dstSize - 1)))
    {
        cxu32 ch = 0;
        cxu32 offset = cx_str_utf8_decode (&ch, src);

        CX_ASSERT (dstLen < dstSize);

        dst [dstLen++] = ch;

        src += offset;

        ss -= offset;
#if CX_DEBUG
        srcCount += offset;
#endif
    }

    dst [dstLen] = 0;

    return dstLen;
}
开发者ID:uonyx,项目名称:now360,代码行数:35,代码来源:cx_string.c


示例6: _ui_intrinsic_colour_set

void _ui_intrinsic_colour_set (ui_intrinsic_t *intr, ui_widget_state_t wstate, const cx_colour *colour)
{
  CX_ASSERT (intr);
  CX_ASSERT (colour);
  CX_ASSERT ((wstate >= UI_WIDGET_STATE_NORMAL) && (wstate < NUM_UI_WIDGET_STATES));
  
  intr->colour [wstate] = *colour;
}
开发者ID:uonyx,项目名称:now360,代码行数:8,代码来源:ui.c


示例7: _ui_intrinsic_texture_set

void _ui_intrinsic_texture_set (ui_intrinsic_t *intr, ui_widget_state_t wstate, cx_texture *texture)
{
  CX_ASSERT (intr);
  CX_ASSERT (texture);
  CX_ASSERT ((wstate >= UI_WIDGET_STATE_NORMAL) && (wstate < NUM_UI_WIDGET_STATES));
  
  intr->texture [wstate] = texture;
}
开发者ID:uonyx,项目名称:now360,代码行数:8,代码来源:ui.c


示例8: CX_ASSERT

cxArray *cxArray::Swap(cxInt src,cxInt dst)
{
    CX_ASSERT(src >= 0 && src < Size(), "src out bound");
    CX_ASSERT(dst >= 0 && dst < Size(), "dst out bound");
    cxObject **ptr = (cxObject **)mv.data();
    CX_SWAP_VAR(ptr[src], ptr[dst]);
    return this;
}
开发者ID:cxuhua,项目名称:cxengine,代码行数:8,代码来源:cxArray.cpp


示例9: input_register_gesture_event_callback

void input_register_gesture_event_callback (input_gesture_type type, input_gesture_event_callback fn)
{
  CX_ASSERT (g_initialised);
  CX_ASSERT ((type > INPUT_GESTURE_TYPE_INVALID) && (type < NUM_INPUT_GESTURE_TYPES));
  CX_ASSERT (!cx_list2_exists (&g_gestureEventCallbacks [type], fn));
  
  cx_list2_insert_back (&g_gestureEventCallbacks [type], fn);
}
开发者ID:uonyx,项目名称:now360,代码行数:8,代码来源:input.c


示例10: input_register_touch_event_callback

void input_register_touch_event_callback (input_touch_type type, input_touch_event_callback fn)
{
  CX_ASSERT (g_initialised);
  CX_ASSERT ((type > INPUT_TOUCH_TYPE_INVALID) && (type < NUM_INPUT_TOUCH_TYPES));
  CX_ASSERT (!cx_list2_exists (&g_touchEventCallbacks [type], fn));
  
  cx_list2_insert_back (&g_touchEventCallbacks [type], fn);
}
开发者ID:uonyx,项目名称:now360,代码行数:8,代码来源:input.c


示例11: cx_str_utf8_decode

cxu32 cx_str_utf8_decode (cxu32 *dst, const cxu8 *src)
{
    CX_ASSERT (dst);
    CX_ASSERT (src);

    cxu32 ch = 0;
    cxu32 offset = 0;

    if ((src [0] & UTF8_BYTE6) == UTF8_BYTE6)
    {
        offset = 6;
    }
    else if ((src [0] & UTF8_BYTE5) == UTF8_BYTE5)
    {
        offset = 5;
    }
    else if ((src [0] & UTF8_BYTE4) == UTF8_BYTE4)
    {
        ch =  ((src [0] & 0x07) << 18) |
              ((src [1] & 0x3f) << 12) |
              ((src [2] & 0x3f) << 6)  |
              ((src [3] & 0x3f));

        offset = 4;
    }
    else if ((src [0] & UTF8_BYTE3) == UTF8_BYTE3)
    {
        ch =  ((src [0] & 0x0f) << 12) |
              ((src [1] & 0x3f) << 6) |
              ((src [2] & 0x3f));

        offset = 3;
    }
    else if ((src [0] & UTF8_BYTE2) == UTF8_BYTE2)
    {
        ch =  ((src [0] & 0x1f) << 6) |
              ((src [1] & 0x3f));

        offset = 2;
    }
    else if (src [0] < UTF8_BYTE1)
    {
        ch =  (src [0]);
        offset = 1;
    }
    else
    {
        offset = strlen ((const char *) src);
        CX_ERROR ("Invalid UTF8 character");
    }

    *dst = ch;

    return offset;
}
开发者ID:uonyx,项目名称:now360,代码行数:55,代码来源:cx_string.c


示例12: ui_do_button

bool ui_do_button (ui_context_t *context, const ui_button_t *button)
{
  CX_ASSERT (context);
  CX_ASSERT (button);
  
  bool ret = false;
  
  bool isHot = (button->elem == context->hover);
  bool isActive = (button->elem == context->active);
  
  if (isHot)
  {
    // is touch event end, return true;
    
    if (context->event.type == INPUT_TOUCH_TYPE_END)
    {
      bool isInside = ui_touch_hit (context, button->elem);
      
      if (isInside)
      {
        context->active = button->elem;
        ret = true;
      }
    }
    
    // render hover skin
    ui_render_element (button->elem);
    
  }
  else if (isActive)
  {
    // render active skin
    ui_render_element (button->elem);
  }
  else
  {
    // is touch event begin, return true;
    if (context->event.type == INPUT_TOUCH_TYPE_BEGIN)
    {    
      // if touch event inside, set hover
      bool isInside = ui_touch_hit (context, button->elem);
      
      if (isInside)
      {
        context->hover = button->elem;
      }
    }
    
    // render normal skin
    ui_render_element (button->elem);
  }
  
  return ret;
}
开发者ID:uonyx,项目名称:now360,代码行数:54,代码来源:ui.c


示例13: input_process_cached_events

static void input_process_cached_events (void)
{
  CX_ASSERT (g_initialised);
  
  if (g_gestureEventsCount > 0)
  {
    g_touchEventsCount = 0;
  }
    
  // gesture events
  
  for (unsigned i = 0, c = g_gestureEventsCount; i < c; ++i)
  {
    const input_gesture_event *gestureEvent = &g_gestureEventsCache [i];
    
    cx_list2 *list = &g_gestureEventCallbacks [gestureEvent->type];
    
    cx_list2_node *cb = list->head;
    
    while (cb)
    {
      CX_ASSERT (cb->data);
      
      input_gesture_event_callback fn = (input_gesture_event_callback) cb->data;
      
      fn (gestureEvent);
      
      cb = cb->next;
    }
  }

  // touch events
  
  for (unsigned i = 0, c = g_touchEventsCount; i < c; ++i)
  {
    const input_touch_event *touchEvent = &g_touchEventsCache [i];
    
    cx_list2 *list = &g_touchEventCallbacks [touchEvent->type];
    
    cx_list2_node *cb = list->head;
    
    while (cb)
    {
      CX_ASSERT (cb->data);
      
      input_touch_event_callback fn = (input_touch_event_callback) cb->data;
      
      fn (touchEvent);
      
      cb = cb->next;
    }
  }
}
开发者ID:uonyx,项目名称:now360,代码行数:53,代码来源:input.c


示例14: cxJsonCreate

cxJson cxJsonCreate(cxString json)
{
    CX_ASSERT(json != NULL, "args error");
    cxJson this = CX_CREATE(cxJson);
    json_error_t error = {0};
    if(cxStringLength(json) <= 0){
        return this;
    }
    this->json = json_loadb(cxStringBody(json), cxStringLength(json), JSON_DECODE_ANY, &error);
    CX_ASSERT(this->json != NULL, "cxJson load error (%d:%d) %s:%s",error.line,error.column,error.source,error.text);
    return this;
}
开发者ID:812872970,项目名称:cxEngine,代码行数:12,代码来源:cxJson.c


示例15: CX_FATAL_ASSERT

static ui_intrinsic_t *ui_ctx_input_hit (ui_context_t *ctx, const cx_vec2 *point, bool ext)
{
  CX_FATAL_ASSERT (ctx);
  CX_ASSERT (point);
  
  ui_intrinsic_t *hit = NULL;

  cx_list2_node *intrNode = ctx->intrList.tail;
  
  float tx = ctx->canvasWidth * point->x;
  float ty = ctx->canvasHeight * point->y;
  
  while (intrNode)
  {
    ui_intrinsic_t *intr = (ui_intrinsic_t *) intrNode->data;
    CX_ASSERT (intr);
    
    if (intr->enable)
    {    
      float w = intr->dimension.x;
      float h = intr->dimension.y;
      float x = intr->position.x;
      float y = intr->position.y;
      
      if (ext && (ctx->hover == intr))
      {
        const float ex = 4.0f;
        const float ey = 6.0f;
        
        w += ex;
        h += ey;
        x -= (ex * 0.5f);
        y -= (ey * 0.5f);
      }
      
      if ((tx >= x) && (tx <= (x + w)))
      {
        if ((ty >= y) && (ty <= (y + h)))
        {
          hit = intr;
          break;
        }
      }
    }
    
    intrNode = intrNode->prev;
  }
  
  return hit;
}
开发者ID:uonyx,项目名称:now360,代码行数:50,代码来源:ui.c


示例16: ui_ctx_render_checkbox

static void ui_ctx_render_checkbox (ui_context_t *ctx, ui_checkbox_t *checkbox)
{
  CX_FATAL_ASSERT (ctx);
  CX_ASSERT (checkbox);
  
  ui_checkbox_callbacks_t *callbacks = (ui_checkbox_callbacks_t *) checkbox->_callbacks;
  
  if (callbacks && callbacks->renderFn)
  {
    callbacks->renderFn (checkbox);
  }
  else
  {
    // default render
    
    ui_widget_state_t wstate = ui_ctx_widget_state (ctx, &checkbox->intr);
    
    if (checkbox->checked)
    {
    }
    else
    {
    }
    
    float x1 = checkbox->intr.position.x;
    float y1 = checkbox->intr.position.y;
    float x2 = x1 + checkbox->intr.dimension.x;
    float y2 = y1 + checkbox->intr.dimension.y;
    
    cx_texture *texture = checkbox->intr.texture [wstate];
    cx_colour colour = checkbox->intr.colour [wstate];
    
    cx_draw_quad (x1, y1, x2, y2, 0.0f, 0.0f, &colour, texture);
  }
}
开发者ID:uonyx,项目名称:now360,代码行数:35,代码来源:ui.c


示例17: input_clear_cached_events

static void input_clear_cached_events (void)
{
  CX_ASSERT (g_initialised);
  
  g_touchEventsCount = 0;
  g_gestureEventsCount = 0;
}
开发者ID:uonyx,项目名称:now360,代码行数:7,代码来源:input.c


示例18: input_update

void input_update (void)
{
  CX_ASSERT (g_initialised);
  
  input_process_cached_events ();
  input_clear_cached_events ();
}
开发者ID:uonyx,项目名称:now360,代码行数:7,代码来源:input.c


示例19: cxTextureCreate

cxTexture cxTextureCreate(cxConstChars file)
{
    cxTexture texture = NULL;
    CX_ASSERT(file != NULL, "file args error");
    cxStream stream = cxAssetsStreamCreate(file);
    if(stream == NULL){
        CX_ERROR("create stream from file %s failed",file);
        return NULL;
    }
    char *ext = strrchr(file, '.');
    if(ext == NULL){
        CX_ERROR("unknow file ext name");
        return NULL;
    }
    if(cxConstCharsEqu(ext, ".png")){
        texture = cxTexturePNGLoadStream(stream);
    }else if(cxConstCharsEqu(ext, ".pvr")){
        texture = cxTexturePVRLoadStream(stream);
    }else if(cxConstCharsEqu(ext, ".xml")){
        texture = cxTextureXMLLoadStream(stream);
    }else if(cxConstCharsEqu(ext, ".pkm")){
        texture = cxTexturePKMLoadStream(stream);
    }else if(cxConstCharsEqu(ext, ".jpg") || cxConstCharsEqu(ext, ".jpeg")){
        texture = cxTextureJPGLoadStream(stream);
    }else{
        CX_ERROR("load texture failed %s",file);
    }
    return texture;
}
开发者ID:812872970,项目名称:cxEngine,代码行数:29,代码来源:cxTextureFactory.c


示例20: cxPlayEffect

cxAny cxPlayEffect(cxConstChars file,cxBool loop)
{
    cxPlayer this = cxPlayerInstance();
    JniMethodInfo methodInfo;
    cxBool ret = cxGetStaticMethodInfo(&methodInfo, CLASS_NAME, "cxEnginePlayEffect","(Ljava/lang/String;Z)I");
    CX_ASSERT(ret, "get static method info failed");
    CX_UNUSED_PARAM(ret);
    jstring path = (*methodInfo.env)->NewStringUTF(methodInfo.env,file);
    cxInt soundId = (*methodInfo.env)->CallStaticIntMethod(methodInfo.env, methodInfo.classID, methodInfo.methodID, path, loop);
    (*methodInfo.env)->DeleteLocalRef(methodInfo.env,path);
    if(soundId <= 0){
        CX_ERROR("play file failed %s",file);
        return NULL;
    }
    cxTrack track = cxHashGet(this->tracks, cxHashStrKey(file));
    //add or replace
    if(track == NULL || track->soundId != soundId){
        track = CX_ALLOC(cxTrack);
        track->file = cxStringAllocChars(file);
        track->soundId = soundId;
        cxHashSet(this->tracks, cxHashStrKey(file), track);
        CX_RELEASE(track);
    }
    return track;
}
开发者ID:812872970,项目名称:cxEngine,代码行数:25,代码来源:cxPlayer.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ CYASSERT函数代码示例发布时间:2022-05-30
下一篇:
C++ CXXTOOLS_UNIT_ASSERT_EQUALS函数代码示例发布时间: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