diff options
Diffstat (limited to 'rotord/src/nodes_drawing.h')
| -rw-r--r-- | rotord/src/nodes_drawing.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h index d91ad87..db1d934 100644 --- a/rotord/src/nodes_drawing.h +++ b/rotord/src/nodes_drawing.h @@ -47,6 +47,7 @@ namespace Rotor { title="Text"; description="Draws text"; create_attribute("text","Text to draw","Text","hello, world!"); + create_parameter("number","number","Number to draw","Number",-99999999.0f); }; Text(map<string,string> &settings):Text() { base_settings(settings); @@ -54,14 +55,19 @@ namespace Rotor { ~Text(){}; Text* clone(map<string,string> &_settings) { return new Text(_settings);}; void vector_output(cairo_t * cr,const Frame_spec &frame){ + string text; + if (parameters["number"]->value>-99999998.0f){ + text=ofToString(parameters["number"]->value,4); + } + else text=attributes["text"]->value; cairo_text_extents_t te; cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); cairo_select_font_face (cr, "Georgia", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); - cairo_set_font_size (cr, 250); - cairo_text_extents(cr, attributes["text"]->value.c_str(), &te); - cairo_move_to (cr,(frame.w-te.width)/2,(frame.h-te.height)/2); - cairo_show_text (cr, attributes["text"]->value.c_str()); + cairo_set_font_size (cr, 120); + cairo_text_extents(cr, text.c_str(), &te); + cairo_move_to (cr,(frame.w-te.width)/2,frame.h*0.6); + cairo_show_text (cr, text.c_str()); cairo_fill(cr); } private: |
