Skip to content

mirror_y

Alexandre Marcireau edited this page May 30, 2018 · 8 revisions

In header "../third_party/tarsier/source/mirror_y.hpp"

tarsier::MirrorY reflects the event's y property in a horizontal axis.

namespace tarsier {
    template <typename Event, std::size_t height,typename HandleEvent>
    class MirrorY {
        public:
            MirrorY(HandleEvent handleEvent);

            /// operator() handles an event.
            virtual void operator()(Event event);
    };
}
  • Event is the input type. It must have at least the property y.
  • height is the highest y possible plus one. As an example, if y is in the range [0, 239], then height must be 240.
  • HandlEvent is the event handler. The expression handleEvent(event), where event is an Event, must be valid.

Event must be specified when using make_mirrorY:

struct Event {
    std::size_t y;
};

auto mirrorY = tarsier::make_mirrorY<Event, 240>([](Event event) {
    // do something with event
});
Clone this wiki locally