src/emu/render.c
| r15901 | r15902 | |
| 1920 | 1920 | |
| 1921 | 1921 | bool render_target::map_point_internal(INT32 target_x, INT32 target_y, render_container *container, float &mapped_x, float &mapped_y, const char *&mapped_input_tag, ioport_value &mapped_input_mask) |
| 1922 | 1922 | { |
| 1923 | // compute the visible width/height |
| 1924 | INT32 viswidth, visheight; |
| 1925 | compute_visible_area(m_width, m_height, m_pixel_aspect, m_orientation, viswidth, visheight); |
| 1926 | |
| 1927 | // create a root transform for the target |
| 1928 | object_transform root_xform; |
| 1929 | root_xform.xoffs = (float)(m_width - viswidth) / 2; |
| 1930 | root_xform.yoffs = (float)(m_height - visheight) / 2; |
| 1931 | |
| 1923 | 1932 | // default to point not mapped |
| 1924 | 1933 | mapped_x = -1.0; |
| 1925 | 1934 | mapped_y = -1.0; |
| r15901 | r15902 | |
| 1927 | 1936 | mapped_input_mask = 0; |
| 1928 | 1937 | |
| 1929 | 1938 | // convert target coordinates to float |
| 1930 | | float target_fx = (float)target_x / m_width; |
| 1931 | | float target_fy = (float)target_y / m_height; |
| 1939 | float target_fx = (float)(target_x - root_xform.xoffs) / viswidth; |
| 1940 | float target_fy = (float)(target_y - root_xform.yoffs) / visheight; |
| 1932 | 1941 | |
| 1933 | 1942 | // explicitly check for the UI container |
| 1934 | 1943 | if (container != NULL && container == &m_manager.ui_container()) |
| r15901 | r15902 | |
| 1937 | 1946 | if (target_fx >= 0.0 && target_fx < 1.0 && target_fy >= 0.0 && target_fy < 1.0) |
| 1938 | 1947 | { |
| 1939 | 1948 | // this point was successfully mapped |
| 1940 | | mapped_x = target_fx; |
| 1941 | | mapped_y = target_fy; |
| 1949 | mapped_x = (float)target_x / m_width; |
| 1950 | mapped_y = (float)target_y / m_height; |
| 1942 | 1951 | return true; |
| 1943 | 1952 | } |
| 1944 | 1953 | return false; |