void TextField::setSample(const char* sample) { sample_ = sample; if (sample_.empty()) { sminx = sminy = smaxx = smaxy = 0; createGraphics(); return; } graphicsBase_.clear(); FontBase::TextLayoutParameters empty; FontBase::TextLayout l; font_->drawText(&graphicsBase_, sample, r_, g_, b_, a_, &empty, false, 0, 0, l); float minx, miny, maxx, maxy; minx = 1e30; miny = 1e30; maxx = -1e30; maxy = -1e30; for (std::vector<GraphicsBase>::iterator it=graphicsBase_.begin();it!=graphicsBase_.end();it++) { float lminx_, lminy_, lmaxx_, lmaxy_; (*it).getBounds(&lminx_, &lminy_, &lmaxx_, &lmaxy_); minx = std::min(minx, lminx_); miny = std::min(miny, lminy_); maxx = std::max(maxx, lmaxx_); maxy = std::max(maxy, lmaxy_); } sminx = (int) minx; sminy = (int) miny; smaxx = (int) maxx; smaxy = (int) maxy; createGraphics(); }
void xsCanvasContext::lineTo(float x, float y) { if(XS_FALSE == beginFlag) { beginFlag = XS_TRUE; lastX = x; lastY = y; beginX = x; beginY = y; createGraphics(); return; } xsLine *line = static_cast<xsLine *>(xsLine::createInstance()); line->x1 = lastX; line->y1 = lastY; line->x2 = x; line->y2 = y; line->color = strokeColor; line->width = lineWidth > 1.0 ? lineWidth : 1.0; addLine(line); lastX = x; lastY = y; }
Powerline_RateShowDlg::Powerline_RateShowDlg(QWidget *parent) : QDialog(parent) ,ui(new Ui::Powerline_RateShowDlg) ,m_scene(NULL) ,m_bMove(false) ,m_TopEdge(NULL) ,m_TopNode(NULL) ,m_flags(0) ,m_isPowerlineShow(false) ,m_prevPageBtnState(BTNSTATE_NORMAL) ,m_nextPageBtnState(BTNSTATE_NORMAL) ,m_totalPage(0) ,m_curPageIdx(1) /*,m_pPLDev(NULL)*/ { ui->setupUi(this); createGraphics(); initSlot(); createControlPannel(); initStyle(); initLanguage(); #ifdef TEST_PL_CODE ui->prevPageBtn->setFlat(false); ui->nextPageBtn->setFlat(false); #endif }
Graphics *Configurator::graphics() { if(m_pGraphics == 0) createGraphics(m_graphicsName); return m_pGraphics; }
void TextField::setLayout(FontBase::TextLayoutParameters *l) { if (l) { layout_=*l; createGraphics(); } }
void TextField::setText(const char* text) { if (strcmp(text, text_.c_str()) == 0) return; text_ = text; createGraphics(); }
void GameArena::setMap(MapClient *newMap) { clear(); map = newMap; width = map->getWidth(); height = map->getHeight(); maxNbPlayers = map->getMaxNbPlayers(); squaresItem = new QGraphicsSquareItem*[width * height]; for(int i = 0; i < width; i++) { for(int j = 0; j < height; j++) { initCase(i,j); getCase(i,j)->setItem(pixmaps.getPixmap(map->getType(i,j))); if(map->getOption(i,j) != BlockMapProperty::none) { //add this option on the map. It won't be removed or changed during the game. QGraphicsSquareItem* optItem = new QGraphicsSquareItem(i * squareSize,j * squareSize,squareSize); optItem->setItem(pixmaps.getPixmap(map->getOption(i,j), map->getOptionDirection(i,j))); scene->addItem(optItem); optionsItems << optItem; } } } qint16 x,y; for(int i = 0; i < map->getNbPlayers(); i++) { map->getPlayerPosition(i,x,y); QPlayer *p = new QPlayer(i); playersItem.append(p); p->setPos(x-squareSize/2,y-squareSize/2,squareSize); scene->addItem(p); emit sigNewPlayerGraphic(i,*p->getPlayerPixmap()); } connect(map, SIGNAL(sigBlockChanged(int)), this, SLOT(blockChanged(int))); connect(map, SIGNAL(sigBlockChanged(int,int)), this, SLOT(blockChanged(int,int))); connect(map, SIGNAL(sigHeartbeatUpdated(qint32)), this, SLOT(slotHearbeatUpdated(qint32))); connect(map, SIGNAL(sigMovePlayer(int, int, int, int)), this, SLOT(movePlayer(int, int, int, int))); connect(map, SIGNAL(sigPlayerSickChanged(int, bool)), this, SLOT(slotPlayerSickChanged(int, bool))); connect(map, SIGNAL(sigKillPlayer(int)), this, SLOT(killPlayer(int))); connect(map, SIGNAL(sigAddBonus(Bonus::Bonus_t,qint16,qint16)), this, SLOT(slotAddBonus(Bonus::Bonus_t,qint16,qint16))); connect(map, SIGNAL(sigRemoveBonus(qint16,qint16)), this, SLOT(slotRemoveBonus(qint16,qint16))); connect(map, SIGNAL(sigAddBomb(int)), this, SLOT(slotAddBomb(int)), Qt::DirectConnection); connect(map, SIGNAL(sigMovedBomb(int)), this, SLOT(slotMovedBomb(int)), Qt::DirectConnection); connect(map, SIGNAL(sigFlyingBomb(int,qint32)), this, SLOT(slotFlyingBomb(int,qint32)), Qt::DirectConnection); connect(map, SIGNAL(sigRemoveBomb(int)), this, SLOT(slotRemoveBomb(int)), Qt::DirectConnection); connect(map, SIGNAL(sigRemoveBombRC(int)), this, SLOT(slotRemoveBombRC(int)), Qt::DirectConnection); connect(map, SIGNAL(sigAddFlame(int,qint16,qint16)), this, SLOT(slotAddFlame(int,qint16,qint16))); connect(map, SIGNAL(sigRemoveFlame(int)), this, SLOT(slotRemoveFlame(int))); createGraphics(); }
void xsCanvasContext::moveTo(float x, float y) { beginFlag = XS_TRUE;; lastX = x; lastY = y; beginX = x; beginY = y; createGraphics(); }
void TextField::doDraw(const CurrentTransform&, float sx, float sy, float ex, float ey) { G_UNUSED(sx); G_UNUSED(sy); G_UNUSED(ex); G_UNUSED(ey); if (scaleChanged()) createGraphics(); for (std::vector<GraphicsBase>::iterator it=graphicsBase_.begin();it!=graphicsBase_.end();it++) (*it).draw(shader_); }
NodeGraphic::NodeGraphic(void) { mpGraphics = NULL; mpNode = NULL; if (createGraphics()) { mpNode = mpsSceneMgr->getRootSceneNode()->createChildSceneNode("NodeGraphic_" + Ogre::StringConverter::toString(msCounter)); mpNode->attachObject(mpGraphics); msCounter++; } }
void TextField::setFont(FontBase *font) { if (font->getType() == FontBase::eTTFont) return; if (font_ == font) return; if (font != 0) font->ref(); if (font_ != 0) font_->unref(); font_ = static_cast<BMFontBase*>(font); createGraphics(); }
void TextField::setTextColor(unsigned int color) { textColor_ = color; int a = (color >> 24) & 0xff; int r = (color >> 16) & 0xff; int g = (color >> 8) & 0xff; int b = color & 0xff; a_ = a / 255.f; r_ = r / 255.f; g_ = g / 255.f; b_ = b / 255.f; createGraphics(); }
TowerBase::TowerBase(int row, int col, bool passable) { mRow = row; mCol = col; mPassable = passable; mpGraphics = NULL; mpNode = NULL; mpTower = NULL; if (createGraphics()) { mpNode = mpsSceneMgr->getRootSceneNode()->createChildSceneNode("TowerBaseNode_" + Ogre::StringConverter::toString(msCounter)); mpNode->attachObject(mpGraphics); mpNode->setPosition(centerPosFromCoords(mRow, mCol)); msCounter++; } }
void xsCanvasContext::rect(float x, float y, float width, float height) { beginFlag = XS_TRUE; lastX = x; lastY = y; beginX = x; beginY = y; createGraphics(); xsRectangle *rect = static_cast<xsRectangle *>(xsRectangle::createInstance()); rect ->x = x; rect ->y = y; rect ->width = width; rect ->height = height; rect ->lineWidth = lineWidth > 1.0 ? lineWidth : 1.0; rect ->fillColor = fillColor; rect ->strokeColor = strokeColor; addRect(rect); }
void TextField::setLetterSpacing(float letterSpacing) { layout_.letterSpacing = letterSpacing; createGraphics(); }