Skip to content

shift_y

Alexandre Marcireau edited this page May 31, 2018 · 3 revisions

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

tarsier::shift_y translates the y coordinate.

namespace tarsier {
    template <typename Event, typename HandleEvent>
    class shift_y {
        public:
        shift_x(uint16_t width, int32_t shift, HandleEvent handle_event);

        /// operator() handles an event.
        virtual void operator()(Event event);
    };
}
  • Event is the input type. It must have at least the property y.
  • The expression handle_event(event), where event is an Event object, must be valid.
  • height is the maximum y coordinate plus one (if y is in the integer range [0, 239], height must be 320).
  • shift is the y coordinate translation. It can be positive (shift to the top) or negative (shift to the bottom).

Event must be specified when using make_shift_y:

struct event {
    uint16_t y;
};

auto shift_y = tarsier::make_shift_y<event>(
    239,
    -10,
    [](event event) {
        // do something with event
    });
Clone this wiki locally