From be19f5a21dc1fe717711d76f500f6bfe0c4d166b Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Wed, 4 Sep 2013 15:30:03 +0100 Subject: adding final audio feature --- rotord/src/nodes_drawing.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'rotord/src/nodes_drawing.h') 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 &settings):Text() { base_settings(settings); @@ -54,14 +55,19 @@ namespace Rotor { ~Text(){}; Text* clone(map &_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: -- cgit v1.2.3