Ejemplo n.º 1
0
	// ---------------------------------------------------------------------------------------
	//
	static void drawStringShadowed( ofTrueTypeFont& _font, string _s, float _x, float _y,
								   ofColor _frontColor = ofColor(255,255,255), ofColor _backColor = ofColor(0,0,0) )
	{
		ofSetColor( _backColor );
		_font.drawString( _s, _x + 1, _y + 1 );
		
		ofSetColor( _frontColor );
		_font.drawString( _s, _x, _y );
	}
Ejemplo n.º 2
0
void ofARoom::showHandCoord(double xr, double yr, double zr, double xl, double yl, double zl, ofTrueTypeFont	verdana14)
{
    ostringstream s;
    s<<"xr : "<<xr<<" yr : "<<yr<<" zr : "<<zr;
    ofSetColor(0, 0, 0);
    verdana14.drawString(s.str(), 20, 20);

    ostringstream s2;
    s2<<"xl : "<<xl<<" yl : "<<yl<<" zl : "<<zl;
    ofSetColor(0, 0, 0);
    verdana14.drawString(s2.str(), ofGetWidth()-300, 20);

}
Ejemplo n.º 3
0
void ofARoom::showMovementName(string movementName,	ofTrueTypeFont	verdana14)
{
    if (movementName=="")
    {
        ofSetColor(245, 58, 135);
        verdana14.drawString("Dernier mouvement effectué : ", 20, ofGetHeight()-50);

    }
    else
    {

        ofSetColor(245, 58, 135);
        verdana14.drawString("Dernier mouvement effectué : "+movementName, 20, ofGetHeight()-50);
    }

}
Ejemplo n.º 4
0
//--------------------------------------------------------------
void ofApp::draw()
{
	if (!foundSolution)
	{
		for (int i = 0; i < ArrayCount(population); i++)
		{
			population[i].Fitness();
		}

		vector<DNA> matingPool = vector<DNA>();
		for (int i = 0; i < ArrayCount(population); i++)
		{
			int n = int(population[i].fitness * ArrayCount(population));
			for (int k = 0; k < n; k++)
			{
				matingPool.push_back(population[i]);
			}
		}

		for (int i = 0; i < ArrayCount(population); i++)
		{
			int a = int(ofRandom(0, matingPool.size()));
			int b = int(ofRandom(0, matingPool.size()));

			DNA parentA = matingPool[a];
			DNA parentB = matingPool[b];

			DNA child = parentA.crossover(parentB);
			child.mutate();

			population[i] = child;
		}
	}

	ofClear(ofColor::white);

	ofSetColor(ofColor::black);
	for (int i = 0; i < ArrayCount(population); i++)
	{
		//string str = population[i].genes;
		population[i].genes[ArrayCount(population[i].genes)] = '\0';

		if (population[i].genes == target)
		{
			foundSolution = true;
			ofNoFill();
			ofSetLineWidth(6);
			ofSetCurveResolution(200);
			ofCircle(ofPoint((int(i / POPULATION_PER_COLUMN) * Y_SPACING) + 100, 
								((i % POPULATION_PER_COLUMN) * X_SPACING) + BUFFER_SPACING), 120);
		}
		

		myFont.drawString(population[i].genes, 
							(int(i / POPULATION_PER_COLUMN) * Y_SPACING) + BUFFER_SPACING, 
							((i % POPULATION_PER_COLUMN) * X_SPACING) + BUFFER_SPACING);

	}

}
Ejemplo n.º 5
0
void simpleToggle::draw(ofTrueTypeFont &font){
    ofPushStyle();

    ofSetColor(guiColor);
    if (!isOn) {
        ofNoFill();
        ofSetColor(255, 255, 255);
        roundedRect(pos.x, pos.y, width, height,6);
       /* ofFill();
        ofSetColor(150, 150, 150,200);
        roundedRect(pos.x, pos.y, width, height,6);
        ofSetColor(100, 100, 100,200);
        roundedRect(pos.x, pos.y+(height*0.5), width, height*0.5,6);*/

    }
    else{
        ofNoFill();
        ofSetColor(255, 255, 255);
        int rounding = 2;
        roundedRect(pos.x, pos.y, width, height,6);
        ofFill();
        ofSetColor(255, 255, 255,200);
        roundedRect(pos.x, pos.y, width, height,6);
        ofSetColor(150, 150, 150,200);
        roundedRect(pos.x, pos.y+(height*0.5), width, height*0.5,6);
    }
    ofSetColor(255, 255, 255);
    font.drawString(name, pos.x+width+5, pos.y+height);
    ofPopStyle();
    //isOn=false;
}
Ejemplo n.º 6
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
}
Ejemplo n.º 7
0
void drawArgs(ofTrueTypeFont font, vector<string> args) {
    string allArgs = "Args: ";
    for(string arg : args) {
        allArgs += arg;
        allArgs += "\n";
    }
    font.drawString(allArgs, GUTTER, TEXT_Y);
}
Ejemplo n.º 8
0
	void draw() {
		ofPushStyle();
		ofSetColor(255, 128);
		if(messages.size()) {
			font.drawString(joined.str(), 10, 20);
		}
		ofPopStyle();
	}
Ejemplo n.º 9
0
void drawStimulus(string letter, bool showInstructions) {
	ofBackground(backgroundColor);
	ofSetColor(textColor);
	Draw::centeredString(Disp.getCenter(), letter, bigFont);

	if (showInstructions) {
		smallFont.drawString(keyReminderInstructions, 30, Disp.getResolution().y - 30);
	}
}
Ejemplo n.º 10
0
void Graph::drawString(string text, int x, int y) const {
	ofPushStyle();
	ofFill();
	ofRectangle box = font.getStringBoundingBox(text, x, y);
	box.x -= 1;
	box.y -= 1;
	box.width += 2;
	box.height += 2;
	ofSetColor(noData ? 64 : 0);
	ofRect(box);
	ofSetColor(noData ? 192 : 255);
	font.drawString(text, x, y);
	ofPopStyle();
}
Ejemplo n.º 11
0
void ofApp::draw(){

	font.drawString(appInfo, 2, 12);	
	drawTrunk(frameNumber, rotationAngle);
}
Ejemplo n.º 12
0
//------------------------------------------------------------------
void uiPresent::draw(ofTrueTypeFont& basicFont) {

    sprintf (timeString, "time: %0.2i:%0.2i:%0.2i \nelapsed time %i", ofGetHours(), ofGetMinutes(), ofGetSeconds(), ofGetElapsedTimeMillis());
	
    ofSetHexColor(0x000000);
	basicFont.drawString(timeString, 10,ofGetHeight()-90);
	basicFont.drawString(eventString, 10,ofGetHeight()-20);
    
    ofEnableAlphaBlending();
    
    ofSetColor(170, 170, 170);
    ofRect(*pencilBox);
    ofRect(*fontBox);
    ofRect(*tableBox);
    ofRect(*okSaveBox);
    
    ofSetHexColor(0x000000);

    pencil->draw(10, 310);
    font->draw(10, 355);
    table->draw(10, 400);
    okSave->draw(10, 445);

    if (*fontSelected) {
        basicFont.drawString(theText, 40, 40);
        thisText->draw(basicFont);
        basicFont.drawString("text selected", 10, ofGetHeight()/3);
        
        for (int i = 0; i < drawThese.size(); i++) {
            drawThese[i].draw();
        }

    }
    
    if (*pencilSelected) {

        basicFont.drawString(theText, 40, 40);
        thisText->draw(basicFont);
        basicFont.drawString("pencil selected", 10, ofGetHeight()/3);
        
        for (int i = 0; i < drawThese.size(); i++) {
            drawThese[i].draw();
        }
        
        if (currentDrawing.size()>0) {
            for (int i = 1; i < currentDrawing.size(); i++) {
                ofLine(currentDrawing[i-1].x, currentDrawing[i-1].y, currentDrawing[i].x, currentDrawing[i].y);
            }
        }
    }
    
    if (*tableSelected) {
        basicFont.drawString(theText, 40, 40);
        thisText->draw(basicFont);
        for (int i = 0; i < drawThese.size(); i++) {
            drawThese[i].draw();
        }
        basicFont.drawString("table selected", 10, ofGetHeight()/3);
    }

    if (*okSaveSelected) {
        basicFont.drawString(theText, 40, 40);
        thisText->draw(basicFont);
        for (int i = 0; i < drawThese.size(); i++) {
            drawThese[i].draw();
        }

        basicFont.drawString("ok save selected", 10, ofGetHeight()/3);
    }

    
    ofDisableAlphaBlending();

}
Ejemplo n.º 13
0
void Player::draw( ofTrueTypeFont _font, vector< Object > _recordedList ) {
    
    // We want to do something when the vector is empty, but not during the action that empties it, so we use a boolean that activates only after that last action is complete.
    if ( _recordedList.size() > 0 ) {
        bIsEmpty = false;
    } else if ( !bIsActing ) {
        bIsEmpty = true;
    }
    // We want to do something when the vector is full, but not during the action that fills it, so we use a boolean that activates only after that last action is complete.
    if ( _recordedList.size() < capacity ) {
        bIsFull = false;
    } else if ( !bIsActing ) {
        bIsFull = true;
    }
    
    // Display an outline of the next replayable note (drawn from the center).
    if ( _recordedList.size() > 0 ) {
        
        ofSetRectMode( OF_RECTMODE_CENTER );
        ofNoFill();
        ofRect( pos.x, _recordedList[ 0 ].pos.y, _recordedList[ 0 ].wide, _recordedList[ 0 ].tall );
        ofFill();
    }
    
    // Draw the player.
    ofSetRectMode( OF_RECTMODE_CENTER );
    ofSetColor( 0 );
    //ofRect( pos, wide, tall );
    
    // Draw the health. Taken from my Space Odyssey 2 code.
    ofPushMatrix();{
        
        ofTranslate( pos.x, pos.y);
        
        
        { // Matt
            // Draw the health bar
            ofSetRectMode( OF_RECTMODE_CORNER );
            float offset = 1;
            float offsetBar = 10;
            float barHeight = 10;
            float barLength = wide * 2;
            float currentHealth = ofMap( fHealth, 0, fHealthMax, 0, barLength - offset * 2 );
            // The border.
            ofSetColor( 255 );
            ofNoFill();
            ofRect( -wide, wide / 2 + offsetBar, barLength, barHeight );
            ofFill();
            // The current health.
            ofSetColor( 0, 255, 0 );
            ofRect( -wide + offset, wide / 2 + offsetBar + offset, currentHealth, barHeight - offset * 2 );
        } // End Matt
         
        
    }ofPopMatrix();
    
    ofSetColor( 255 );
    ofSetRectMode( OF_RECTMODE_CORNER );
    //headphones.draw( pos, 50, 50 );
    hand.draw( pos.x - wide / 2, pos.y - tall / 2, wide, tall );
    
    // Display a visual indicator of recorded capacity.
    if ( _recordedList.size() > 1 ) {
        for ( int i = 0; i < _recordedList.size(); i++ ) {
            float rad, tmpPosX, tmpPosY, hOffset, vOffset;
            rad = 3;
            //hOffset = ( wide - ( rad * 3 ) ) / 4;
            hOffset = wide / 4;
            vOffset = tall / 4;
            if ( i < 3 ) {
                tmpPosX = pos.x - wide / 2 + hOffset + hOffset * i;
                tmpPosY = pos.y - tall / 2 + vOffset;
            } else if ( i >= 3 && i < 6 ) {
                tmpPosX = pos.x - wide / 2 + hOffset + hOffset * ( i - 3 );
                tmpPosY = pos.y - tall / 2 + vOffset * 2;
            } else if ( i >= 6 && i < 9 ) {
                tmpPosX = pos.x - wide / 2 + hOffset + hOffset * ( i - 6 );
                tmpPosY = pos.y - tall / 2 + vOffset * 3;
            }
            ofNoFill();
            ofSetColor( 255 );
            ofCircle( tmpPosX, tmpPosY, rad );
            ofFill();
        }
    }
    
    // Draw the action if called, orbiting around the player's pos.
    if ( bIsActing ) {
        if ( bIsRecording ) {
            // Feedback for no capacity.
            if ( bIsFull ) {
                ofSetColor( 0 );
                _font.drawString("X", pos.x + 30, pos.y - 30 );
            }
            ofSetColor( 0, 255, 0 );
        }
        else if ( bIsReplaying ) {
            // Feedback for nothing to replay.
            if ( bIsEmpty ) {
                ofSetColor( 0 );
                _font.drawString("?", pos.x + 30, pos.y - 30 );
            }
            ofSetColor( 0, 0, 255 );
        }
        ofCircle( actPos, 10 );
    }
}
Ejemplo n.º 14
0
void PMSc10Thanks::drawLeftAlignString(ofTrueTypeFont &font, string s, int x, int y)
{
    int halfStringHeight = font.stringHeight(s) / 2;
    font.drawString(s, x, y + halfStringHeight);
}
Ejemplo n.º 15
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);
}
Ejemplo n.º 16
0
void BossBattle::draw( ofTrueTypeFont _font ) {
    _font.drawString( "This is not yet fully implemented. :(\nCheck back later.", iScaler * 8, iScaler * 4 );
}
Ejemplo n.º 17
0
 void text(string& text, float x, float y)
 {
     handleDefaultTextFont(m_textSize);
     m_currentTextFont.drawString(text, x, y);
 }