bool Visualizer::onDisplay() { glViewport(0, 0, mWidth, mHeight); glClearColor(1, 1, 1, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_LINE_SMOOTH); glEnable(GL_POINT_SMOOTH); glEnable(GL_POLYGON_SMOOTH); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-mWidth*1.0/mHeight, mWidth*1.0/mHeight, -1, 1, -1, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); if (mRepeater->getState() != Repeater::S_STARTUP) { drawHistory(); } drawBanner(); glutSwapBuffers(); return mRepeater->getState() == Repeater::S_GONE; }
void MainWindow::createActions() { //////////////////////////////////////////////////////////////////////////// // akcje menu File newAction = new QAction(tr("&New *.turtle"), this); newAction->setIcon(QIcon(":/images/new.png")); newAction->setShortcut(QKeySequence::New); newAction->setStatusTip(tr("Create a new turtle file")); connect(newAction, SIGNAL(triggered()), this, SLOT(newFile())); openAction = new QAction(tr("&Open *.turtle"), this); openAction->setIcon(QIcon(":/images/open.png")); openAction->setShortcut(QKeySequence::Open); openAction->setStatusTip(tr("Open an existing turtle command file")); connect(openAction, SIGNAL(triggered()), this, SLOT(open())); saveCmdAction = new QAction(tr("&Save *.turtle"), this); saveCmdAction->setIcon(QIcon(":/images/save.png")); saveCmdAction->setShortcut(QKeySequence::Save); saveCmdAction->setStatusTip(tr("Save turtle commands to file")); connect(saveCmdAction, SIGNAL(triggered()), this, SLOT(saveCmd())); saveImgAction = new QAction(tr("Save *.jpg"), this); saveImgAction->setStatusTip(tr("Save board as JPG file")); connect(saveImgAction, SIGNAL(triggered()), this, SLOT(saveImg())); exitAction = new QAction(tr("E&xit"), this); exitAction->setShortcut(tr("Ctrl+Q")); exitAction->setStatusTip(tr("Exit the application")); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); //////////////////////////////////////////////////////////////////////////// // akcje menu Edit clearBoardAction = new QAction(tr("Clear board"), this); clearBoardAction->setStatusTip(tr("Clears drawing board")); connect(clearBoardAction, SIGNAL(triggered()), this, SLOT(clearAll())); drawHistoryAction = new QAction(tr("Draw history"), this); drawHistoryAction->setStatusTip(tr("Draws commands history")); connect(drawHistoryAction, SIGNAL(triggered()), this, SLOT(drawHistory())); //////////////////////////////////////////////////////////////////////////// // akcje menu Help //////////////////////////////////////////////////////////////////////////// // zad 2: aboutAction = new QAction(tr("&Commands"), this); aboutAction->setStatusTip(tr("Show the application's About box")); connect(aboutAction, SIGNAL(triggered()), this, SLOT(about())); aboutQtAction = new QAction(tr("About &Qt"), this); aboutQtAction->setStatusTip(tr("Show the Qt library's About box")); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); }