input_events: Show mouse point on mouse button pressed

This commit is contained in:
Carlos Aragones 2021-02-19 11:13:32 +01:00
parent fa8bf266f0
commit cc79a85e3d
2 changed files with 24 additions and 17 deletions

View File

@ -66,10 +66,13 @@ char_input(struct mfb_window *window, unsigned int charCode) {
void
mouse_btn(struct mfb_window *window, mfb_mouse_button button, mfb_key_mod mod, bool isPressed) {
const char *window_title = "";
int x, y;
if(window) {
window_title = (const char *) mfb_get_user_data(window);
}
fprintf(stdout, "%s > mouse_btn: button: %d (pressed: %d) [key_mod: %x]\n", window_title, button, isPressed, mod);
x = mfb_get_mouse_x(window);
y = mfb_get_mouse_y(window);
fprintf(stdout, "%s > mouse_btn: button: %d (pressed: %d) (at: %d, %d) [key_mod: %x]\n", window_title, button, isPressed, x, y, mod);
}
void

View File

@ -60,11 +60,15 @@ public:
}
void mouse_btn(struct mfb_window *window, mfb_mouse_button button, mfb_key_mod mod, bool isPressed) {
const char *window_title = "";
const char *window_title = "";
int x, y;
if(window) {
window_title = (const char *) mfb_get_user_data(window);
}
fprintf(stdout, "%s > mouse_btn: button: %d (pressed: %d) [key_mod: %x]\n", window_title, button, isPressed, mod);
x = mfb_get_mouse_x(window);
y = mfb_get_mouse_y(window);
fprintf(stdout, "%s > mouse_btn: button: %d (pressed: %d) (at: %d, %d) [key_mod: %x]\n", window_title, button, isPressed, x, y, mod);
}
void mouse_move(struct mfb_window *window, int x, int y) {