greenhouse
a creative coding toolkit for spatial interfaces

Heeding methods for Node objects

In an interactive space with multiple concurrent inputs, it can be important to make sure that an object can be in exclusive control of a single person / input device. Consider dragging behavior: while something is being dragging, we typically want it to be under the control of one stream of events, from one user, for the whole drag.

In Greenhouse, we can say that the object is ‘heeding’ an event source. When an object is released, and not tracking any particular event source in an exclusive way, we say that is it “heedless”.

Each event source in Greenhouse has an identifier we call its ‘provenance’. This is simply a string that’s unique for each event source (such as a mouse, a keyboard, a Leap Motion device, a Wiimote, etc.

  • Heed ()
  • StopHeeding ()
  • Heeding ()
  • IsHeeding ()
  • IsHeedless ()

Example

#include "Greenhouse.h"

class Txt  :  public Text
{ public:

  Txt (const Str &s)  :  Text (s) { SlapOnFeld (); }

  void PointingHarden (PointingEvent *e)
    { if (IsHeedless ())
        { Heed (e); }
    }

  void PointingSoften (PointingEvent *e)
    { StopHeeding (); }

  void PointingMove (PointingEvent *e)
    { if (IsHeeding (e))
        { INFORM ("Yup, I'm heeding " + Heeding ());
          IncTranslation (IntersectionDiff (e, Loc ()));
        }
    }
};

void Setup ()
{ new Txt ("Hello, world!"); }