greenhouse
a creative coding toolkit for spatial interfaces

Print Helpers

String conversion conveniences.

  • ToStr ()
  • ToChar ()

Example

#define WORKER
#include "Greenhouse.h"

void Setup ()
{ // This will output "boolean b is false"
  bool b = false;
  INFORM ("boolean b is " + ToStr (b));

  // This will output "int i is 3"
  int64 i = 3;
  INFORM ("int i is " + ToStr (i));

  // This will output "float f is 1.234"
  float64 f = 1.2345;
  INFORM ("float f is " + ToStr (f));

  // This will output "Vect[3.000, 2.000, 1.000]"
  Vect v = Vect (3, 2, 1);
  INFORM ("Vect v = " + ToStr (v));

  // This will output "Color c = Color(1.000, 0.000, 0.000, 1.000)"
  Color c = Color (1, 0, 0, 1); //RGBA
  INFORM ("Color c = " + ToStr (c));

  // This will output "Trove t = [a, b]"
  Trove <Str> t;
  t . Append ("a");
  t . Append ("b");
  INFORM ("Trove t = " + ToStr (t));

  // This will output "Dict d = {'c': 42, 'd': 1033}"
  Dictionary <Str, int64> d;
  d . Put ("c", 42);
  d . Put ("d", 1033);
  INFORM ("Dict d = " + ToStr (d));

  // This will output "const char * cc = hello world"
  Str s = "hello world";
  const char * cc = ToChar(s);
  printf("const char * cc = %s\n", cc);
}