CentralWidget::CentralWidget():thisData_(ThisDataType( new zone_data::CentralWidgetData, [](zone_data::CentralWidgetData *arg) {delete arg; })) { this->setOrientation(Qt::Horizontal); zone_this_data(this); var_this_data->listView=new ListView; this->addWidget(var_this_data->listView); var_this_data->novelWidget=new DingDianNovelWidget; this->addWidget(var_this_data->novelWidget); { auto varSizePolicy=var_this_data->listView->sizePolicy(); varSizePolicy.setHorizontalStretch(0); var_this_data->listView->setSizePolicy(varSizePolicy); } { auto varSizePolicy=var_this_data->novelWidget->sizePolicy(); varSizePolicy.setHorizontalStretch(1); var_this_data->novelWidget->setSizePolicy(varSizePolicy); } /*设置listview 样式*/ std::shared_ptr<std::function<QWidget*(QWidget*,QModelIndex)>> createFunction= std::shared_ptr<std::function<QWidget*(QWidget*,QModelIndex)>>( new std::function<QWidget*(QWidget*,QModelIndex)>{ [](QWidget* argParent,QModelIndex) ->QWidget * { ItemWidget * varAns=new ItemWidget(argParent); return varAns; }/*~lambda function*/ }); var_this_data->listView->setCreateFunction(createFunction); /*设置model*/ if (var_this_data->listView->model()) { var_this_data->listView->model()->deleteLater(); } var_this_data->listView->setModel(new DingDianModel); { auto varStyle=DingDianSytle::instance(); auto varNovelLayout=std::make_shared<NovelLayout>(); auto varFont=varNovelLayout->font(); varFont.setPixelSize(varStyle->fontPixSize()); varFont.setWeight(QFont::Medium); varNovelLayout->setFont(varFont); varNovelLayout->setDrawColor(varStyle->fontColor()); var_this_data->novelWidget->setNovelLayout(varNovelLayout); } connect( var_this_data->listView, &ListView::onCurrentChanged, this, [this]() { zone_this_data(this); this->onCurrentChanged(var_this_data->showLastPage); var_this_data->showLastPage=false; }); connect( var_this_data->novelWidget, &NovelWidget::nextPageEndl, this,[var_this_data]() { var_this_data->novelWidget->onKeyPressed(Qt::Key_Down); }); connect( var_this_data->novelWidget, &NovelWidget::previousPageEndl, this,[var_this_data]() { var_this_data->showLastPage=true; var_this_data->novelWidget->onKeyPressed(Qt::Key_Up); }); connect( var_this_data->novelWidget, &NovelWidget::onKeyPressed, this, [var_this_data](Qt::Key argKey) { if (argKey==Qt::Key_Up) { auto varListView=var_this_data->listView; auto *varModel=varListView->model(); auto varIndex=varModel->index( std::max(0,varListView->currentIndex().row()-1), 0); varListView->setCurrentIndex(varIndex); } else if (argKey==Qt::Key_Down) { auto varListView=var_this_data->listView; auto *varModel=varListView->model(); auto varIndex=varModel->index( std::min( std::max(0,varModel->rowCount()-1), 1+varListView->currentIndex().row()), 0); varListView->setCurrentIndex(varIndex); } }); }
osg::Group* createHUDText() { osg::Group* rootNode = new osg::Group; osgText::Font* font = new osgText::Font(new osgQt::QFontImplementation(QFont("Arial"))); osg::Geode* geode = new osg::Geode; rootNode->addChild(geode); float windowHeight = 1024.0f; float windowWidth = 1280.0f; float margin = 50.0f; //////////////////////////////////////////////////////////////////////////////////////////////////////// // // Examples of how to set up different text layout // osg::Vec4 layoutColor(1.0f,1.0f,0.0f,1.0f); float layoutCharacterSize = 20.0f; { osgText::Text* text = new osgText::Text; text->setFont(font); text->setColor(layoutColor); text->setCharacterSize(layoutCharacterSize); text->setPosition(osg::Vec3(margin,windowHeight-margin,0.0f)); // the default layout is left to right, typically used in languages // originating from europe such as English, French, German, Spanish etc.. text->setLayout(osgText::Text::LEFT_TO_RIGHT); text->setText("text->setLayout(osgText::Text::LEFT_TO_RIGHT);"); geode->addDrawable(text); } { osgText::Text* text = new osgText::Text; text->setFont(font); text->setColor(layoutColor); text->setCharacterSize(layoutCharacterSize); text->setPosition(osg::Vec3(windowWidth-margin,windowHeight-margin,0.0f)); // right to left layouts would be used for hebrew or arabic fonts. text->setLayout(osgText::Text::RIGHT_TO_LEFT); text->setAlignment(osgText::Text::RIGHT_BASE_LINE); text->setText("text->setLayout(osgText::Text::RIGHT_TO_LEFT);"); geode->addDrawable(text); } { osgText::Text* text = new osgText::Text; text->setFont(font); text->setColor(layoutColor); text->setPosition(osg::Vec3(margin,windowHeight-margin,0.0f)); text->setCharacterSize(layoutCharacterSize); // vertical font layout would be used for asian fonts. text->setLayout(osgText::Text::VERTICAL); text->setText("text->setLayout(osgText::Text::VERTICAL);"); geode->addDrawable(text); } //////////////////////////////////////////////////////////////////////////////////////////////////////// // // Examples of how to set up different font resolution // osg::Vec4 fontSizeColor(0.0f,1.0f,1.0f,1.0f); float fontSizeCharacterSize = 30; osg::Vec3 cursor = osg::Vec3(margin*2,windowHeight-margin*2,0.0f); { osgText::Text* text = new osgText::Text; text->setFont(font); text->setColor(fontSizeColor); text->setCharacterSize(fontSizeCharacterSize); text->setPosition(cursor); // use text that uses 10 by 10 texels as a target resolution for fonts. text->setFontResolution(10,10); // blocky but small texture memory usage text->setText("text->setFontResolution(10,10); // blocky but small texture memory usage"); geode->addDrawable(text); } cursor.y() -= fontSizeCharacterSize; { osgText::Text* text = new osgText::Text; text->setFont(font); text->setColor(fontSizeColor); text->setCharacterSize(fontSizeCharacterSize); text->setPosition(cursor); // use text that uses 20 by 20 texels as a target resolution for fonts. text->setFontResolution(20,20); // smoother but higher texture memory usage (but still quite low). text->setText("text->setFontResolution(20,20); // smoother but higher texture memory usage (but still quite low)."); geode->addDrawable(text); } cursor.y() -= fontSizeCharacterSize; { osgText::Text* text = new osgText::Text; text->setFont(font); text->setColor(fontSizeColor); text->setCharacterSize(fontSizeCharacterSize); text->setPosition(cursor); // use text that uses 40 by 40 texels as a target resolution for fonts. text->setFontResolution(40,40); // even smoother but again higher texture memory usage. text->setText("text->setFontResolution(40,40); // even smoother but again higher texture memory usage."); geode->addDrawable(text); } //////////////////////////////////////////////////////////////////////////////////////////////////////// // // Examples of how to set up different sized text // osg::Vec4 characterSizeColor(1.0f,0.0f,1.0f,1.0f); cursor.y() -= fontSizeCharacterSize*2.0f; { osgText::Text* text = new osgText::Text; text->setFont(font); text->setColor(characterSizeColor); text->setFontResolution(20,20); text->setPosition(cursor); // use text that is 20 units high. text->setCharacterSize(20); // small text->setText("text->setCharacterSize(20.0f); // small"); geode->addDrawable(text); } cursor.y() -= 30.0f; { osgText::Text* text = new osgText::Text; text->setFont(font); text->setColor(characterSizeColor); text->setFontResolution(30,30); text->setPosition(cursor); // use text that is 30 units high. text->setCharacterSize(30.0f); // medium text->setText("text->setCharacterSize(30.0f); // medium"); geode->addDrawable(text); } cursor.y() -= 50.0f; { osgText::Text* text = new osgText::Text; text->setFont(font); text->setColor(characterSizeColor); text->setFontResolution(40,40); text->setPosition(cursor); // use text that is 60 units high. text->setCharacterSize(60.0f); // large text->setText("text->setCharacterSize(60.0f); // large"); geode->addDrawable(text); } //////////////////////////////////////////////////////////////////////////////////////////////////////// // // Examples of how to set up different alignments // osg::Vec4 alignmentSizeColor(0.0f,1.0f,0.0f,1.0f); float alignmentCharacterSize = 25.0f; cursor.x() = 640; cursor.y() = margin*4.0f; typedef std::pair<osgText::Text::AlignmentType,std::string> AlignmentPair; typedef std::vector<AlignmentPair> AlignmentList; AlignmentList alignmentList; alignmentList.push_back(AlignmentPair(osgText::Text::LEFT_TOP,"text->setAlignment(\nosgText::Text::LEFT_TOP);")); alignmentList.push_back(AlignmentPair(osgText::Text::LEFT_CENTER,"text->setAlignment(\nosgText::Text::LEFT_CENTER);")); alignmentList.push_back(AlignmentPair(osgText::Text::LEFT_BOTTOM,"text->setAlignment(\nosgText::Text::LEFT_BOTTOM);")); alignmentList.push_back(AlignmentPair(osgText::Text::CENTER_TOP,"text->setAlignment(\nosgText::Text::CENTER_TOP);")); alignmentList.push_back(AlignmentPair(osgText::Text::CENTER_CENTER,"text->setAlignment(\nosgText::Text::CENTER_CENTER);")); alignmentList.push_back(AlignmentPair(osgText::Text::CENTER_BOTTOM,"text->setAlignment(\nosgText::Text::CENTER_BOTTOM);")); alignmentList.push_back(AlignmentPair(osgText::Text::RIGHT_TOP,"text->setAlignment(\nosgText::Text::RIGHT_TOP);")); alignmentList.push_back(AlignmentPair(osgText::Text::RIGHT_CENTER,"text->setAlignment(\nosgText::Text::RIGHT_CENTER);")); alignmentList.push_back(AlignmentPair(osgText::Text::RIGHT_BOTTOM,"text->setAlignment(\nosgText::Text::RIGHT_BOTTOM);")); alignmentList.push_back(AlignmentPair(osgText::Text::LEFT_BASE_LINE,"text->setAlignment(\nosgText::Text::LEFT_BASE_LINE);")); alignmentList.push_back(AlignmentPair(osgText::Text::CENTER_BASE_LINE,"text->setAlignment(\nosgText::Text::CENTER_BASE_LINE);")); alignmentList.push_back(AlignmentPair(osgText::Text::RIGHT_BASE_LINE,"text->setAlignment(\nosgText::Text::RIGHT_BASE_LINE);")); alignmentList.push_back(AlignmentPair(osgText::Text::LEFT_BOTTOM_BASE_LINE,"text->setAlignment(\nosgText::Text::LEFT_BOTTOM_BASE_LINE);")); alignmentList.push_back(AlignmentPair(osgText::Text::CENTER_BOTTOM_BASE_LINE,"text->setAlignment(\nosgText::Text::CENTER_BOTTOM_BASE_LINE);")); alignmentList.push_back(AlignmentPair(osgText::Text::RIGHT_BOTTOM_BASE_LINE,"text->setAlignment(\nosgText::Text::RIGHT_BOTTOM_BASE_LINE);")); osg::Sequence* sequence = new osg::Sequence; { for(AlignmentList::iterator itr=alignmentList.begin(); itr!=alignmentList.end(); ++itr) { osg::Geode* alignmentGeode = new osg::Geode; sequence->addChild(alignmentGeode); sequence->setTime(sequence->getNumChildren(), 1.0f); osgText::Text* text = new osgText::Text; text->setFont(font); text->setColor(alignmentSizeColor); text->setCharacterSize(alignmentCharacterSize); text->setPosition(cursor); text->setDrawMode(osgText::Text::TEXT|osgText::Text::ALIGNMENT|osgText::Text::BOUNDINGBOX); text->setAlignment(itr->first); text->setText(itr->second); alignmentGeode->addDrawable(text); } } sequence->setMode(osg::Sequence::START); sequence->setInterval(osg::Sequence::LOOP, 0, -1); sequence->setDuration(1.0f, -1); rootNode->addChild(sequence); //////////////////////////////////////////////////////////////////////////////////////////////////////// // // Examples of how to set up different fonts... // cursor.x() = margin*2.0f; cursor.y() = margin*2.0f; osg::Vec4 fontColor(1.0f,0.5f,0.0f,1.0f); float fontCharacterSize = 20.0f; float spacing = 40.0f; { osgText::Text* text = new osgText::Text; text->setColor(fontColor); text->setPosition(cursor); text->setCharacterSize(fontCharacterSize); text->setFont(0); text->setText("text->setFont(0); // inbuilt font."); geode->addDrawable(text); cursor.x() = text->getBound().xMax() + spacing ; } { osgText::Font* arial = new osgText::Font(new osgQt::QFontImplementation(QFont("Arial"))); osgText::Text* text = new osgText::Text; text->setColor(fontColor); text->setPosition(cursor); text->setCharacterSize(fontCharacterSize); text->setFont(arial); text->setText(arial!=0? "text->setFont(\"fonts/arial.ttf\");": "unable to load \"fonts/arial.ttf\""); geode->addDrawable(text); cursor.x() = text->getBound().xMax() + spacing ; } { osgText::Font* times = new osgText::Font(new osgQt::QFontImplementation(QFont("Times"))); osgText::Text* text = new osgText::Text; text->setColor(fontColor); text->setPosition(cursor); text->setCharacterSize(fontCharacterSize); geode->addDrawable(text); text->setFont(times); text->setText(times!=0? "text->setFont(\"fonts/times.ttf\");": "unable to load \"fonts/times.ttf\""); cursor.x() = text->getBound().xMax() + spacing ; } cursor.x() = margin*2.0f; cursor.y() = margin; { osgText::Font* dirtydoz = new osgText::Font(new osgQt::QFontImplementation(QFont("Times"))); osgText::Text* text = new osgText::Text; text->setColor(fontColor); text->setPosition(cursor); text->setCharacterSize(fontCharacterSize); text->setFont(dirtydoz); text->setText(dirtydoz!=0? "text->setFont(\"fonts/dirtydoz.ttf\");": "unable to load \"fonts/dirtydoz.ttf\""); geode->addDrawable(text); cursor.x() = text->getBound().xMax() + spacing ; } { osgText::Font* fudd = new osgText::Font(new osgQt::QFontImplementation(QFont("Times"))); osgText::Text* text = new osgText::Text; text->setColor(fontColor); text->setPosition(cursor); text->setCharacterSize(fontCharacterSize); text->setFont(fudd); text->setText(fudd!=0? "text->setFont(\"fonts/fudd.ttf\");": "unable to load \"fonts/fudd.ttf\""); geode->addDrawable(text); cursor.x() = text->getBound().xMax() + spacing ; } return rootNode; }
void Label::render( ImageObject& img, const Rect& rr ) { if ( !visible() ) return; if ( font() != NULL ) { if (!pMultiline ) { Rect r = Rect( 0, 0, clientVisibleWidth(), clientVisibleHeight() ); int theight = font()->textHeight(); int twidth = font()->textWidth( pText ); if ( pVAl == valignCenter ) { r.top += ( r.height / 2 - theight / 2 ); } else if ( pVAl == valignBottom ) { r.top += ( r.height - theight ); } if ( pHAl == halignCenter ) { r.left += ( r.width / 2 - twidth / 2 ); } else if ( pHAl == halignRight ) { r.left += ( r.width - twidth ); } screen().outText( pText, *font(), (int)r.left, (int)r.top, fontColor() ); } else { List<wstring*> sl; wstring tmps = pText; int pos = tmps.find( L"\n", 0 ); while( pos > 0 ) { // cout << "pos: " << pos << endl; wstring* s = new wstring; *s = tmps.substr( 0, pos ); tmps.erase(0, pos + 1); sl.append( s ); pos = tmps.find( L"\n", 0 ); } if ( tmps != L"" ) { wstring* s = new wstring; *s = tmps; sl.append( s ); } Rect r = Rect( 0, 0, clientVisibleWidth(), clientVisibleHeight() ); pos = 0; while( pos < sl.count() ) { wstring* s = sl.get( pos ); if ( font()->textWidth( *s ) > r.width ) { int space = s->find( L" ", 0 ); wstring* news = new wstring; while( space > 0 ) { // cout << "space:" << space << endl; if ( font()->textWidth( *news + s->substr(0, space) ) > r.width ) { // cout << "Added at pos: " << pos << " len: " << news->length() << endl; sl.insert( s, pos ); sl.replace( pos, news ); pos++; news = new wstring; } *news += s->substr(0, space) + L" "; s->erase(0, space + 1); space = s->find( L" ", 0 ); if ( (space == 0) && (s->length() > 0) ) space = s->length()-1; } if ( !news->empty() ) s->replace(0, 0, *news); delete news; } pos++; } int theight = font()->textHeight(); for( int i = 0; i < sl.count(); i++ ){ r = Rect( 0, 0, clientVisibleWidth(), clientVisibleHeight() ); int twidth = font()->textWidth( *sl.get( i ) ); if ( pVAl == valignCenter ) { r.top += ( (r.height / 2) - ((theight * sl.count()) / 2) ) + (theight * i); } else if ( pVAl == valignBottom ) { r.top += ( r.height - (theight * i ) ); } else if ( pVAl == valignTop ) { r.top += (theight * i); } if ( pHAl == halignCenter ) { r.left += ( r.width / 2 - twidth / 2 ); } else if ( pHAl == halignRight ) { r.left += ( r.width - twidth ); } screen().outText( *sl.get( i ), *font(), (int)r.left, (int)r.top, fontColor() ); delete sl.get( i ); } } } }
void InputSample::render(float elapsedTime) { // Clear the color and depth buffers clear(CLEAR_COLOR_DEPTH, Vector4::zero(), 1.0f, 0); _inputSampleControls->draw(); // Draw text unsigned int fontSize = 18; Vector4 fontColor(1.0f, 1.0f, 1.0f, 1.0f); unsigned int width, height; char buffer[50]; _font->start(); if (isMouseCaptured()) { // Draw crosshair at current offest w.r.t. center of screen _crosshair->start(); _crosshair->draw(_crosshairDstRect, _crosshairSrcRect); _crosshair->finish(); } else { for (std::list<TouchPoint>::const_iterator it = _touchPoints.begin(); it != _touchPoints.end(); ++it) { sprintf(buffer, "T_%u(%d,%d)", it->_id, (int)it->_coord.x, (int)it->_coord.y); _font->measureText(buffer, fontSize, &width, &height); int x = it->_coord.x - (int)(width>>1); int y = it->_coord.y - (int)(height>>1); _font->drawText(buffer, x, y, fontColor, fontSize); } // Mouse sprintf(buffer, "M(%d,%d)", (int)_mousePoint.x, (int)_mousePoint.y); _font->measureText(buffer, fontSize, &width, &height); int x = _mousePoint.x - (int)(width>>1); int y = _mousePoint.y - (int)(height>>1); _font->drawText(buffer, x, y, fontColor, fontSize); if (!_keyboardState && _mouseString.length() > 0) { int y = getHeight() - fontSize; _font->drawText(_mouseString.c_str(), 0, y, fontColor, fontSize); } if (_mouseWheel) { sprintf(buffer, "%d", _mouseWheel); _font->measureText(buffer, fontSize, &width, &height); int x = _mouseWheelPoint.x - (int)(width>>1); int y = _mouseWheelPoint.y + 4; _font->drawText(buffer, x, y, fontColor, fontSize); } } // Pressed keys if (_keyboardString.length() > 0) { _font->drawText(_keyboardString.c_str(), 0, 0, fontColor, fontSize); } // Printable symbols typed if (_symbolsString.length() > 0) { _font->drawText(_symbolsString.c_str(), 0, 18, fontColor, fontSize); } // Held keys if (!_downKeys.empty()) { std::string displayKeys; for (std::set<int>::const_iterator i = _downKeys.begin(); i != _downKeys.end(); ++i) { const char* str = keyString(*i); displayKeys.append(str); } if (!displayKeys.empty()) { _font->measureText(displayKeys.c_str(), 18, &width, &height); int x = Game::getInstance()->getWidth() - width; int y = 0; _font->drawText(displayKeys.c_str(), x, y, fontColor, fontSize); } } // Draw the accelerometer values in the bottom right corner. static float pitch, roll; static float accelerometerDrawRate = 1000.0f; accelerometerDrawRate += elapsedTime; if (accelerometerDrawRate > 100.0f) { accelerometerDrawRate = 0.0f; getAccelerometerValues(&pitch, &roll); } if (hasAccelerometer() && !_keyboardState) { _formNode->getDrawable()->draw(); sprintf(buffer, "Pitch: %f Roll: %f", pitch, roll); _font->measureText(buffer, 18, &width, &height); _font->drawText(buffer, getWidth() - width, getHeight() - height, fontColor, fontSize); } _font->finish(); }
void GestureSample::render(float elapsedTime) { // Clear the color and depth buffers clear(CLEAR_COLOR_DEPTH, Vector4::zero(), 1.0f, 0); // Draw text Vector4 fontColor(1.0f, 1.0f, 1.0f, 1.0f); float fontSize = 18; _font->start(); float y = 0; size_t count = 0; for (std::list<std::wstring>::const_iterator it = _eventLog.begin(); it != _eventLog.end(); ++it) { ++count; _font->drawText(it->c_str(), 0, y, fontColor, fontSize); y += fontSize; if (y > (int)getHeight()) { _eventLog.resize(count); break; } } float x = getWidth() - 200; y = getHeight() - fontSize * 6; if (isGestureSupported(Gesture::GESTURE_TAP)) { _font->drawText(L"Tap supported", x, y, fontColor, fontSize); y += fontSize; } if (isGestureSupported(Gesture::GESTURE_SWIPE)) { _font->drawText(L"Swipe supported", x, y, fontColor, fontSize); y += fontSize; } if (isGestureSupported(Gesture::GESTURE_PINCH)) { _font->drawText(L"Pinch supported", x, y, fontColor, fontSize); y += fontSize; } if (isGestureSupported(Gesture::GESTURE_LONG_TAP)) { _font->drawText(L"Long tap supported", x, y, fontColor, fontSize); y += fontSize; } if (isGestureSupported(Gesture::GESTURE_DRAG)) { _font->drawText(L"Drag supported", x, y, fontColor, fontSize); y += fontSize; } if (isGestureSupported(Gesture::GESTURE_DROP)) { _font->drawText(L"Drop supported", x, y, fontColor, fontSize); y += fontSize; } _font->finish(); }
//-------------------------------------------------------------- // Callback function to show different instructions pages void testApp::drawInstructionsPage(int & pageNum) { if (showInstructions) { int i = pageNum; switch (i) { case 0: { ofTrueTypeFont font; font.loadFont("verdana.ttf", 15, true, true); ofColor fontColor(255,255,255); ofPoint stimulusCenter(ofGetWindowWidth()/2, ofGetWindowHeight()/2); std::stringstream ss; ss << "Welcome to TELEPHONE REWIRED, an immersive audiovisual art installation and\n"; ss << "scientific experiment examining the role of oscillations in the brain and the future \n"; ss << "of human cognition. The lights and sound in the room are designed to mimic \n"; ss << "frequencies ordinarily created by neurons in your brain. After several minutes of \n"; ss << "experiencing TELEPHONE REWIRED your neurons will begin to synchronize with \n"; ss << "the installation, firing in a similar pattern. \n"; ss << "\n"; ss << "We invite you to participate in an experiment studying how this installation \n"; ss << "changes your EEG oscillations (brainwaves) and how it affects your perception, \n"; ss << "attention and memory. This will take about 6 minutes in this room and 5 more \n"; ss << "minutes at the desk outside.\n"; ss << "\n"; ss << "To participate in the experiment, please push the green button.\n"; string data1 = ss.str(); ofPushMatrix(); ofPushStyle(); ofRectangle bounds1 = font.getStringBoundingBox(data1, 0, 0); ofTranslate(-bounds1.width/2, -bounds1.height / 2, 0); ofSetColor(fontColor); font.drawString(data1, stimulusCenter.x, stimulusCenter.y); ofPopStyle(); ofPopMatrix(); break; } case 1: { ofTrueTypeFont font; font.loadFont("verdana.ttf", 15, true, true); ofColor fontColor(255,255,255); ofPoint stimulusCenter(ofGetWindowWidth()/2, ofGetWindowHeight()/2); ofImage myImage("zeo_pic.png"); myImage.draw(ofGetWindowWidth()/2, ofGetWindowHeight()/2+120, 250, 250); std::stringstream ss; ss << "TELEPHONE REWIRED measures and records your brain activity (EEG) using a Zeo \n"; ss << "headband monitor. Please put on the headband now, and keep it placed centrally \n"; ss << "on your forehead throughout the experiment (see picture). \n"; ss << "\n"; ss << "We are also studying how quickly you respond when words appear on the screen \n"; ss << "or play through the speakers. Please keep your hand on the green button \n"; ss << "throughout the experiment and press it as soon as you hear or see a word.\n"; ss << "\n"; ss << "Your memory of the words will also be tested at the desk outside, so please pay \n"; ss << "attention and remember as many as you can.\n"; ss << "\n"; ss << "Although you are participating in a scientific experiment, we hope you will also be \n"; ss << "able to enjoy the experience of altering your neuronal oscillations!\n"; ss << "\n"; ss << "Press the green button to continue.\n"; string data1 = ss.str(); ofPushMatrix(); ofPushStyle(); ofRectangle bounds1 = font.getStringBoundingBox(data1, 0, 0); ofTranslate(-bounds1.width/2, -bounds1.height / 2, 0); ofSetColor(fontColor); font.drawString(data1, stimulusCenter.x, stimulusCenter.y); ofPopStyle(); ofPopMatrix(); break; } case 2: { ofTrueTypeFont font; font.loadFont("verdana.ttf", 15, true, true); ofColor fontColor(255,255,255); ofPoint stimulusCenter(ofGetWindowWidth()/2, ofGetWindowHeight()/2); std::stringstream ss; ss << "Before you begin, make sure you are wearing the Zeo EEG headband and have \n"; ss << "your hand on the green button.\n"; ss << "\n"; ss << "When the screen indicates that you are done with this portion of the experiment, \n"; ss << "you can remove the EEG headband. Then you may go outside to complete the \n"; ss << "experiment with a survey on a different computer by entering the code below so \n"; ss << "that your answers can be linked with your brain activity (EEG).\n"; ss << "\n"; ss << "Your code number is: " << experimentGovernor.getParticipantID() << "\n"; ss << "Please write it down now.\n"; ss << "\n"; ss << "Telephone Rewired was created by:\n"; ss << "LoVid - http://lovid.org/\n"; ss << "Sean Montgomery - http://www.produceconsumerobot.com/\n"; ss << "Special thanks to Mitch Altman for sharing his Brain Machine entrainment patterns \n"; ss << "with the open source community.\n"; ss << "\n"; ss << "Push the green button to begin the experiment.\n"; string data1 = ss.str(); ofPushMatrix(); ofPushStyle(); ofRectangle bounds1 = font.getStringBoundingBox(data1, 0, 0); ofTranslate(-bounds1.width/2, -bounds1.height / 2, 0); ofSetColor(fontColor); font.drawString(data1, stimulusCenter.x, stimulusCenter.y); ofPopStyle(); ofPopMatrix(); break; } default: break; } } }