Example #1
0
void HexagonGame::drawText()
{
    ostringstream s;
    s << "time: " << toStr(currentTime).substr(0, 5) << endl;
    if(hasDied) s << "press r to restart" << endl;

    vector<Vector2f> offsets{{-1,-1},{-1,1},{1,-1},{1,1}};

    Text timeText(s.str(), getFont("imagine"), 25 / getZoomFactor());
    timeText.setPosition(15, 3);
    timeText.setColor(getColorMain());
    for(auto offset : offsets)
    {
        Text timeOffsetText(s.str(), getFont("imagine"), timeText.getCharacterSize());
        timeOffsetText.setPosition(timeText.getPosition() + offset);
        timeOffsetText.setColor(getColorB());
        drawOnWindow(timeOffsetText);
    }
    drawOnWindow(timeText);

    for (Text* textPtr : messageTextPtrs)
    {
        for(auto offset : offsets)
        {
            Text textPtrOffset{textPtr->getString(), getFont("imagine"), textPtr->getCharacterSize()};
            textPtrOffset.setPosition(textPtr->getPosition() + offset);
            textPtrOffset.setOrigin(textPtrOffset.getGlobalBounds().width / 2, 0);
            textPtrOffset.setColor(getColorB());
            drawOnWindow(textPtrOffset);
        }

        textPtr->setColor(getColorMain());
        drawOnWindow(*textPtr);
    }
}
Example #2
0
void ofxGuiGrid::drawSelectedRect( float x, float y, float width, float height ) {

	glShadeModel( GL_SMOOTH );
	glBegin( GL_LINE_LOOP );
		glColor4f( getColorR(), getColorG(), getColorB(), getColorA() );
		glVertex3f( x, y, 0 );
		glVertex3f( x, y + height, 0 );
		glVertex3f( x + width, y + height, 0 );
		glVertex3f( x + width, y, 0 );
	glEnd();
}