void UIRectangle::outlineRounded( float rad) { setCol( _border[UI_BASE]); if ( _selected ) setCol( _border[UI_SEL]); else if ( _hover ) setCol( _border[UI_HOVER]); glBegin( GL_LINE_LOOP); roundVerts( rad); glEnd( ); }
void UIRectangle::outlineQuad( ) { setCol( _border[UI_BASE]); if ( _selected ) setCol( _border[UI_SEL]); else if ( _hover ) setCol( _border[UI_HOVER]); glBegin( GL_LINE_LOOP); quadVerts( ); glEnd( ); }
void UIRectangle::hLine( ) { setCol(_bg[UI_BASE]); if ( _selected ) setCol(_bg[UI_SEL]); else if ( _hover ) setCol(_bg[UI_HOVER]); glBegin(GL_LINES); glVertex2d( tl[0], 0.5 * ( tl[1]+br[1]) ); glVertex2d( br[0], 0.5 * ( tl[1]+br[1]) ); glEnd(); }
void UIRectangle::filledRounded( float rad) { setCol( _bg[UI_BASE]); if ( _selected ) setCol( _bg[UI_SEL]); else if ( _hover ) setCol( _bg[UI_HOVER]); glBegin( GL_POLYGON); roundVerts( rad); glEnd( ); }
void UIRectangle::filledQuad( ) { setCol( _bg[UI_BASE]); if ( _selected ) setCol( _bg[UI_SEL]); else if ( _hover ) setCol( _bg[UI_HOVER]); glBegin( GL_QUADS); quadVerts( ); glEnd( ); }
Matrix2f::Matrix2f( const Vector2f& v0, const Vector2f& v1, bool setColumns ) { if( setColumns ) { setCol( 0, v0 ); setCol( 1, v1 ); } else { setRow( 0, v0 ); setRow( 1, v1 ); } }
Matrix3f::Matrix3f( const Vector3f& v0, const Vector3f& v1, const Vector3f& v2, bool setColumns ) { if( setColumns ) { setCol( 0, v0 ); setCol( 1, v1 ); setCol( 2, v2 ); } else { setRow( 0, v0 ); setRow( 1, v1 ); setRow( 2, v2 ); } }
void Grid::extendLeft() { int r,c,i; for ( c = 1; c < ncols; c++ ) { for ( r = 0; r < nrows; r++ ) { QWidget* w = cell( r, c ); if ( !w ) continue; int cc = countCol( r, c); int stretch = 0; for ( i = c-1; i >= 0; i-- ) { if ( cell( r, i ) ) break; if ( countCol( r, i ) < cc ) break; if ( isWidgetEndCol( i ) ) break; if ( isWidgetStartCol( i ) ) { stretch = c - i; break; } } if ( stretch ) { for ( i = 0; i < stretch; i++ ) setCol( r, c-i-1, w, cc ); } } } }
void IconImpl::read(Reader &input) { setIcon(input.read<int>()); setCol(input.read<int>()); setRow(input.read<int>()); setNr(input.read<int>()); }
void Grid::extendRight() { int r,c,i; for ( c = ncols - 2; c >= 0; c-- ) { for ( r = 0; r < nrows; r++ ) { QWidget* w = cell( r, c ); if ( !w ) continue; int cc = countCol( r, c); int stretch = 0; for ( i = c+1; i < ncols; i++ ) { if ( cell( r, i ) ) break; if ( countCol( r, i ) < cc ) break; if ( isWidgetStartCol( i ) ) break; if ( isWidgetEndCol( i ) ) { stretch = i - c; break; } } if ( stretch ) { for ( i = 0; i < stretch; i++ ) setCol( r, c+i+1, w, cc ); } } } }
void TFT::drawVerticalLine( INT16U poX, INT16U poY, INT16U length,INT16U color) { setCol(poX,poX); setPage(poY,poY+length); sendCMD(0x2c); for(int i=0; i<length; i++) sendData(color); }
Matrix4f::Matrix4f( const Vector4f& v0, const Vector4f& v1, const Vector4f& v2, const Vector4f& v3, bool setColumns ) { if( setColumns ) { setCol( 0, v0 ); setCol( 1, v1 ); setCol( 2, v2 ); setCol( 3, v3 ); } else { setRow( 0, v0 ); setRow( 1, v1 ); setRow( 2, v2 ); setRow( 3, v3 ); } }
IconImpl::IconImpl(int icon,int col,int row,int nr) { setDefaults(); setIcon(icon); setCol(col); setRow(row); setNr(nr); }
void lcd128x64update (void) { int line, x, y, fbLoc ; unsigned char byte ; // Left side for (line = 0 ; line < 8 ; ++line) { setCol (0, CS1) ; setLine (line, CS1) ; for (x = 63 ; x >= 0 ; --x) { byte = 0 ; for (y = 0 ; y < 8 ; ++y) { fbLoc = x + (((7 - line) * 8) + (7 - y)) * LCD_WIDTH ; if (frameBuffer [fbLoc] != 0) byte |= (1 << y) ; } sendData (byte, CS1) ; } } // Right side for (line = 0 ; line < 8 ; ++line) { setCol (0, CS2) ; setLine (line, CS2) ; for (x = 127 ; x >= 64 ; --x) { byte = 0 ; for (y = 0 ; y < 8 ; ++y) { fbLoc = x + (((7 - line) * 8) + (7 - y)) * LCD_WIDTH ; if (frameBuffer [fbLoc] != 0) byte |= (1 << y) ; } sendData (byte, CS2) ; } } }
void CGen::process () { // Creating header and implementation files openFile(H, ctx().baseName() + ".h"); openFile(C, ctx().baseName() + ".c"); Templ h(templ()), c(templ()); file(H) << h.str("h/header") << std::endl << std::endl; file(C) << c.str("c/header") << std::endl << std::endl << c.str("c/str-api") << std::endl << std::endl; if (ctx().cacheLimit() > 0) file(C) << c.str("c/cache-api") << std::endl << std::endl; h.load("h/tab"); c.load("c/tab-id"); BOOST_FOREACH(const meta::Tab &tab, db().tabs()) { setTab(tab.name()); file(H) << h.str() << std::endl << std::endl; file(C) << c.str() << std::endl; Templ h2(h), c2(c); BOOST_FOREACH(const meta::Col &col, tab.cols()) { setCol(col.name()); file(H) << h2.str("h/col") << std::endl; file(C) << c2.str("c/col-id") << std::endl; if (col.nullable()) file(H) << h2.str("h/col-null") << std::endl; switch (col.type()) { case meta::TYPE_INT: file(H) << h2.str("h/col-int") << std::endl; break; case meta::TYPE_REAL: file(H) << h2.str("h/col-real") << std::endl; break; case meta::TYPE_TEXT: file(H) << h2.str("h/col-text") << std::endl; break; case meta::TYPE_BLOB: file(H) << h2.str("h/col-blob") << std::endl; break; } file(H) << std::endl; file(C) << std::endl; } } file(H) << h.str("h/footer") << std::endl; }
caDoubleTabWidget::caDoubleTabWidget(QWidget *parent) : QWidget(parent) { row = 0; col = 0; vCount = 0; tableIndex = new QLineEdit("empty"); // create horizontal bar, vertical buttongroup and a stacked widget hTabBar = new QTabBar; viewPort = new QStackedWidget; viewPort->setFrameShape(QFrame::Panel); vTabBar = new QButtonGroup; buttonLayout = new QVBoxLayout(); buttonLayout->setSpacing(0); QVBoxLayout* buttonStretchLayout = new QVBoxLayout(); buttonStretchLayout->setSpacing(0); buttonStretchLayout->addLayout(buttonLayout); buttonStretchLayout->addStretch(); // make layout and add the widgets QGridLayout *gridLayout = new QGridLayout(this); gridLayout->addWidget(hTabBar, 0, 1, 1, 1); gridLayout->addLayout(buttonStretchLayout, 1, 0, 1, 1); gridLayout->addWidget(viewPort, 1, 1, 1, 1); gridLayout->addWidget(tableIndex, 2, 1, 1, 1); hTabBar->setShape(QTabBar::TriangularNorth); hTabBar->setExpanding(true); // size policy viewPort->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); hTabBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); // signal /slots connect(hTabBar, SIGNAL(currentChanged(int)), SLOT(setCol(int))); connect(vTabBar, SIGNAL(buttonClicked(int)), this, SLOT(setRow(int))); // add items to our bar and list thisVerItems.clear(); thisHorItems.clear(); addSampleWidget(0); addSampleWidget(1); addPages = false; // colorize horizontal bar QPalette pal = hTabBar->palette(); pal.setColor(QPalette::Base, QColor(255, 0, 255)); hTabBar->setPalette(pal); setRow(0); setCol(0); installEventFilter(this); }
void UIRectangle::bubbleQuad( ) { Point2D hilite = ( tl * 0.67 ) + ( br * 0.33 ); glBegin( GL_TRIANGLE_FAN); glColor3d ( 1.0, 1.0 , 1.0 ); glVertex2d( hilite[0], hilite[1]); setCol( _bg[UI_BASE]); if ( _selected ) setCol( _bg[UI_SEL]); else if ( _hover ) setCol( _bg[UI_HOVER]); quadVerts( ); glEnd( ); }
void TFT::setXY(unsigned int poX, unsigned int poY) { if(poX >239)poX = 239; if(poY >319)poY = 319; setCol(poX, poX); setPage(poY, poY); sendCMD(0x2c); }
//alternative constructor that determines team based on an int Developer::Developer (int rowIn, int colIn, int colorIn) { if (colorIn == 0) player = GREEN; if (colorIn == 1) player = YELLOW; setRow (rowIn); setCol (colIn); pieceType = 6; }
void UIRectangle::bubbleRounded( float rad ) { Point2D hilite = ( tl * 0.67 ) + ( br * 0.33 ); glBegin( GL_TRIANGLE_FAN); glColor3d ( 1.0, 1.0 , 1.0 ); glVertex2d( hilite[0], hilite[1]); setCol( _bg[UI_BASE]); if ( _selected ) setCol( _bg[UI_SEL]); else if ( _hover ) setCol( _bg[UI_HOVER]); roundVerts( rad); double r = ( rad > 0 ) ? rad : 0.5 * min ( h( ), w( )); Point2D first = tl - Point2D( 0 , r ) ; glVertex2d( first[0], first[1]); glEnd( ); }
void TFT::drawVerticalLine( unsigned int poX, unsigned int poY, unsigned int length,unsigned int color) { setCol(poX, poX); setPage(poY, poY+length-1); sendCMD(0x2c); for(int i=0; i<length; i++) { sendData(color); } }
void _showMatrix() { static uint8_t column=0; //ledOn(); //_ms_delay(1); //ledOff(); setRowPattern(DisplayMem[column]); //setRows(column+1); //ledOn(); setCol(column); //ledOff(); column++; if(column>=NUMCOLUMNS)column=0; //if(column>=3)column=0; }
// add page void caDoubleTabWidget::addPage(QWidget *page) { PRINT(printf("add a new page %s\n", qasc(page->objectName()))); QStringList stringlist = page->objectName().split( "_"); if(stringlist.count() > 1 ) { row= stringlist[1].toInt(); col = stringlist[2].toInt(); } else { row = 0; col = 0; } addPages = true; insertPage(count(), page); addPages = false; setRow(0); setCol(0); }
void GameScene::normalBombHandler(cocos2d::Ref *pSender) { auto manager = GameManager::getInstance(); if(manager->getBombNum()==0) { return; } auto player = manager->getPlayer(); auto coordinate = player->getCoordinate(); auto tile = MapUtil::getInstance()->getMapObjectFromBombVector(MapUtil::getInstance()->getBomb(), coordinate); if(tile&&dynamic_cast<Bomb*>(tile)) { return; } auto bomb = Bomb::create(Bomb::kBombNormal); bomb->setZOrder(0); bomb->setCol(coordinate.x); bomb->setRow(coordinate.y); bomb->setAnchorPoint(Point(0.5f,0.0f)); bomb->setPosition(player->convertCoordinate2Point(coordinate)); GameManager::getInstance()->getMapTileLayer()->addChild(bomb); }
// remove a viewport void caDoubleTabWidget::removePage(int index) { int pageIndex = 0; PRINT(printf("we have to remove the page from array for row=%d col=%d\n", row, col)); if((pageIndex =lookupArrayIndex(row, col)) != -1) { // delete this stackwidget page from the array deleteArrayIndex(pageIndex); QWidget *widget = viewPort->widget(index); PRINT(printf("remove widget at stacked widget index=%d with name=%s\n", index, qasc(widget->objectName()))); viewPort->removeWidget(widget); setRow(row); setCol(col); // now that we deleted a page of the stackwidget we will have to change are lookup array // after the deleted page, change key to key -1 QMap<int, twoInts> lookupNew; QMapIterator<int, twoInts> j(lookup); while (j.hasNext()) { j.next(); twoInts item; item.r = j.value().r; item.c = j.value().c; if(j.key() > pageIndex) { lookupNew.insert(j.key()-1, item); } else { lookupNew.insert(j.key(), item); } } // and copy it back lookup = lookupNew; lookupNew.detach(); } else { PRINT(printf("page not found, return\n")); return; } }
void PathStep::InitWithIndex(int row, int col) { setRow(row); setCol(col); }
void TFT::setXY(INT16U poX, INT16U poY) { setCol(poX, poX); setPage(poY, poY); sendCMD(0x2c); }
// Matrix: set all columns void Matrix::setCols( const vector< double >& v ) { for ( int j = 0; j < data->size2; j++ ) setCol( j, v ); }
void ColorLuminancePicker::setCol(int h, int s) { setCol(h, s, val_); emit newHsv(h, s, val_); }
Pacman::Pacman(int row, int col) { setRow(row); setCol(col); }