Revision: 6942
http://playerstage.svn.sourceforge.net/playerstage/?rev=6942&view=rev
Author: jeremy_asher
Date: 2008-08-01 21:03:15 +0000 (Fri, 01 Aug 2008)
Log Message:
-----------
stage: fixed speech bubble and clock string background sizing issues
Modified Paths:
--------------
code/stage/trunk/libstage/canvas.cc
code/stage/trunk/libstage/model.cc
Modified: code/stage/trunk/libstage/canvas.cc
===================================================================
--- code/stage/trunk/libstage/canvas.cc 2008-08-01 19:48:20 UTC (rev 6941)
+++ code/stage/trunk/libstage/canvas.cc 2008-08-01 21:03:15 UTC (rev 6942)
@@ -739,17 +739,22 @@
std::string clockstr = world->ClockString();
if( showFollow == true && last_selection )
clockstr.append( " [ FOLLOW MODE ]" );
-
- int margin = 3;
- float width = gl_width( clockstr.c_str() ) + 2 * margin;
- float height = gl_height() + 2 * margin;
+ fl_font( FL_HELVETICA, 12 );
+ float txtWidth = gl_width( clockstr.c_str() );
+ int txtHeight = gl_height();
+
+ int width, height;
+ width = int( txtWidth / 10 ) * 10;
+ height = ( txtHeight / 5 + 1 ) * 5;
+ float margin = ( height - txtHeight ) * 0.75;
+
colorstack.Push( 0.8,0.8,1.0 ); // pale blue
glRectf( 0, 0, width, height );
colorstack.Pop();
colorstack.Push( 0,0,0 ); // black
- gl_draw_string( margin, margin, 5, clockstr.c_str() );
+ gl_draw_string( margin, margin, 0, clockstr.c_str() );
colorstack.Pop();
glEnable( GL_DEPTH_TEST );
Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc 2008-08-01 19:48:20 UTC (rev 6941)
+++ code/stage/trunk/libstage/model.cc 2008-08-01 21:03:15 UTC (rev 6942)
@@ -1020,6 +1020,7 @@
float robotAngle = -rtod(pose.a);
glPushMatrix();
+ fl_font( FL_HELVETICA, 12 );
float w = gl_width( this->say_string ); // scaled text width
float h = gl_height(); // scaled text height
@@ -1079,7 +1080,7 @@
PushColor( BUBBLE_TEXT );
// draw text inside the bubble
- gl_draw_string( 2*m, 2*m, 0, this->say_string );
+ gl_draw_string( 2.5*m, 2.5*m, 0, this->say_string );
PopColor();
glPopMatrix();
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit