コード例 #1
0
ファイル: ofVboMesh.cpp プロジェクト: imclab/24HourMusic
//--------------------------------------------------------------
void ofVboMesh::update(){	
	if(meshElement->haveVertsChanged()){
		setupVertices(drawType);
		//vbo.updateVertexData(meshElement->getVerticesPointer(), meshElement->getNumVertices());
	}
	
	if(meshElement->haveColorsChanged()){
		setupColors(drawType);
		//vbo.updateColorData(meshElement->getColorsPointer(), meshElement->getNumColors());
	}
	
	if(meshElement->haveNormalsChanged()){
		setupNormals(drawType);
		//vbo.updateNormalData(meshElement->getNormalsPointer(), meshElement->getNumNormals());
	}
	
	if(meshElement->haveTexCoordsChanged()){
		setupTexCoords(drawType);
		//vbo.updateTexCoordData(meshElement->getTexCoordsPointer(), meshElement->getNumTexCoords());
	}	
	
	if(meshElement->haveIndicesChanged() && bUseIndices){
		setupIndices(drawType);
		//vbo.setIndexData(meshElement->getIndexPointer(),meshElement->getNumIndices());
		//vbo.updateIndexData(meshElement->getIndexPointer(),meshElement->getNumIndices());
	}
}
コード例 #2
0
ファイル: tetris.c プロジェクト: mabruraas/tetris
void createFrame()
{
	noecho();
	cbreak();
	initscr();
	start_color();
	setupColors();
	curs_set(FALSE);
	srand(time(NULL));
	keypad(stdscr, TRUE);
	nodelay(stdscr, TRUE);
}
コード例 #3
0
PreferencesDialog::PreferencesDialog(QWidget* parent) :
	QDialog(parent),
	ui(new Ui::Preferences)
{
	ui->setupUi(this);

	//TODO for now don't display the
	//preferences categories.
	ui->listWidget->hide();
	setupColors();
	setupButtons();
}
コード例 #4
0
ファイル: widget.cpp プロジェクト: ptrxyz/twmn
void Widget::onPrevious()
{
    m_visible.start();
    if (m_previousStack.size() < 1)
        return;
    Message m = m_previousStack.pop();
    m_messageQueue.push_front(m);
    loadDefaults();
    setupFont();
    setupColors();
    setupIcon();
    setupTitle();
    setupContent();
    connectForPosition(m_messageQueue.front().data["pos"]->toString());
    updateFinalWidth();
}
コード例 #5
0
ファイル: ofVboMesh.cpp プロジェクト: imclab/24HourMusic
//--------------------------------------------------------------
void ofVboMesh::draw(polyMode pMode){
	if(!vbo.getIsAllocated()){
		setupVertices(drawType);
	}

	if(meshElement->getNumColors() && !vbo.getUsingColors()){
		setupColors(drawType);
	}
	
	if(meshElement->getNumNormals() && !vbo.getUsingNormals()){
		setupNormals(drawType);
	}
	
	if(meshElement->getNumTexCoords() && !vbo.getUsingTexCoords()){
		setupTexCoords(drawType);
	}
	
	if(!meshElement->getNumIndices()){
		meshElement->setupIndices();
	}
	
	update();
	
	glPushAttrib(GL_POLYGON_BIT);
	glPolygonMode(GL_FRONT_AND_BACK, pMode);
	
	GLuint mode = ofGetGLTriangleMode(meshElement->getMode());
	
	if(pMode!=OF_MESH_POINTS){
		if(bUseIndices){
			cout << meshElement->getNumIndices() << endl;
			vbo.drawElements(mode,meshElement->getNumIndices());
		}else{
			vbo.draw(mode,0,meshElement->getNumVertices());
		}
	}else{
		//no indices needed for just drawing verts as points
		vbo.draw(GL_POINTS,0,meshElement->getNumVertices());
	}
	
	glPopAttrib();
}
コード例 #6
0
ファイル: widget.cpp プロジェクト: ptrxyz/twmn
void Widget::onNext()
{
    m_visible.start();
    if (m_messageQueue.size() < 2)
        return;
    Message m = m_messageQueue.front();
    boost::optional<QVariant> tmpManual = m.data["manually_shown"];
    m.data["manually_shown"] = boost::optional<QVariant>(true);
    m_previousStack.push(m);
    m_messageQueue.pop_front();
    loadDefaults();
    setupFont();
    setupColors();
    setupIcon();
    setupTitle();
    setupContent();
    connectForPosition(m_messageQueue.front().data["pos"]->toString());
    updateFinalWidth();
    if (m_messageQueue.front().data["bounce"] && !tmpManual)
        startBounce();
}
コード例 #7
0
ファイル: widget.cpp プロジェクト: ptrxyz/twmn
void Widget::processMessageQueue()
{
    if (m_messageQueue.empty()) {
        return;
    }

    if (m_animation.state() == QAbstractAnimation::Running ||
            m_visible.isActive()) {
       //(m_animation.totalDuration() - m_animation.currentTime()) < 50) {
        return;
    }

    QFont boldFont = font();
    boldFont.setBold(true);
    Message& m = m_messageQueue.front();
    loadDefaults();
    if (m.data["aot"]->toBool()) {
        setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
        raise();
    }
    setupFont();
    setupColors();
    setupIcon();
    setupTitle();
    setupContent();
    connectForPosition(m.data["pos"]->toString());
    m_animation.setDirection(QAnimationGroup::Forward);
    int width = computeWidth();
    qobject_cast<QPropertyAnimation*>(m_animation.animationAt(0))->setEasingCurve(QEasingCurve::Type(m_settings.get("gui/in_animation").toInt()));
    qobject_cast<QPropertyAnimation*>(m_animation.animationAt(0))->setStartValue(0);
    qobject_cast<QPropertyAnimation*>(m_animation.animationAt(0))->setEndValue(width);
    m_animation.start();
    QString soundCommand = m.data["sc"]->toString();
    if (!soundCommand.isEmpty())
        QProcess::startDetached(soundCommand);
   // m_shortcutGrabber.enableShortcuts();
}
コード例 #8
0
ファイル: widget.cpp プロジェクト: ptrxyz/twmn
bool Widget::update(const Message &m)
{
    bool found = false;
    for (QQueue<Message>::iterator it = m_messageQueue.begin(); it != m_messageQueue.end(); ++it) {
        if (it->data["id"] && it->data["id"]->toInt() == m.data["id"]->toInt()) {
            it->data = m.data;
            found = true;
            break;
        }
    }
    if (found && !m_messageQueue.isEmpty() && m_messageQueue.front().data["id"]
        && m_messageQueue.front().data["id"]->toInt() == m.data["id"]->toInt()) {
        loadDefaults();
        setupFont();
        setupColors();
        setupIcon();
        setupTitle();
        setupContent();
        updateFinalWidth();
        connectForPosition(m_messageQueue.front().data["pos"]->toString());
        m_visible.start();
    }
    return found;
}
コード例 #9
0
ファイル: visualizer.cpp プロジェクト: FlorianKummer/OCCA2
void visualizer::setup(string name, int& argc, char **argv){
  staticVisualizer = this;

  //--[ SETTINGS ]--------------------------------
  appName = name;

  for(int i=0; i<256; i++){
    pressFunction[i]   = &visualizer::voidEventFunction;
    releaseFunction[i] = &visualizer::voidEventFunction;

    keyState[i] = 0;
  }

  for(int i=0; i<7; i++){
    mouseFunction[i][0] = &visualizer::voidEventFunction;
    mouseFunction[i][1] = &visualizer::voidEventFunction;

    mouseState[i] = 0;
  }

  rotateSpeed = OCCA_PI/600.0;

  pause_f     = 0;
  external_f  = 0;
  drag_f      = 0;
  //==============================================


  //--[ COLORS ]----------------------------------
  setupColors();
  //==============================================


  //--[ CAMERA ]----------------------------------
  rowVP = colVP = 0;

  vpRowCount = vpColCount = 0;

  vpRowDrag = vpColDrag = 0;

  vpPadding = 3;

  vpOutlineColor[0] = 0;
  vpOutlineColor[1] = 0;
  vpOutlineColor[2] = 0;
  vpOutlineColor[3] = 0;

  vpOutlineSize = 1;
  vpOutline_f   = 1;
  //==============================================


  //--[ VIEWPORTS ]----------------------------------
  width  = 1200;
  height = width*9/16;

  fov    = 45.0;
  znear  = 0.001;
  zfar   = 1000;
  //==============================================

  init(argc, argv);
  initFunctions();
}
コード例 #10
0
ファイル: sessionanalysiswidget.cpp プロジェクト: HxCory/f1lt
SessionAnalysisWidget::SessionAnalysisWidget(QWidget *parent)
    : QWidget(parent)
{
	ui.setupUi(this);

    for (int i = 0; i < ui.gridLayout->columnCount(); i += 2)
    {
        QLabel *lab = (QLabel*)ui.gridLayout->itemAtPosition(0, i)->widget();
        QCheckBox *box = (QCheckBox*)ui.gridLayout->itemAtPosition(0, i+1)->widget();

        box->setChecked(true);
        driverLabels.append(lab);
        driverCheckBoxes.append(box);

        lab = (QLabel*)ui.gridLayout->itemAtPosition(1, i)->widget();
        box = (QCheckBox*)ui.gridLayout->itemAtPosition(1, i+1)->widget();

        box->setChecked(true);
        driverLabels.append(lab);
        driverCheckBoxes.append(box);
    }

    setupTables();
    ui.lapTimeTableWidget->setItemDelegate(new LTItemDelegate);
    ui.lapTimeTableWidgetFP->setItemDelegate(new LTItemDelegate);
    ui.lapTimeTableWidgetQuali->setItemDelegate(new LTItemDelegate);
    ui.lapTimeTableWidgetQ1->setItemDelegate(new LTItemDelegate);
    ui.lapTimeTableWidgetQ2->setItemDelegate(new LTItemDelegate);
    ui.lapTimeTableWidgetQ3->setItemDelegate(new LTItemDelegate);

    setupColors();



    ui.sessionLapTimesChartQ1->setQualiPeriod(1);


    ui.sessionLapTimesChartQ2->setQualiPeriod(2);

    ui.sessionLapTimesChartQ3->setQualiPeriod(3);
    selected = true;
//    ui.splitter->refresh();
//    QList<int> sizes;
//    sizes << 100 << 400;
//    ui.splitter->setSizes(sizes);
//    ui.lapTimeTableWidget->setGeometry(ui.lapTimeTableWidget->x(), ui.lapTimeTableWidget->y(), sizes[0], ui.lapTimeTableWidget->height());
//    ui.sessionLapTimesChart->setGeometry(ui.sessionLapTimesChart->x(), ui.sessionLapTimesChart->y(), 500, ui.sessionLapTimesChart->height());

    connect(ui.sessionLapTimesChart, SIGNAL(zoomChanged(int,int,double,double)), this, SLOT(onZoomChanged(int,int,double,double)));
    connect(ui.sessionLapTimesChartFP, SIGNAL(zoomChanged(int,int,double,double)), this, SLOT(onZoomChanged(int,int,double,double)));
    connect(ui.sessionLapTimesChartQuali, SIGNAL(zoomChanged(int,int,double,double)), this, SLOT(onZoomChanged(int,int,double,double)));
    connect(ui.sessionLapTimesChartQ1, SIGNAL(zoomChanged(int,int,double,double)), this, SLOT(onZoomChanged(int,int,double,double)));
    connect(ui.sessionLapTimesChartQ2, SIGNAL(zoomChanged(int,int,double,double)), this, SLOT(onZoomChanged(int,int,double,double)));
    connect(ui.sessionLapTimesChartQ3, SIGNAL(zoomChanged(int,int,double,double)), this, SLOT(onZoomChanged(int,int,double,double)));

    top10only = false;
    first = 0;
    last = 99;
    min = -1;
    max = -1;
}
コード例 #11
0
ファイル: ltwindow.cpp プロジェクト: HxCory/f1lt
LTWindow::LTWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::LTWindow), eventData(EventData::getInstance())
{    
    ui->setupUi(this);    

    currDriver = -1;

    streamReader = new DataStreamReader(this);
    prefs = new PreferencesDialog(this);
    settings = new QSettings(F1LTCore::iniFile(), QSettings::IniFormat, this);
    loginDialog = new LoginDialog(this);
    ltFilesManagerDialog = new LTFilesManagerDialog(this);
    trackRecordsDialog = new TrackRecordsDialog(this);
    saw = new SessionAnalysisWidget();
    stw = new SessionTimesWidget();
    driverTrackerWidget = new DriverTrackerWidget();
    aboutDialog = new AboutDialog(this);
    updatesCheckerDialog = new UpdatesCheckerDialog(this);

//    ui->trackStatusWidget->setupItems();

    connect(streamReader, SIGNAL(tryAuthorize()), this, SLOT(tryAuthorize()));
    connect(streamReader, SIGNAL(authorized(QString)), this, SLOT(authorized(QString)));
    connect(streamReader, SIGNAL(eventDataChanged(const DataUpdates&)), this, SLOT(eventDataChanged(const DataUpdates&)));
    connect(streamReader, SIGNAL(driverDataChanged(int, const DataUpdates&)), this, SLOT(driverDataChanged(int, const DataUpdates&)));
    connect(streamReader, SIGNAL(dataChanged(const DataUpdates&)), this, SLOT(dataChanged(const DataUpdates&)));
    connect(streamReader, SIGNAL(sessionStarted()), this, SLOT(sessionStarted()));
    connect(streamReader, SIGNAL(authorizationError()), this, SLOT(authorizationError()));
    connect(streamReader, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(error(QAbstractSocket::SocketError)));
    connect(streamReader, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error(QNetworkReply::NetworkError)));
    connect(streamReader, SIGNAL(noLiveSession(bool, QString)), this, SLOT(showNoSessionBoard(bool, QString)));

    connect(updatesCheckerDialog, SIGNAL(newVersionAvailable()), this, SLOT(onNewVersionAvailable()));

    sessionTimer = new SessionTimer(this);
    connect(sessionTimer, SIGNAL(updateWeather()), this, SLOT(updateWeather()));

    connect(&SeasonData::getInstance(), SIGNAL(seasonDataChanged()), &ImagesFactory::getInstance(), SLOT(reloadGraphics()));
    connect(&SeasonData::getInstance(), SIGNAL(seasonDataChanged()), &ColorsManager::getInstance(), SLOT(calculateDefaultDriverColors()));
    connect(&SeasonData::getInstance(), SIGNAL(seasonDataChanged()), saw, SLOT(setupColors()));


    connect(prefs, SIGNAL(driversColorsChanged()), saw, SLOT(setupColors()));

    eventRecorder = new EventRecorder(sessionTimer, this);
    eventPlayer = new EventPlayer(this);

    delayWidget = new DelayWidget(this);
    connect(delayWidget, SIGNAL(delayChanged(int, int)), streamReader, SLOT(setDelay(int, int)));
    connect(delayWidget, SIGNAL(delayChanged(int, int)), sessionTimer, SLOT(setDelay(int, int)));
    connect(sessionTimer, SIGNAL(synchronizingTimer(bool)), delayWidget, SLOT(synchronizingTimer(bool)));
    connect(sessionTimer, SIGNAL(synchronizingTimer(bool)), driverTrackerWidget, SLOT(pauseTimer(bool)));

    connect(ui->messageBoardWidget, SIGNAL(connectClicked()), this, SLOT(on_actionConnect_triggered()));
    connect(ui->messageBoardWidget, SIGNAL(playClicked()), this, SLOT(on_actionOpen_triggered()));
    connect(ui->messageBoardWidget, SIGNAL(loadClicked()), this, SLOT(on_actionLT_files_data_base_triggered()));

    loadSettings();
    ColorsManager::getInstance().calculateDefaultDriverColors();
    saw->setupColors();

    delayWidgetAction = ui->mainToolBar->addWidget(delayWidget);
    delayWidgetAction->setVisible(true);

    eventPlayerAction = ui->mainToolBar->addWidget(eventPlayer);
    eventPlayerAction->setVisible(false);
    recording = false;
    playing = false;

    connectionProgress = new QProgressDialog(this);

    connect(sessionTimer, SIGNAL(timeout()), this, SLOT(timeout()));
    connect(eventRecorder, SIGNAL(recordingStopped()), this, SLOT(autoStopRecording()));
    connect(eventPlayer, SIGNAL(playClicked(int)), this, SLOT(eventPlayerPlayClicked(int)));
    connect(eventPlayer, SIGNAL(pauseClicked()), this, SLOT(eventPlayerPauseClicked()));
    connect(eventPlayer, SIGNAL(rewindToStartClicked()), this, SLOT(eventPlayerRewindToStartClicked()));
    connect(eventPlayer, SIGNAL(forwardToEndClicked()), this, SLOT(eventPlayerForwardToEndClicked()));
    connect(eventPlayer, SIGNAL(rewindClicked()), this, SLOT(eventPlayerRewindClicked()));
    connect(eventPlayer, SIGNAL(stopClicked()), this, SLOT(eventPlayerStopClicked()));
    connect(eventPlayer, SIGNAL(nextPackets(QVector<Packet>)), streamReader, SLOT(parsePackets(QVector<Packet>)));

    connect(ui->ltWidget, SIGNAL(driverSelected(int)), ui->driverDataWidget, SLOT(printDriverData(int)));
    connect(ui->ltWidget, SIGNAL(driverDoubleClicked(int)), this, SLOT(ltWidgetDriverSelected(int)));


    ui->messageBoardWidget->setVisible(false);

    QStringList args = qApp->arguments();
    if (args.size() > 1)
    {
        if (eventPlayer->loadFromFile(args.at(1)) == false)
        {
            QMessageBox::critical(this, "Error opening file!", "Could not open specified file, or the file is corrupted.");
            connectToServer();
            return;
        }
        setWindowTitle("FILT - " + args.at(1));
        ui->actionRecord->setVisible(false);
        ui->actionStop_recording->setVisible(false);
        eventPlayerAction->setVisible(true);
        delayWidgetAction->setVisible(false);

        playing = true;

        eventPlayer->startPlaying();
    }
    else
    {
    	if (settings->value("ui/auto_connect").toBool())
    		connectToServer();
    	else
    	{
    		ui->messageBoardWidget->showStartupBoard();
    		showSessionBoard(true);
    	}
    }    

}