mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	emu_window: Adapt Touchscreen to 3D Settings
This commit is contained in:
		
							parent
							
								
									523c52c708
								
							
						
					
					
						commit
						74367203cf
					
				
					 1 changed files with 21 additions and 6 deletions
				
			
		|  | @ -60,9 +60,17 @@ EmuWindow::~EmuWindow() { | ||||||
|  */ |  */ | ||||||
| static bool IsWithinTouchscreen(const Layout::FramebufferLayout& layout, unsigned framebuffer_x, | static bool IsWithinTouchscreen(const Layout::FramebufferLayout& layout, unsigned framebuffer_x, | ||||||
|                                 unsigned framebuffer_y) { |                                 unsigned framebuffer_y) { | ||||||
|     return ( |     if (Settings::values.toggle_3d) { | ||||||
|         framebuffer_y >= layout.bottom_screen.top && framebuffer_y < layout.bottom_screen.bottom && |         return (framebuffer_y >= layout.bottom_screen.top && | ||||||
|         framebuffer_x >= layout.bottom_screen.left && framebuffer_x < layout.bottom_screen.right); |                 framebuffer_y < layout.bottom_screen.bottom && | ||||||
|  |                 framebuffer_x >= layout.bottom_screen.left / 2 && | ||||||
|  |                 framebuffer_x < layout.bottom_screen.right / 2); | ||||||
|  |     } else { | ||||||
|  |         return (framebuffer_y >= layout.bottom_screen.top && | ||||||
|  |                 framebuffer_y < layout.bottom_screen.bottom && | ||||||
|  |                 framebuffer_x >= layout.bottom_screen.left && | ||||||
|  |                 framebuffer_x < layout.bottom_screen.right); | ||||||
|  |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| std::tuple<unsigned, unsigned> EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) { | std::tuple<unsigned, unsigned> EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) { | ||||||
|  | @ -80,9 +88,16 @@ void EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) { | ||||||
|         return; |         return; | ||||||
| 
 | 
 | ||||||
|     std::lock_guard<std::mutex> guard(touch_state->mutex); |     std::lock_guard<std::mutex> guard(touch_state->mutex); | ||||||
|  |     if (Settings::values.toggle_3d) { | ||||||
|  |         touch_state->touch_x = | ||||||
|  |             static_cast<float>(framebuffer_x - framebuffer_layout.bottom_screen.left / 2) / | ||||||
|  |             (framebuffer_layout.bottom_screen.right / 2 - | ||||||
|  |              framebuffer_layout.bottom_screen.left / 2); | ||||||
|  |     } else { | ||||||
|         touch_state->touch_x = |         touch_state->touch_x = | ||||||
|             static_cast<float>(framebuffer_x - framebuffer_layout.bottom_screen.left) / |             static_cast<float>(framebuffer_x - framebuffer_layout.bottom_screen.left) / | ||||||
|             (framebuffer_layout.bottom_screen.right - framebuffer_layout.bottom_screen.left); |             (framebuffer_layout.bottom_screen.right - framebuffer_layout.bottom_screen.left); | ||||||
|  |     } | ||||||
|     touch_state->touch_y = |     touch_state->touch_y = | ||||||
|         static_cast<float>(framebuffer_y - framebuffer_layout.bottom_screen.top) / |         static_cast<float>(framebuffer_y - framebuffer_layout.bottom_screen.top) / | ||||||
|         (framebuffer_layout.bottom_screen.bottom - framebuffer_layout.bottom_screen.top); |         (framebuffer_layout.bottom_screen.bottom - framebuffer_layout.bottom_screen.top); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue