Method: Nuklear::Context::EventSink#motion

Defined in:
ext/nuklear/nkrb_context.c

#motion(rx, ry, rxrel, ryrel) ⇒ Object



101
102
103
104
105
106
107
108
109
110
# File 'ext/nuklear/nkrb_context.c', line 101

VALUE nkrb_event_sink_motion(VALUE self, VALUE rx, VALUE ry, VALUE rxrel, VALUE ryrel) {
  VALUE_TO_NK(rb_ivar_get(self, rb_intern("@context")), ctx);
  if (ctx->input.mouse.grabbed) {
    int x = (int) ctx->input.mouse.prev.x, y = (int) ctx->input.mouse.prev.y;
    nk_input_motion(ctx, x + FIX2INT(rxrel), y + FIX2INT(ryrel));
  } else {
    nk_input_motion(ctx, FIX2INT(rx), FIX2INT(ry));
  }
  return self;
}