示例#1
0
Lines::Lines(QWidget *parent)
	: QWidget(parent)
{
	 this->parent = parent;

	 /*Create Serial Object*/
	 try{
		this->wunder =  new SimpleSerial("COM3", BAUD);
	 }catch(boost::system::system_error& e){
		std::cerr<<tmp<<": Error: "<<std::endl;//<<e.what()<<std::endl;
	 }

	 /*Create centered paddle. Draw with translated */
	 this->paddle = new QRect ((Xcenter - (paddle_width / 2)), (Ypaddle - (paddle_height /2)), paddle_width, paddle_height);
	 this->paddletranslated = new QRect();
	 this->leftboundary = new QRect(0, 0, 30 , 600);
	 this->topboundary = new QRect(0, 0, 800, 30);
	 this->rightboundary = new QRect(770, 0 , 30, 800);
	 this->bottomboundary = new QRect(0, 550, 800, 30);

	 this->invisible = new QColor(0,0,0,0);
	 this->ball = new Ball();
	 this->timer = new QTimer(this);

	 this->ball->speed = 21;
	 this->ball->xdirection = LEFT;
	 this->ball->ydirection = DOWN;

	 QObject::connect(timer, SIGNAL(timeout()), this->ball, SLOT(move()));
	 timer->start(5); //Move ball every 5 milliseconds

	 createBlocks();
}
InnerWidget::InnerWidget(QWidget *parent, PeerData *peer) : TWidget(parent)
, _peer(peer)
, _cover(this, peer) {
	setAttribute(Qt::WA_OpaquePaintEvent);

	createBlocks();
}
示例#3
0
void City::generate()
{
  createPrimaryRoadNetwork();
  createZones();
  createSecondaryRoadNetwork();
  createBlocks();
  createBuildings();
}
示例#4
0
TetrisPiece::TetrisPiece(TetrisPieceType type, glm::vec3 position) {
	m_previous_mov = -1;
	m_type = type;
	m_frame.setCenter(glm::vec3());
	createBlocks();
	setPosition(position);
	m_rotated_angle = 0;
	m_current_rotation = 0;
}
示例#5
0
文件: cfg.cpp 项目: Fininvest/hhvm
/**
 * Create all blocks and edges for one Func.
 */
Graph* GraphBuilder::build() {
  assert(!funcInstrs(m_func).empty());
  m_graph = new (m_arena) Graph();
  createBlocks();
  createExBlocks();
  linkBlocks();
  linkExBlocks();
  return m_graph;
}
bool
ChildlessUnaryOpIlInjector::injectIL()
   {
   if (!isOpCodeSupported())
      return false;

   createBlocks(1);
   returnValue(parm(1));

   return true;
   }
示例#7
0
文件: Block.cpp 项目: sbimbra/tetris
void Block::init()
{
	myImage = 0;
	redrawMe = true;
	rotationIndex = 0;
	gridX = 4;
	gridY = 0;
	worldX = 5 + gridX*30;
	worldY = 0;
	createBlocks();
	drawBlock();
}
示例#8
0
void GameScreen::restartLevel()
{
    delete gameWonLbl;
    delete saveAndQuitBtn;
    delete restartBtn;
    delete mainMenuBtn;
    delete nextLvlBtn;
    delete ball;
    delete paddle;

    spacePressed = false;

    createBlocks();
    createPaddle();
    createBall();
}
示例#9
0
void GameScreen::restartLevel(int i)
{
    if (i == 1) { }
    else
    {
        delete gameWonLbl;
        delete saveAndQuitBtn;
        delete restartBtn;
        delete mainMenuBtn;
        delete nextLvlBtn;
        delete ball;
        delete paddle;

        createBlocks();
        createPaddle();
        createBall();
    }
}
示例#10
0
GameScreen::GameScreen(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::GameScreen)
{
    ui->setupUi(this);
    tmp = new QMainWindow(this);
    paddleIcon = new QPixmap("C:/Users/TAYLOR/Documents/C++ Files/BrickBreak/paddle.png");
    ballIcon = new QPixmap("C:/Users/TAYLOR/Documents/C++ Files/BrickBreak/white_ball.png");
    gameOverIcon = new QPixmap("C:/Users/TAYLOR/Documents/C++ Files/BrickBreak/gameover.png");
    gameOverlay = new QPixmap("C:/Users/TAYLOR/Documents/C++ Files/BrickBreak/background.jpg");
    gameWonIcon = new QPixmap("C:/Users/TAYLOR/Documents/C++ Files/BrickBreak/youwin.jpg");
    overlayLbl = new QLabel(this);
    overlayLbl->setPixmap(*gameOverlay);
    overlayLbl->setGeometry(0, ui->menuBar->height(), this->width() - (this->width() - ui->rightLine->pos().x()), this->height() - (this->height() - ui->bottomLine->pos().y()));

    connect(this, SIGNAL(eventTriggered(QString)), this, SLOT(writeEvent(QString)));
    connect(this, SIGNAL(gameEnded()), this, SLOT(gameOver()));

    diff = EASY;
    level = 1;
    newLevel(level);
    createActions();
    createMenus();
    createPaddle();
    createBall();
    numLives = 3;

    time = new Timer(this, "time");
    connect(time, SIGNAL(timeout()), this, SLOT(decrementTimer()));
    cheatModeActive = false;
    spacePressed = false;
    score = 0;
    createBlocks();
    eventLogFullSizePos = new QPoint(310, 10);
    eventLogHalfSizePos = new QPoint(310, 200);
    hideCheatMode();
    setLivesText(numLives);
    setTimeText(timeLeft);
    setLevelText(level);
    setScoreText(score);
}
示例#11
0
void BBHandleLayer::initSprite()
{
    m_testLayer = LayerColor::create(Color4B(255, 0, 0, 255), 10, 10);
    addChild(m_testLayer);
    
    createHandleBg();
    
    createIdleBlock();

    createBlocks();
    
    addEventListener();
    
    m_testLayer->setPosition(Point(m_relativeX, m_relativeY));
    
    NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(BBHandleLayer::showTips), "kShowTips", NULL);
    
    if (BBGameDataManager::getInstance()->getScreenScale() != 2) {
        GameCenterApi::getInstance()->hiddenAdBanner();
    }
}