这篇教程C++ GCN_EXCEPTION函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GCN_EXCEPTION函数的典型用法代码示例。如果您正苦于以下问题:C++ GCN_EXCEPTION函数的具体用法?C++ GCN_EXCEPTION怎么用?C++ GCN_EXCEPTION使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GCN_EXCEPTION函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GCN_EXCEPTION void OpenGLImage::convertToDisplayFormat() { if (mPixels == NULL) { throw GCN_EXCEPTION("Image has already been converted to display format"); } glGenTextures(1, &mTextureHandle); glBindTexture(GL_TEXTURE_2D, mTextureHandle); glTexImage2D(GL_TEXTURE_2D, 0, 4, mTextureWidth, mTextureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, mPixels); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); delete[] mPixels; mPixels = NULL; GLenum error = glGetError(); if (error) { std::string errmsg; switch (error) { case GL_INVALID_ENUM: errmsg = "GL_INVALID_ENUM"; break; case GL_INVALID_VALUE: errmsg = "GL_INVALID_VALUE"; break; case GL_INVALID_OPERATION: errmsg = "GL_INVALID_OPERATION"; break; case GL_STACK_OVERFLOW: errmsg = "GL_STACK_OVERFLOW"; break; case GL_STACK_UNDERFLOW: errmsg = "GL_STACK_UNDERFLOW"; break; case GL_OUT_OF_MEMORY: errmsg = "GL_OUT_OF_MEMORY"; break; } throw GCN_EXCEPTION(std::string("Unable to convert to OpenGL display format, glGetError said: ") + errmsg); } }
开发者ID:Mistranger,项目名称:stratagus2,代码行数:60,
示例2: gk_create_keeper void AllegroGlyphKeeperFont::load(const std::string& filename, int w, int h) { mKeeper = gk_create_keeper(0,0); if (mKeeper == NULL) { throw GCN_EXCEPTION("Can't create keeper."); } mFace = gk_load_face_from_file(filename.c_str(), 0); if (mFace == NULL) { throw GCN_EXCEPTION("Can't load font from file."); } mRend = gk_create_renderer(mFace,mKeeper); if (mRend == NULL) { throw GCN_EXCEPTION("Can't create renderer."); } gk_rend_set_hinting_off(mRend); gk_rend_set_size_pixels(mRend, w, h); gk_rend_set_text_color_rgb(mRend, 0, 0, 0); }
开发者ID:k1rn1l,项目名称:naruto-hand-signs-fighting,代码行数:27,
示例3: load virtual Image* load(const std::string& filename, bool convertToDisplayFormat = true) { SDL_Surface *loadedSurface = loadSDLSurface(filename); if (loadedSurface == NULL) { throw GCN_EXCEPTION( std::string("Unable to load image file: ") + filename); } SDL_Surface *surface = convertToStandardFormat(loadedSurface); SDL_FreeSurface(loadedSurface); if (surface == NULL) { throw GCN_EXCEPTION( std::string("Not enough memory to load: ") + filename); } OpenGLImage *image = new OpenGLImage((unsigned int*)surface->pixels, surface->w, surface->h, convertToDisplayFormat); SDL_FreeSurface(surface); return image; }
开发者ID:DakaraOnline,项目名称:AONX,代码行数:28,
示例4: GCN_EXCEPTION void DirectX3DGraphics::drawImage(const Image* image, int srcX, int srcY, int dstX, int dstY, int width, int height) { const DirectX3DImage* srcImage = dynamic_cast<const DirectX3DImage*>(image); if (srcImage == NULL) { throw GCN_EXCEPTION("Trying to draw an image of unknown format, must be a DirectXImage."); } if (mClipStack.empty()) { throw GCN_EXCEPTION("Clip stack is empty, perhaps you called a draw funtion outside of _beginDraw() and _endDraw()?"); } const ClipRectangle& top = mClipStack.top(); dstX += top.xOffset; dstY += top.yOffset; // Find DirectX texture coordinates float texX1 = srcX / (float)srcImage->getTextureWidth(); float texY1 = srcY / (float)srcImage->getTextureHeight(); float texX2 = (srcX+width) / (float)srcImage->getTextureWidth(); float texY2 = (srcY+height) / (float)srcImage->getTextureHeight(); // Check if blending already is enabled if (!mAlpha) { mDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); } DWORD color = 0xFFFFFFFF; VertexWithTexture vertices[]= { {(float)dstX, (float)dstY + height, 0.0f, 1.0f, color, texX1, texY2}, {(float)dstX, (float)dstY, 0.0f, 1.0f, color, texX1, texY1}, {(float)dstX + width, (float)dstY + height, 0.0f, 1.0f, color, texX2, texY2}, {(float)dstX + width, (float)dstY, 0.0f, 1.0f, color, texX2, texY1}, }; mDevice->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1); mDevice->SetTexture(0, srcImage->getTexture()); mDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, vertices, sizeof(VertexWithTexture)); mDevice->SetTexture(0, 0); if (!mAlpha) { mDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); } }
开发者ID:andryblack,项目名称:guichan,代码行数:60,
示例5: GCN_EXCEPTION Color CairoImage::getPixel(int x, int y) { if (!mCairoSurface) { throw GCN_EXCEPTION("Trying to get a pixel from a non loaded image."); } int stride=cairo_image_surface_get_stride(mCairoSurface); int yindex=y*stride; unsigned char *imagePixels=cairo_image_surface_get_data(mCairoSurface); if (!imagePixels) { throw GCN_EXCEPTION("Surface data are not available (surface is not of type cairo_image_surface or has been finished)"); } // deal differently with each surface format switch(cairo_image_surface_get_format(mCairoSurface)) { case CAIRO_FORMAT_ARGB32: return GetColorFromARGB(*((unsigned long*)(&imagePixels[x*4 + yindex]))); break; case CAIRO_FORMAT_RGB24: return GetColorFromRGB(*((unsigned long*)(&imagePixels[x*4 + yindex]))); break; case CAIRO_FORMAT_A8: return Color(0,0,0,imagePixels[x + yindex]); break; default : return Color(0,0,0); //do nothing break; } }
开发者ID:andryblack,项目名称:guichan,代码行数:32,
示例6: GCN_EXCEPTION void COCOS2DXGraphics::drawImage(const Image* image, int srcX, int srcY, int dstX, int dstY, int width, int height) { if (mClipStack.empty()) { throw GCN_EXCEPTION("Clip stack is empty, perhaps you called a draw funtion outside of _beginDraw() and _endDraw()?"); } const ClipRectangle& top = mClipStack.top(); SDLMOD_Rect src; SDLMOD_Rect dst; src.x = srcX; src.y = srcY; src.w = width; src.h = height; dst.x = dstX + top.xOffset; dst.y = dstY + top.yOffset; const COCOS2DXImage* srcImage = dynamic_cast<const COCOS2DXImage*>(image); if (srcImage == NULL) { throw GCN_EXCEPTION("Trying to draw an image of unknown format, must be an SDLImage."); } SDLMOD_BlitSurface(srcImage->getSurface(), &src, mTarget, &dst); }
开发者ID:weimingtom,项目名称:guichan_cocos2dx,代码行数:33,
示例7: IMG_Load_RWgcn::Image* InfraellyImageLoader::load(SDL_RWops *source_Rwop, bool freeRWOP, bool convertToDisplayFormat){ //load the rWop into a SDL Surface SDL_Surface *loadedSurface = IMG_Load_RW(source_Rwop, freeRWOP); if (loadedSurface == NULL) { throw GCN_EXCEPTION( std::string("Unable to load image file: ") ); } SDL_Surface *surface = convertToStandardFormat(loadedSurface); SDL_FreeSurface(loadedSurface); if (surface == NULL) { throw GCN_EXCEPTION( std::string("Not enough memory to load: ") ); } gcn::Image *image = new gcn::SDLImage(surface, true); if (convertToDisplayFormat) { image->convertToDisplayFormat(); } return image;}
开发者ID:Infraelly,项目名称:old-infraelly-engine,代码行数:26,
示例8: SDL_RWFromMemgcn::Image* InfraellyImageLoader::load(unsigned char *buffer, long bufferLength, bool convertToDisplayFormat){ //make rWop out of character buffer SDL_RWops *source_Rwop = SDL_RWFromMem(buffer, bufferLength); //load the rWop into a SDL Surface SDL_Surface *loadedSurface = IMG_Load_RW(source_Rwop, 1); if (loadedSurface == NULL) { throw GCN_EXCEPTION( std::string("Unable to load image file: ") ); } SDL_Surface *surface = convertToStandardFormat(loadedSurface); SDL_FreeSurface(loadedSurface); if (surface == NULL) { throw GCN_EXCEPTION( std::string("Not enough memory to load: ") ); } gcn::Image *image = new gcn::SDLImage(surface, true); if (convertToDisplayFormat) { image->convertToDisplayFormat(); } return image;}
开发者ID:Infraelly,项目名称:old-infraelly-engine,代码行数:29,
示例9: loadSDLSurface Image* GLUTImageLoader::load(const std::string& filename, bool convertToDisplayFormat) { SDLMOD_Surface *loadedSurface = loadSDLSurface(filename); if (loadedSurface == NULL) { throw GCN_EXCEPTION( std::string("Unable to load image file: ") + filename); }#if 0 SDLMOD_Surface *surface = convertToStandardFormat(loadedSurface); SDLMOD_FreeSurface(loadedSurface); if (surface == NULL) { throw GCN_EXCEPTION( std::string("Not enough memory to load: ") + filename); }#else SDLMOD_Surface *surface = loadedSurface;#endif Image *image = new GLUTImage(surface, true); if (convertToDisplayFormat) { image->convertToDisplayFormat(); } return image; }
开发者ID:weimingtom,项目名称:guichan_memory,代码行数:33,
示例10: GCN_EXCEPTION void FocusHandler::applyChanges() { if (mToBeFocused != NULL) { unsigned int i = 0; int toBeFocusedIndex = -1; for (i = 0; i < mWidgets.size(); ++i) { if (mWidgets[i] == mToBeFocused) { toBeFocusedIndex = i; break; } } if (toBeFocusedIndex < 0) { throw GCN_EXCEPTION("Trying to focus a none existing widget."); } Widget *oldFocused = mFocusedWidget; if (oldFocused != mToBeFocused) { mFocusedWidget = mWidgets.at(toBeFocusedIndex); if (oldFocused != NULL) { oldFocused->lostFocus(); } mWidgets.at(toBeFocusedIndex)->gotFocus(); } mToBeFocused = NULL; } if (mToBeDragged != NULL) { unsigned int i = 0; int toBeDraggedIndex = -1; for (i = 0; i < mWidgets.size(); ++i) { if (mWidgets[i] == mToBeDragged) { toBeDraggedIndex = i; break; } } if (toBeDraggedIndex < 0) { throw GCN_EXCEPTION("Trying to give drag to a none existing widget"); } mDraggedWidget = mWidgets.at(toBeDraggedIndex); mToBeDragged = NULL; } }
开发者ID:OneSleepyDev,项目名称:boswars_osd,代码行数:58,
示例11: os void ImageFont::addGlyph(unsigned char c, int &x, int &y, const Color& separator) { ImageLoader* il = Image::_getImageLoader(); Color color; do { ++x; if (x >= il->getWidth()) { y += mHeight + 1; x = 0; if (y >= il->getHeight()) { std::string str; std::ostringstream os(str); os << "Image "; os << mFilename; os << " with font is corrupt near character '"; os << c; os << "'"; throw GCN_EXCEPTION(os.str()); } } color = il->getPixel(x, y); } while (color == separator); int w = 0; do { ++w; if (x+w >= il->getWidth()) { std::string str; std::ostringstream os(str); os << "Image "; os << mFilename; os << " with font is corrupt near character '"; os << c; os << "'"; throw GCN_EXCEPTION(os.str()); } color = il->getPixel(x + w, y); } while (color != separator); mGlyph[c] = Rectangle(x, y, w, mHeight); x += w; }
开发者ID:k1643,项目名称:StratagusAI,代码行数:58,
示例12: os Rectangle ImageFont::scanForGlyph(unsigned char glyph, int x, int y, const Color& separator) { Color color; do { ++x; if (x >= mImage->getWidth()) { y += mHeight + 1; x = 0; if (y >= mImage->getHeight()) { std::string str; std::ostringstream os(str); os << "Image "; os << mFilename; os << " with font is corrupt near character '"; os << glyph; os << "'"; throw GCN_EXCEPTION(os.str()); } } color = mImage->getPixel(x, y); } while (color == separator); int width = 0; do { ++width; if (x + width >= mImage->getWidth()) { std::string str; std::ostringstream os(str); os << "Image "; os << mFilename; os << " with font is corrupt near character '"; os << glyph; os << "'"; throw GCN_EXCEPTION(os.str()); } color = mImage->getPixel(x + width, y); } while (color != separator); return Rectangle(x, y, width, mHeight); }
开发者ID:Infraelly,项目名称:old-infraelly-engine,代码行数:56,
示例13: GCN_EXCEPTION ImageFont::ImageFont(Image* image, const std::string& glyphs) { mFilename = "Image*"; if (image == NULL) { GCN_EXCEPTION("Font image is NULL"); } mImage = image; Color separator = mImage->getPixel(0, 0); int i = 0; for (i = 0; i < mImage->getWidth() && separator == mImage->getPixel(i, 0); ++i) { } if (i >= mImage->getWidth()) { throw GCN_EXCEPTION("Corrupt image."); } int j = 0; for (j = 0; j < mImage->getHeight(); ++j) { if (separator == mImage->getPixel(i, j)) { break; } } mHeight = j; int x = 0, y = 0; unsigned char k; for (i = 0; i < (int)glyphs.size(); ++i) { k = glyphs.at(i); mGlyph[k] = scanForGlyph(k, x, y, separator); // Update x och y with new coordinates. x = mGlyph[k].x + mGlyph[k].width; y = mGlyph[k].y; } int w = mImage->getWidth(); int h = mImage->getHeight(); mImage->convertToDisplayFormat(); mRowSpacing = 0; mGlyphSpacing = 0; }
开发者ID:Infraelly,项目名称:old-infraelly-engine,代码行数:53,
示例14: GCN_EXCEPTION void SDLImageLoader::putPixel(int x, int y, const Color& color) { if (mCurrentImage == NULL) { throw GCN_EXCEPTION("No image prepared."); } if (x < 0 || y < 0 || x >= mCurrentImage->w || y >= mCurrentImage->h) { throw GCN_EXCEPTION("x and y out of image bound."); } SDLputPixel(mCurrentImage, x, y, color); }
开发者ID:k1643,项目名称:StratagusAI,代码行数:14,
示例15: GCN_EXCEPTIONvoid gcn::Panel::add(gcn::Widget *widget){ // width of current widget exceeds remaining space, go down 1 row int dimx = _nextx + _spacingX + widget->getDimension().width; if(dimx > getChildrenArea().width || (_slotsx > 0 && _usedx >= _slotsx)) { _usedx = 0; _nextx = _spacingX; _usedy++; _nexty += (_maxheight + _spacingY); _maxheight = 0; } // height of current widget exceeds remaining space, whoops int dimy = _nexty + _spacingY + widget->getDimension().height; if(dimy > getChildrenArea().height && _slotsy >= 0 && _usedy >= _slotsy) { throw GCN_EXCEPTION("height exceeded, can't add more widgets"); } widget->setPosition(_nextx, _nexty); Container::add(widget); _maxheight = std::max(_maxheight, widget->getDimension().height); _nextx += (_spacingX + widget->getDimension().width); _usedx++;}
开发者ID:IamusNavarathna,项目名称:lv3proj,代码行数:27,
示例16: GCN_EXCEPTION void Text::setRow(unsigned int row, const std::string& content) { if (row >= mRows.size()) throw GCN_EXCEPTION("Row out of bounds!"); mRows[row] = content; }
开发者ID:kallaballa,项目名称:Neurocid,代码行数:7,
示例17: GCN_EXCEPTION void HGEImage::convertToDisplayFormat() { DWORD *pLockPtr = mHGE->Texture_Lock(mTexture); if (pLockPtr == NULL) { throw GCN_EXCEPTION("Locking of the texture failed. HGE only support locking of 32bit textures."); } int i; int end = mHGE->Texture_GetWidth(mTexture, true) * mHGE->Texture_GetHeight(mTexture, true); for (i = 0; i < end; i++) { DWORD color = pLockPtr[i]; if (GETR(color) == 0xFF && GETG(color) == 0x00 && GETB(color) == 0xFF) { pLockPtr[i] = ARGB(0x00, 0x00, 0x00, 0x00); } } mHGE->Texture_Unlock(mTexture); mHGESprite = new hgeSprite(mTexture, 0, 0, mHGE->Texture_GetWidth(mTexture, true), mHGE->Texture_GetHeight(mTexture, true)); }
开发者ID:hoodwolf,项目名称:Infraelly,代码行数:32,
示例18: GCN_EXCEPTION void OpenGLGraphics::drawLine(int x1, int y1, int x2, int y2) { if (mClipStack.empty()) { throw GCN_EXCEPTION("Clip stack is empty, perhaps you called a draw funtion outside of _beginDraw() and _endDraw()?"); } const ClipRectangle& top = mClipStack.top(); x1 += top.xOffset; y1 += top.yOffset; x2 += top.xOffset; y2 += top.yOffset; glBegin(GL_LINES); glVertex2f(x1 + 0.375f, y1 + 0.375f); glVertex2f(x2 + 1.0f - 0.375f, y2 + 1.0f - 0.375f); glEnd(); glBegin(GL_POINTS); glVertex2f(x2 + 1.0f - 0.375f, y2 + 1.0f - 0.375f); glEnd(); glBegin(GL_POINTS); glVertex2f(x1 + 0.375f, y1 + 0.375f); glEnd(); }
开发者ID:IamusNavarathna,项目名称:lv3proj,代码行数:31,
示例19: while void Gui::handleMouseInput() { while (!mInput->isMouseQueueEmpty()) { MouseInput mouseInput = mInput->dequeueMouseInput(); // Save the current mouse state. It will be needed if modal focus // changes or modal mouse input focus changes. mLastMouseX = mouseInput.getX(); mLastMouseY = mouseInput.getY(); switch (mouseInput.getType()) { case MouseInput::PRESSED: handleMousePressed(mouseInput); break; case MouseInput::RELEASED: handleMouseReleased(mouseInput); break; case MouseInput::MOVED: handleMouseMoved(mouseInput); break; case MouseInput::WHEEL_MOVED_DOWN: handleMouseWheelMovedDown(mouseInput); break; case MouseInput::WHEEL_MOVED_UP: handleMouseWheelMovedUp(mouseInput); break; default: throw GCN_EXCEPTION("Unknown mouse input type."); break; } } }
开发者ID:doveiya,项目名称:isilme,代码行数:34,
示例20: switch int SDLInput::convertMouseButton(int button) { switch (button) { case SDL_BUTTON_LEFT: return MouseInput::LEFT; break; case SDL_BUTTON_RIGHT: return MouseInput::RIGHT; break; case SDL_BUTTON_MIDDLE: return MouseInput::MIDDLE; break; case SDL_BUTTON_WHEELUP: return MouseInput::WHEEL_UP; break; case SDL_BUTTON_WHEELDOWN: return MouseInput::WHEEL_DOWN; break; } throw GCN_EXCEPTION("Unknown SDL mouse type."); return 0; }
开发者ID:scpanda2007,项目名称:visocplus,代码行数:25,
示例21: GCN_EXCEPTION void OGLFTFont::drawString(gcn::Graphics* graphics, const std::string& text, int x, int y) { if (text == "") { return; } gcn::OpenGLGraphics* glGraphics = dynamic_cast<gcn::OpenGLGraphics *>(graphics); if(glGraphics == NULL) { throw GCN_EXCEPTION("Graphics object not an OpenGL graphics object!"); } const gcn::ClipRectangle& top = glGraphics->getCurrentClipArea(); mFont->setForegroundColor(mFontColor.r/255, mFontColor.g/255, mFontColor.b/255); glPushMatrix(); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glTranslated(x + top.xOffset, y + top.yOffset + (mSize/2)+5, 0.); glRotatef(180., 1., 0., 0.); mFont->draw(text.c_str()); glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); glPopMatrix(); }
开发者ID:IamusNavarathna,项目名称:lv3proj,代码行数:32,
示例22: GCN_EXCEPTION const ClipRectangle& Graphics::getCurrentClipArea() { if (mClipStack.empty()) throw GCN_EXCEPTION("The clip area stack is empty."); return mClipStack.top(); }
开发者ID:Evonline,项目名称:ManaPlus,代码行数:7,
示例23: mTextRenderer OpenLayerTTFont::OpenLayerTTFont(const std::string& filename, int width, int height) : mTextRenderer(filename.c_str(), width, height) { if (!mTextRenderer.IsValid()) { throw GCN_EXCEPTION("Unable to load font."); } }
开发者ID:IamusNavarathna,项目名称:lv3proj,代码行数:8,
示例24: GCN_EXCEPTION void Widget::requestModalMouseInputFocus() { if (mFocusHandler == NULL) { throw GCN_EXCEPTION("No focushandler set (did you add the widget to the gui?)."); } mFocusHandler->requestModalMouseInputFocus(this); }
开发者ID:weimingtom,项目名称:db-speedhack07,代码行数:9,
注:本文中的GCN_EXCEPTION函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GCServerMsgStringSend函数代码示例 C++ GCD函数代码示例 |