本文整理汇总了C++中OX_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ OX_ASSERT函数的具体用法?C++ OX_ASSERT怎么用?C++ OX_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OX_ASSERT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
}
开发者ID:oxygine,项目名称:oxygine-framework,代码行数:27,代码来源:Resources.cpp
示例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;
}
开发者ID:cnsoft,项目名称:oxygine-framework,代码行数:25,代码来源:stringUtils.cpp
示例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);
}
开发者ID:NeoPeace,项目名称:oxygine-framework,代码行数:34,代码来源:Tween.cpp
示例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;
}
开发者ID:cnsoft,项目名称:oxygine-framework,代码行数:28,代码来源:stringUtils.cpp
示例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;
}
开发者ID:poplax,项目名称:oxygine-framework,代码行数:34,代码来源:STDRenderer.cpp
示例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);
}
开发者ID:Neo7k,项目名称:oxygine-framework,代码行数:32,代码来源:NativeTextureGLES.cpp
示例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);
}
开发者ID:ivlevAstef,项目名称:PrototypeCarGame,代码行数:9,代码来源:TweenAnim.cpp
示例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;
}
开发者ID:gotonis,项目名称:danmake,代码行数:10,代码来源:ImageData.cpp
示例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];
}
开发者ID:oxygine,项目名称:oxygine-framework,代码行数:12,代码来源:Input.cpp
示例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;
}
}
开发者ID:Aizter,项目名称:oxygine-flow,代码行数:53,代码来源:flow.cpp
示例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;
}
开发者ID:cnsoft,项目名称:oxygine-framework,代码行数:34,代码来源:stringUtils.cpp
示例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 ;
}
*/
}
开发者ID:Wasabi2007,项目名称:oxygine-framework,代码行数:25,代码来源:Resources.cpp
示例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;
}
}
开发者ID:poplax,项目名称:oxygine-framework,代码行数:35,代码来源:STDRenderer.cpp
示例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;
}
开发者ID:gotonis,项目名称:danmake,代码行数:35,代码来源:ImageData.cpp
示例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);
}
开发者ID:maniacs-games,项目名称:oxygine-framework,代码行数:7,代码来源:HttpRequestTask.cpp
示例16: al
void Zips::add(const char* name)
{
MutexAutoLock al(_lock);
zlib_filefunc_def zpfs;
memset(&zpfs, 0, sizeof(zpfs));
zpfs.zopen_file = ox_fopen;
zpfs.zread_file = ox_fread;
zpfs.zwrite_file = 0;
zpfs.ztell_file = ox_ftell;
zpfs.zseek_file = ox_fseek;
zpfs.zclose_file = ox_fclose;
zpfs.zerror_file = ox_ferror;
zpfs.opaque = (void*)_zps.size();
//zpfs.opaque = name;
unzFile zp = unzOpen2(name, &zpfs);//todo, optimize search in zip
OX_ASSERT(zp);
if (!zp)
return;
zpitem item;
item.handle = zp;
strcpy(item.name, name);
_zps.push_back(item);
read(zp);
}
开发者ID:Yahor10,项目名称:oxygine-framework,代码行数:29,代码来源:ZipFileSystem.cpp
示例17: _frames
DebugActor::DebugActor(): _frames(0), _startTime(0), _corner(0), _showTexel2PixelErrors(false), _showTouchedActor(false)
{
DebugActor::initialize();
setName(getDefaultName());
_startTime = getTimeMS();
setPriority(30000);
setTouchEnabled(false);
TextStyle st;
st.font = NULL;
if (ResFont* fnt = resSystem->getResFont("system"))
{
st.font = fnt->getFont();
}
OX_ASSERT(st.font != NULL);
st.vAlign = TextStyle::VALIGN_TOP;
//st.color = Color(rand()%255, rand()%255, rand()%255, 255);
st.color = Color(Color::Black, 255);
st.multiline = true;
setWidth(230);
setHeight(45);
_bg = new ColorRectSprite;
_bg->setColor(Color(Color::White, 64));
_bg->setSize(getSize());
_bg->setTouchEnabled(false);
addChild(_bg);
float x = getWidth();
addButton(x, "tree", "tree");
addButton(x, "finger", "finger");
#ifdef OXYGINE_DEBUG_T2P
addButton(x, "t2p", "t2p");
#endif
#ifdef OXYGINE_DEBUG_TRACE_LEAKS
addButton(x, "images", "images");
#endif
_text = new TextField;
addChild(_text);
_text->setPosition(2, 5);
_text->setTouchEnabled(false);
_text->setStyle(st);
_text->setWidth(getWidth());
_text->setText("debug text");
instance = this;
}
开发者ID:ivlevAstef,项目名称:PrototypeCarGame,代码行数:60,代码来源:DebugActor.cpp
示例18: OX_ASSERT
void SoundPlayer::removeSoundInstance(SoundInstance* soundInstance)
{
playingSounds::iterator i = std::find(_sounds.begin(), _sounds.end(), soundInstance);
OX_ASSERT(i != _sounds.end());
_sounds.erase(i);
}
开发者ID:zmeyc,项目名称:oxygine-sound,代码行数:7,代码来源:SoundPlayer.cpp
示例19: OX_ASSERT
void ResAnim::setFrame(int col, int row, const AnimationFrame& frame)
{
int i = row * _columns + col;
OX_ASSERT(i < (int)_frames.size());
if (i < (int)_frames.size())
_frames[i] = frame;
}
开发者ID:Jesus05,项目名称:oxygine-framework,代码行数:7,代码来源:ResAnim.cpp
示例20: lock
void ThreadDispatcher::reply(void* val)
{
#ifndef OX_NO_MT
MutexPthreadLock lock(_mutex);
#endif
OX_ASSERT(_last.need_reply);
_replyLast(val);
}
开发者ID:Wasabi2007,项目名称:oxygine-framework,代码行数:8,代码来源:ThreadDispatcher.cpp
注:本文中的OX_ASSERT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论