this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Added y-flipping to GPU_GetVirtualCoords() when coordinate mode has been set to mathematical mode.

+8 -2
+1 -1
include/SDL_gpu.h
··· 873 873 /*! Query the logical size of the given target. */ 874 874 DECLSPEC void SDLCALL GPU_GetVirtualResolution(GPU_Target* target, Uint16* w, Uint16* h); 875 875 876 - /*! Converts screen space coordinates (such as from mouse input) to logical drawing coordinates. */ 876 + /*! Converts screen space coordinates (such as from mouse input) to logical drawing coordinates. This interacts with GPU_SetCoordinateMode() when the y-axis is flipped (screen space is assumed to be inverted: (0,0) in the upper-left corner). */ 877 877 DECLSPEC void SDLCALL GPU_GetVirtualCoords(GPU_Target* target, float* x, float* y, float displayX, float displayY); 878 878 879 879 /*! Reset the logical size of the given target to its original value. */
+7 -1
src/SDL_gpu.c
··· 789 789 790 790 void GPU_GetVirtualCoords(GPU_Target* target, float* x, float* y, float displayX, float displayY) 791 791 { 792 - if(target == NULL) 792 + if(target == NULL || _gpu_current_renderer == NULL) 793 793 return; 794 794 795 + // Scale from raw window/image coords to the virtual scale 795 796 if(target->context != NULL) 796 797 { 797 798 if(x != NULL) ··· 808 809 } 809 810 else 810 811 { 812 + // What is the backing for this target?! 811 813 if(x != NULL) 812 814 *x = displayX; 813 815 if(y != NULL) 814 816 *y = displayY; 815 817 } 818 + 819 + // Invert coordinates to math coords 820 + if(_gpu_current_renderer->coordinate_mode) 821 + *y = target->h - *y; 816 822 } 817 823 818 824 GPU_Rect GPU_MakeRect(float x, float y, float w, float h)