Simplify GLFont drawString usage

This commit is contained in:
Charles J. Cliffe
2014-12-08 20:39:38 -05:00
parent da8d178e34
commit 7f9a871598
3 changed files with 56 additions and 27 deletions
+1 -10
View File
@@ -33,16 +33,7 @@ void SpectrumContext::Draw(std::vector<float> &points) {
glPopMatrix();
}
GLint vp[4];
glGetIntegerv( GL_VIEWPORT, vp);
std::string msgStr("Welcome to CubicSDR -- This is a test string. 01234567890!@#$%^&*()_[]");
float charHeight = 62.0;
float viewAspect = (float)vp[2]/(float)vp[3];
float msgWidth = getFont()->getStringWidth(msgStr,charHeight/(float)vp[3],viewAspect);
getFont()->drawString(msgStr,0.0-(msgWidth/2.0),0.0,charHeight/(float)vp[3],viewAspect);
getFont()->drawString("Welcome to CubicSDR -- This is a test string. 01234567890!@#$%^&*()_[]",0.0,0.0,31,GLFont::GLFONT_ALIGN_CENTER,GLFont::GLFONT_ALIGN_CENTER);
CheckGLError();
}