Ejemplo n.º 1
0
//--------------------------------------------------------------
float ofxMuiTextBlock::getTextHeight() const {
    if(isTextHorizontal()) {
        return getBlockHeight();
    } else {
        return getBlockWidth();
    }
}
Ejemplo n.º 2
0
//--------------------------------------------------------------
void ofxMuiTextBlock::draw(float x, float y) {
    
    ofPushStyle();
    ofPushMatrix();
    ofTranslate(x,y);
    {        
        
        if(debug) {
            ofSetColor(255,255,0);
            ofLine(0,0,0,ofGetHeight());
            ofLine(0,0,ofGetWidth(),0);
            
            ofPushStyle();
            if(isTextWidthLimited()) {
                ofSetColor(255,0,0);
                ofLine(getBlockWidth(),0,getBlockWidth(),ofGetHeight());
            } 
            if(isTextHeightLimited()) {
                ofSetColor(255,0,0);
                ofLine(0,getBlockHeight(),ofGetWidth(),getBlockHeight());
            }
            ofPopStyle();
        }
        
        ofTranslate(0,font->getSize());

        ofSetColor(cTextColor);
        font->drawString(displayText,0,0);
    
        
        /*
         
         if(!displayText.empty()) {
         ofSetColor(cTextColor);
         
         ofPushMatrix();
         // TODO: add support for various text alignments
         ofRectangle drawOffsets = displayStringBoundingBox;
         
         switch(orientation) {
         case OF_ORIENTATION_UNKNOWN: // if unknown, use default
         case OF_ORIENTATION_DEFAULT:	
         ofTranslate(0, labelFont->getSize());
         break;
         case OF_ORIENTATION_180:
         ofTranslate(displayStringBoundingBox.width, getContentBoxHeight() - labelFont->getSize());
         ofRotateZ(180);
         break;
         case OF_ORIENTATION_90_RIGHT:
         ofTranslate(0,0);
         ofRotateZ(90);
         break;
         case OF_ORIENTATION_90_LEFT:
         // TODO: this is off in the Y direction ... not sure why.
         ofTranslate(font->getSize(), 
         getTextBoxHeight());
         ofRotateZ(-90);
         break;
         }
         
         //font->drawString(displayText,drawOffsets.x,drawOffsets.y);
         ofPopMatrix();
         }
         */
        
    }
    ofPopMatrix();
    ofPopStyle();
}
Ejemplo n.º 3
0
QPoint GameController::Center(const QPoint& _coordinate)//游戏坐标到屏幕格子中心坐标
{return QPoint((int)((_coordinate.x()+0.5)*getBlockWidth()),(int)((_coordinate.y()+0.5)*getBlockHeight()));}