Module: SFML::Touch
- Defined in:
- ext/window/touch.c,
ext/window/touch.c
Overview
Real-time touch-screen state.
Class Method Summary collapse
-
.down?(finger) ⇒ Boolean
Returns
trueif touch pointfingeris currently down. -
.position(finger, window = nil) ⇒ Vector2
Returns the position of touch point
finger.
Class Method Details
.down?(finger) ⇒ Boolean
Returns true if touch point finger is currently down.
35 36 37 |
# File 'ext/window/touch.c', line 35
static VALUE Touch_is_down(VALUE module, VALUE rb_finger) {
return BOOL2RB(sfTouch_isDown(NUM2UINT(rb_finger)));
}
|
.position(finger, window = nil) ⇒ Vector2
Returns the position of touch point finger.
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'ext/window/touch.c', line 47
static VALUE Touch_get_position(int argc, VALUE* argv, VALUE module) {
VALUE rb_finger, rb_window;
sfVector2i position;
rb_scan_args(argc, argv, "11", &rb_finger, &rb_window);
if (NIL_P(rb_window)) {
position = sfTouch_getPosition(NUM2UINT(rb_finger), NULL);
} else {
position = Touch_relative_position(NUM2UINT(rb_finger), rb_window);
}
return vec2f_to_rb((sfVector2f){(float)position.x, (float)position.y});
}
|