summaryrefslogtreecommitdiff
path: root/rotord/src/nodes_drawing.h
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2013-09-04 15:30:03 +0100
committerTim Redfern <tim@eclectronics.org>2013-09-04 15:30:03 +0100
commitbe19f5a21dc1fe717711d76f500f6bfe0c4d166b (patch)
tree8cffe4ea47bd5cd66f8fe5fd1fb537c40a52e8f4 /rotord/src/nodes_drawing.h
parentbb4e23344b03c4f0947852530e13885035a6c3fb (diff)
adding final audio feature
Diffstat (limited to 'rotord/src/nodes_drawing.h')
-rw-r--r--rotord/src/nodes_drawing.h14
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: