// ------------------------------------------------------- // build level // ------------------------------------------------------- void Grid::buildLevel(int level) { clear(); if (level >= 0 && level < _levelDefinitions.size()) { const LevelDefinition& def = _levelDefinitions.get(level); createNewLine(def.newBricks); for (int i = 0; i < def.startRows; ++i) { moveDown(); createNewLine(def.newBricks); } _rowsLeft = def.totalRows; _moveTimer = 0.0f; _moveDelay = def.moveDelay; } }
void ConsoleLineBuffer::clear() { beginResetModel(); list_.clear(); createNewLine(); endResetModel(); }
// ------------------------------------------------------- // tick // ------------------------------------------------------- bool Grid::tick(float dt) { bool ret = true; _moveTimer += dt; if (_moveTimer >= _moveDelay) { _moveTimer = 0.0f; ret = moveDown(); if (ret) { if (_rowsLeft > 1) { createNewLine(4); } if (_rowsLeft > 0) { --_rowsLeft; } } } return ret; }
//============================================================================= sstQt01PathPaintWidgetCls::sstQt01PathPaintWidgetCls(sstMisc01PrtFilCls *poTmpPrt, sstQt01PathStoreViewCls *poTmpPathStorage) { Q_INIT_RESOURCE(tooltips); if (poTmpPathStorage == NULL) assert (0); if (poTmpPathStorage->countItems() <= 0) assert(0); this->oPathStorage = poTmpPathStorage; this->poPrt = poTmpPrt; setMouseTracking(true); setBackgroundRole(QPalette::Base); newCircleButton = createToolButton(tr("New Circle"), QIcon(":/images/circle.png"), SLOT(createNewCircle())); newSquareButton = createToolButton(tr("New Square"), QIcon(":/images/square.png"), SLOT(createNewSquare())); newTriangleButton = createToolButton(tr("New Triangle"), QIcon(":/images/triangle.png"), SLOT(createNewTriangle())); newLineButton = createToolButton(tr("New Line"), QIcon(":/images/line.png"), SLOT(createNewLine())); newPolyLineButton = createToolButton(tr("New PolyLine"), QIcon(":/images/polyline.png"), SLOT(createNewPolyLine())); newArcButton = createToolButton(tr("New Arc"), QIcon(":/images/arc.png"), SLOT(createNewArc())); newTextButton = createToolButton(tr("New Text"), QIcon(":/images/text.png"), SLOT(createNewText())); //============================================================================= // Create item templates circlePath.addEllipse(QRect(0, 0, 100, 100)); squarePath.addRect(QRect(0, 0, 100, 100)); qreal x = trianglePath.currentPosition().x(); qreal y = trianglePath.currentPosition().y(); trianglePath.moveTo(x + 120 / 2, y); trianglePath.lineTo(0, 100); trianglePath.lineTo(120, 100); trianglePath.lineTo(x + 120 / 2, y); linePath.moveTo( 0, 0); linePath.lineTo(100, 100); polylinePath.moveTo( 0, 0); polylinePath.lineTo(25, 75); polylinePath.lineTo(100, 100); // arcPath.moveTo( 150, 150); QRect oRect(100,100,200,200); arcPath.arcMoveTo(oRect,0); arcPath.arcTo(oRect,0,45); QFont oFont; oFont.setPointSize(50); // oFont.s QString oQStr = "A"; textPath.moveTo( 0, 0); textPath.addText(50,50,oFont,oQStr); //============================================================================= setWindowTitle(tr("Tool Tips")); this->setMinimumSize(350,350); // Get Size for 7 Buttons iActualItemIndex = 0; iItemInMotionIndex = 0; }