mirror of
				https://github.com/raysan5/raylib.git
				synced 2025-10-26 12:27:01 +00:00 
			
		
		
		
	Implement Android-specific functions (#4769)
`GetWindowScaleDPI` and monitor physical dimensions
This commit is contained in:
		| @@ -460,17 +460,21 @@ int GetMonitorHeight(int monitor) | |||||||
| } | } | ||||||
|  |  | ||||||
| // Get selected monitor physical width in millimetres | // Get selected monitor physical width in millimetres | ||||||
|  | // NOTE: It seems to return a slightly underestimated value on some devices | ||||||
| int GetMonitorPhysicalWidth(int monitor) | int GetMonitorPhysicalWidth(int monitor) | ||||||
| { | { | ||||||
|     TRACELOG(LOG_WARNING, "GetMonitorPhysicalWidth() not implemented on target platform"); |     int widthPixels = ANativeWindow_getWidth(platform.app->window); | ||||||
|     return 0; |     float dpi = AConfiguration_getDensity(platform.app->config); | ||||||
|  |     return (widthPixels/dpi)*25.4f; | ||||||
| } | } | ||||||
|  |  | ||||||
| // Get selected monitor physical height in millimetres | // Get selected monitor physical height in millimetres | ||||||
|  | // NOTE: It seems to return a slightly underestimated value on some devices | ||||||
| int GetMonitorPhysicalHeight(int monitor) | int GetMonitorPhysicalHeight(int monitor) | ||||||
| { | { | ||||||
|     TRACELOG(LOG_WARNING, "GetMonitorPhysicalHeight() not implemented on target platform"); |     int heightPixels = ANativeWindow_getHeight(platform.app->window); | ||||||
|     return 0; |     float dpi = AConfiguration_getDensity(platform.app->config); | ||||||
|  |     return (heightPixels/dpi)*25.4f; | ||||||
| } | } | ||||||
|  |  | ||||||
| // Get selected monitor refresh rate | // Get selected monitor refresh rate | ||||||
| @@ -497,8 +501,9 @@ Vector2 GetWindowPosition(void) | |||||||
| // Get window scale DPI factor for current monitor | // Get window scale DPI factor for current monitor | ||||||
| Vector2 GetWindowScaleDPI(void) | Vector2 GetWindowScaleDPI(void) | ||||||
| { | { | ||||||
|     TRACELOG(LOG_WARNING, "GetWindowScaleDPI() not implemented on target platform"); |     int density = AConfiguration_getDensity(platform.app->config); | ||||||
|     return (Vector2){ 1.0f, 1.0f }; |     float scale = (float)density/160; | ||||||
|  |     return (Vector2){ scale, scale }; | ||||||
| } | } | ||||||
|  |  | ||||||
| // Set clipboard text content | // Set clipboard text content | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Le Juez Victor
					Le Juez Victor