Пример #1
0
void drawMindsetStatus(ofxThinkgearEventArgs& data){
    // ofPushStyle(); // f*****g bug
    ofSetRectMode(OF_RECTMODE_CENTER);
    ofPushMatrix();
    ofTranslate(ofGetWidth() - 100, 100);
    ofFill();
    ofSetCircleResolution(100);
    ofSetColor(0, 0, 0, 128);
    ofCircle(0, 0, 52);
    // Show connection state
    switch (tgState){
        case NONE:
            ofSetColor(0, 0, 0);
            break;
        case CONNECTING:
            ofSetColor(200, 200, 0);
            break;
        case BAD_SIGNAL:
            ofSetColor(200, 0, 0);
            break;
        case READY:
            ofSetColor(0, 200, 0);
            break;
    }
    ofRect(0, 0, 10, 10);
    if (true || tgState == READY){
        // MindSet info pad
        ofSetColor(200, 200, 200);

        float w = smallFont.stringWidth(ofToString(data.raw));
        smallFont.drawString(ofToString(data.raw), -w/2, -38);

        ofSetColor(200+55*(medScore/200), 200, 200);
        ofCircle(20, -20, min(1.0, data.meditation/100.0) * 16);

        ofSetColor(200+55*(attScore/200), 200, 200);
        ofCircle(-20, -20, min(1.0, data.attention/100.0) * 16);

        ofSetColor(200, 200, 200);
        ofRect(40-15*eegData.midGamma.ratio, 0, 30*eegData.midGamma.ratio, 10);
        ofRotate(25.7, 0, 0, 1);
        ofRect(40-15*eegData.lowGamma.ratio, 0, 30*eegData.lowGamma.ratio, 10);
        ofRotate(25.7, 0, 0, 1);
        ofRect(40-15*eegData.highBeta.ratio, 0, 30*eegData.highBeta.ratio, 10);
        ofRotate(25.7, 0, 0, 1);
        ofRect(40-15*eegData.lowBeta.ratio, 0, 30*eegData.lowBeta.ratio, 10);
        ofRotate(25.7, 0, 0, 1);
        ofRect(40-15*eegData.highAlpha.ratio, 0, 30*eegData.highAlpha.ratio, 10);
        ofRotate(25.7, 0, 0, 1);
        ofRect(40-15*eegData.lowAlpha.ratio, 0, 30*eegData.lowAlpha.ratio, 10);
        ofRotate(25.7, 0, 0, 1);
        ofRect(40-15*eegData.theta.ratio, 0, 30*eegData.theta.ratio, 10);
        ofRotate(25.7, 0, 0, 1);
        ofRect(40-15*eegData.delta.ratio, 0, 30*eegData.delta.ratio, 10);
    }
    ofPopMatrix();
    // ofPopStyle(); // f*****g bug
    ofSetRectMode(OF_RECTMODE_CORNER); // f*****g bug
}
Пример #2
0
//------------------------------------------------------------
string wrapString(string text, ofTrueTypeFont &ofttf_object, int width) {
	
	string typeWrapped = "";
	string tempString = "";
	vector <string> words = ofSplitString(text, " ");
	for(int i=0; i<words.size(); i++) {
		
		string wrd = words[i];
		//cout << wrd << endl;
		
		tempString += wrd + " ";
		int stringwidth = ofttf_object.stringWidth(tempString);
		if(stringwidth >= width) {
			tempString = "";
			typeWrapped += "\n";
		}
		
		typeWrapped += wrd + " ";
	}
	
	return typeWrapped;
	
}
Пример #3
0
void PMSc10Thanks::drawRightAlignString(ofTrueTypeFont &font, string s, int x, int y)
{
    int halfStringHeight = font.stringHeight(s) / 2;
    int stringWidth = font.stringWidth(s);
    font.drawString(s, x - stringWidth, y + halfStringHeight);
}