Skip to content

Commit a2cd330

Browse files
Add SDL_MOUSEBUTTONDOWN event data
1 parent a0526f5 commit a2cd330

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

event.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,21 @@ zend_bool sdl_event_to_zval(SDL_Event *event, zval *value TSRMLS_DC)
4949
case SDL_MOUSEMOTION: {
5050
zval motion;
5151
object_init(&motion);
52+
add_property_long(&motion, "state", event->motion.state TSRMLS_CC);
5253
add_property_long(&motion, "x", event->motion.x TSRMLS_CC);
5354
add_property_long(&motion, "y", event->motion.y TSRMLS_CC);
5455
add_property_zval(value, "motion", &motion TSRMLS_CC);
5556
zval_ptr_dtor(&motion);
5657
} break;
58+
case SDL_MOUSEBUTTONDOWN: {
59+
zval button;
60+
object_init(&button);
61+
add_property_long(&button, "button", event->button.button TSRMLS_CC);
62+
add_property_long(&button, "x", event->button.x TSRMLS_CC);
63+
add_property_long(&button, "y", event->button.y TSRMLS_CC);
64+
add_property_zval(value, "button", &button TSRMLS_CC);
65+
zval_ptr_dtor(&button);
66+
} break;
5767
case SDL_KEYDOWN:
5868
case SDL_KEYUP: {
5969
zval keysym;

0 commit comments

Comments
 (0)