mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-03 14:35:03 -04:00
add GLTextPanel, initial work on nested coordinate systems
This commit is contained in:
+10
-6
@@ -397,16 +397,20 @@ float GLFont::getStringWidth(std::string str, float size, float viewAspect) {
|
||||
return width;
|
||||
}
|
||||
|
||||
void GLFont::drawString(std::string str, float xpos, float ypos, int pxHeight, Align hAlign, Align vAlign) {
|
||||
void GLFont::drawString(std::string str, float xpos, float ypos, int pxHeight, Align hAlign, Align vAlign, int vpx, int vpy) {
|
||||
|
||||
GLint vp[4];
|
||||
|
||||
pxHeight *= 2;
|
||||
|
||||
glGetIntegerv( GL_VIEWPORT, vp);
|
||||
|
||||
float size = (float) pxHeight / (float) vp[3];
|
||||
float viewAspect = (float) vp[2] / (float) vp[3];
|
||||
if (!vpx || !vpy) {
|
||||
GLint vp[4];
|
||||
glGetIntegerv( GL_VIEWPORT, vp);
|
||||
vpx = vp[2];
|
||||
vpy = vp[3];
|
||||
}
|
||||
|
||||
float size = (float) pxHeight / (float) vpy;
|
||||
float viewAspect = (float) vpx / (float) vpy;
|
||||
float msgWidth = getStringWidth(str, size, viewAspect);
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ public:
|
||||
bool isLoaded();
|
||||
|
||||
float getStringWidth(std::string str, float size, float viewAspect);
|
||||
void drawString(std::string str, float xpos, float ypos, int pxHeight, Align hAlign = GLFONT_ALIGN_LEFT, Align vAlign = GLFONT_ALIGN_TOP);
|
||||
void drawString(std::string str, float xpos, float ypos, int pxHeight, Align hAlign = GLFONT_ALIGN_LEFT, Align vAlign = GLFONT_ALIGN_TOP, int vpx=0, int vpy=0);
|
||||
|
||||
static GLFont fonts[GLFONT_MAX];
|
||||
static GLFont &getFont(GLFontSize esize);
|
||||
|
||||
Reference in New Issue
Block a user