Mercurial > repos > blastem
comparison io.c @ 914:28ec32e720b2
Scale mouse data based on window size
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 14 Dec 2015 19:36:01 -0800 |
parents | a5a51465f8b0 |
children | 9e882eca717e |
comparison
equal
deleted
inserted
replaced
913:a5a51465f8b0 | 914:28ec32e720b2 |
---|---|
410 { | 410 { |
411 if (mouse >= MAX_MICE || !mice[mouse].motion_port) { | 411 if (mouse >= MAX_MICE || !mice[mouse].motion_port) { |
412 return; | 412 return; |
413 } | 413 } |
414 //TODO: relative mode | 414 //TODO: relative mode |
415 //TODO: scale based on window size | 415 float scale_x = 640.0 / ((float)render_width()); |
416 mice[mouse].motion_port->device.mouse.cur_x = x; | 416 float scale_y = 480.0 / ((float)render_height()); |
417 mice[mouse].motion_port->device.mouse.cur_y = y; | 417 float scale = scale_x > scale_y ? scale_y : scale_x; |
418 mice[mouse].motion_port->device.mouse.cur_x = x * scale_x; | |
419 mice[mouse].motion_port->device.mouse.cur_y = y * scale_y; | |
418 } | 420 } |
419 | 421 |
420 int parse_binding_target(char * target, tern_node * padbuttons, tern_node *mousebuttons, int * ui_out, int * padnum_out, int * padbutton_out) | 422 int parse_binding_target(char * target, tern_node * padbuttons, tern_node *mousebuttons, int * ui_out, int * padnum_out, int * padbutton_out) |
421 { | 423 { |
422 const int gpadslen = strlen("gamepads."); | 424 const int gpadslen = strlen("gamepads."); |