本文整理汇总了C++中OX_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ OX_ASSERT函数的具体用法?C++ OX_ASSERT怎么用?C++ OX_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OX_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OX_ASSERT
void Resources::add(Resource* r, bool accessByShortenID)
{
OX_ASSERT(r);
if (!r)
return;
std::string name = lower(r->getName());
r->setName(name);
_resourcesMap[name] = r;
if (accessByShortenID)
{
std::string shortName = path::extractFileName(name);
if (shortName != name)
{
#ifdef OX_DEBUG
OX_ASSERT(_resourcesMap.find(shortName) == _resourcesMap.end());
if (_resourcesMap.find(shortName) != _resourcesMap.end())
{
logs::error("short resource name '%s' conflicts with '%s'", r->getName().c_str(), _resourcesMap[shortName]->getName().c_str());
}
#endif
_resourcesMap[shortName] = r;
}
}
}
示例2: splitExt
void splitExt(const char *src, char *destHead, char *destTail)
{
OX_ASSERT(src != destHead);
OX_ASSERT(src != destTail);
destHead[0] = 0;
destTail[0] = 0;
int len = strlen(src);
int i = 0;
for (i = len - 1; i >= 0; --i)
{
if (src[i] == '.')
break;
}
if (i == -1)
i = len;
memcpy(destHead, src, i);
destHead[i] = 0;
int n = len - i;
memcpy(destTail, src + i, n);
destTail[n] = 0;
}
示例3: OX_ASSERT
void Tween::complete(timeMS deltaTime)
{
if (_loops == -1)
return;
//if already done
if (_status >= status_done)
return;
OX_ASSERT(_client);
//OX_ASSERT(!"not implemented");
//not started yet because has delay
if (_status == status_delayed)
{
_start(*_client);
_status = status_started;
}
OX_ASSERT(_status == status_started);
//while (_status != status_remove)
{
UpdateState us;
us.dt = deltaTime;
update(*_client, us);
}
OX_ASSERT(_status == status_done);
//_client->removeTween(this);
}
示例4: split
void split(const char *src, char *destHead, char *destTail)
{
OX_ASSERT(src != destHead);
OX_ASSERT(src != destTail);
destHead[0] = 0;
destTail[0] = 0;
int i = 0;
int len = strlen(src);
while (len)
{
char c = src[len-1];
if (c == '\\' || c == '/')
{
break;
}
destTail[i] = c;
++i;
--len;
}
destTail[i] = 0;
reverse(destTail);
memcpy(destHead, src, len);
destHead[len] = 0;
}
示例5: OX_ASSERT
void STDRenderer::setTexture(spNativeTexture base, spNativeTexture alpha, bool basePremultiplied)
{
if (base == 0 || base->getHandle() == 0)
base = white;
unsigned int shaderFlags = _shaderFlags;
if (basePremultiplied)
shaderFlags &= ~UberShaderProgram::ALPHA_PREMULTIPLY;
else
shaderFlags |= UberShaderProgram::ALPHA_PREMULTIPLY;
if (alpha)
shaderFlags |= UberShaderProgram::SEPARATE_ALPHA;
else
shaderFlags &= ~UberShaderProgram::SEPARATE_ALPHA;
//##ifdef OX_DEBUG
#if 0
if (_base != base) { OX_ASSERT(_alpha != alpha); }
else { OX_ASSERT(_alpha == alpha); }
#endif //OX_DEBUG
//no reason to check changed alpha because it is in pair with base
if (_base != base || /*_alpha != alpha || */_shaderFlags != shaderFlags)
{
drawBatch();
}
_shaderFlags = shaderFlags;
_base = base;
_alpha = alpha;
}
示例6: assert
ImageData NativeTextureGLES::lock(lock_flags flags, const Rect* src)
{
assert(_lockFlags == 0);
_lockFlags = flags;
Rect r(0, 0, _width, _height);
if (src)
r = *src;
OX_ASSERT(r.getX() + r.getWidth() <= _width);
OX_ASSERT(r.getY() + r.getHeight() <= _height);
_lockRect = r;
assert(_lockFlags != 0);
if (_lockRect.isEmpty())
{
OX_ASSERT(!"_lockRect.IsEmpty()");
return ImageData();
}
if (_data.empty())
{
//_data.resize(_width)
}
ImageData im = ImageData(_width, _height, (int)(_data.size() / _height), _format, &_data.front());
return im.getRect(_lockRect);
}
示例7: OX_ASSERT
void TweenAnim::setInterval(int start, int end)
{
_start = start;
_end = end;
int num = _row == -1 ? _resAnim->getTotalFrames() : _resAnim->getColumns();
OX_ASSERT(_start >= 0 && _start < num);
OX_ASSERT(_end >= 0 && _end < num);
}
示例8: OX_ASSERT
ImageData ImageData::getRect(const Rect &r) const
{
OX_ASSERT(r.getX() + r.getWidth() <= w);
OX_ASSERT(r.getY() + r.getHeight() <= h);
void *ptr = (unsigned char*)data + r.getX() * bytespp + r.getY() * pitch;
ImageData buffer(r.getWidth(), r.getHeight(), pitch, format, ptr);
return buffer;
}
示例9: OX_ASSERT
PointerState* Input::getTouchByIndex(pointer_index index_)
{
OX_ASSERT(index_ != 0);
int index = index_;
if (index == MAX_TOUCHES + 1)
return &_pointerMouse;
index -= 1;
OX_ASSERT(index >= 0 && index < MAX_TOUCHES);
index = std::min(std::max(index, 0), MAX_TOUCHES);
return &_pointers[index];
}
示例10: getStage
void Flow::phaseEnd()
{
_transition = false;
spScene current = _current;
spScene next = _next;
_current = 0;
_next = 0;
if ((next->_dialog && _back) || !next->_dialog)
{
current->_holder->detach();
current->postHiding();
}
getStage()->insertChildBefore(_touchBlocker, next->getHolder());
if (!_back || !current->_dialog)
next->postShowing();
if (_back)
next->sceneHidden(current);
getStage()->removeEventListener(TouchEvent::CLICK, CLOSURE(this, &Flow::blockedTouch));
if (current->_done)
{
current->leaving();
if (current->_resultCB)
{
current->_resultCB(¤t->_finishEvent);
current->_resultCB = resultCallback();
}
}
if (current->_remove)
{
OX_ASSERT(next->_dialog == false);
std::vector<spScene>::iterator i = std::find(scenes.begin(), scenes.end(), current);
OX_ASSERT(i != scenes.end());
scenes.erase(i);
}
if (_wasTouchBlocked)
{
log::messageln("send blocked touch");
TouchEvent click(TouchEvent::CLICK, true, _blockedTouchPosition);
getStage()->handleEvent(&click);
_wasTouchBlocked = false;
}
}
示例11: unitTest
bool unitTest()
{
char dest[255];
//normalize("//", dest);
//OX_ASSERT(strcmp(dest, "/") == 0);
normalize("/../", dest);
OX_ASSERT(strcmp(dest, "../") == 0);
normalize("../c\\", dest);
OX_ASSERT(strcmp(dest, "../c/") == 0);
normalize("a//", dest);
OX_ASSERT(strcmp(dest, "a/") == 0);
normalize("\\/\\///\\/", dest);// \n
OX_ASSERT(strcmp(dest, "") == 0);
normalize("a/b/..\\//..///\\/../c\\\\/", dest);
OX_ASSERT(strcmp(dest, "../c/") == 0);
normalize("a/../c", dest);
OX_ASSERT(strcmp(dest, "c") == 0);
normalize("a/b/../../../c", dest);
OX_ASSERT(strcmp(dest, "../c") == 0);
normalize("..a/b/..\\//..///\\/../c\\\\/", dest);
OX_ASSERT(strcmp(dest, "../c/") == 0);
return true;
}
示例12: strcpy
void Resources::registerResourceType(Resources::createResourceCallback creationCallback, const char* resTypeID)
{
registeredResource r;
r.cb = creationCallback;
strcpy(r.id, resTypeID);
registeredResources::iterator it = std::lower_bound(_registeredResources.begin(), _registeredResources.end(), r.id, registeredResource::comparePred2);
if (it != _registeredResources.end())
{
if (!strcmp(it->id, resTypeID))
{
OX_ASSERT(!"resource already registered");
return;
}
}
_registeredResources.insert(it, r);
/*
for (it = _registeredResources.begin(); it != _registeredResources.end(); ++it)
{
registeredResource *q = &(*it);
int er =0 ;
}
*/
}
示例13: drawBatch
void STDRenderer::setBlendMode(blend_mode blend)
{
if (_blend != blend)
{
drawBatch();
switch (blend)
{
case blend_disabled:
_driver->setState(IVideoDriver::STATE_BLEND, 0);
break;
case blend_premultiplied_alpha:
_driver->setBlendFunc(IVideoDriver::BT_ONE, IVideoDriver::BT_ONE_MINUS_SRC_ALPHA);
break;
case blend_alpha:
_driver->setBlendFunc(IVideoDriver::BT_SRC_ALPHA, IVideoDriver::BT_ONE_MINUS_SRC_ALPHA);
break;
case blend_add:
_driver->setBlendFunc(IVideoDriver::BT_ONE, IVideoDriver::BT_ONE);
break;
//case blend_sub:
//_driver->setBlendFunc(IVideoDriver::BT_ONE, IVideoDriver::BT_ONE);
//glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
// break;
default:
OX_ASSERT(!"unknown blend");
}
if (_blend == blend_disabled)
{
_driver->setState(IVideoDriver::STATE_BLEND, 1);
}
_blend = blend;
}
}
示例14: getBytesPerPixel
int getBytesPerPixel(TextureFormat tf)
{
switch (tf)
{
case TF_A8:
case TF_L8:
return 1;
case TF_A8L8:
return 2;
case TF_R8G8B8A8:
case TF_B8G8R8A8:
return 4;
case TF_R8G8B8:
return 3;
case TF_R5G5B5A1:
return 2;
case TF_R5G6B5:
return 2;
case TF_R4G4B4A4:
return 2;
case TF_PVRTC_2RGB:
case TF_PVRTC_2RGBA:
case TF_PVRTC_4RGB:
case TF_PVRTC_4RGBA:
case TF_PVRTCII_2:
case TF_PVRTCII_4:
case TF_ETC1:
return 0;
case TF_UNDEFINED:
return 0;
default:
OX_ASSERT(!"unknown type");
}
return 0;
}
示例15: OX_ASSERT
void HttpRequestTask::addHeader(const std::string& key, const std::string& value)
{
OX_ASSERT(!key.empty());
_headers.push_back(std::make_pair(key, value));
_addHeader(key, value);
}