mirror of https://github.com/libsdl-org/SDL
Backed out the viewport and cliprect changes in 9fb5a9ccac
This ended up being lots of application code churn without any real benefit in practice.
This commit is contained in:
parent
b2ccfc0b6f
commit
80a907e0e6
|
@ -1165,15 +1165,6 @@ SDL_RenderWindowToLogical() and SDL_RenderLogicalToWindow() have been renamed SD
|
||||||
|
|
||||||
The viewport, clipping state, and scale for render targets are now persistent and will remain set whenever they are active.
|
The viewport, clipping state, and scale for render targets are now persistent and will remain set whenever they are active.
|
||||||
|
|
||||||
The following functions have been changed to take floating point values to make them easier to use with the rest of the rendering API:
|
|
||||||
* SDL_GetCurrentRenderOutputSize()
|
|
||||||
* SDL_GetRenderClipRect()
|
|
||||||
* SDL_GetRenderLogicalPresentation()
|
|
||||||
* SDL_GetRenderOutputSize()
|
|
||||||
* SDL_GetRenderViewport()
|
|
||||||
* SDL_SetRenderLogicalPresentation()
|
|
||||||
* SDL_SetRenderViewport()
|
|
||||||
|
|
||||||
SDL_Vertex has been changed to use floating point colors, in the range of [0..1] for SDR content.
|
SDL_Vertex has been changed to use floating point colors, in the range of [0..1] for SDR content.
|
||||||
|
|
||||||
SDL_RenderReadPixels() returns a surface instead of filling in preallocated memory.
|
SDL_RenderReadPixels() returns a surface instead of filling in preallocated memory.
|
||||||
|
|
|
@ -459,7 +459,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetRendererProperties(SDL_Rende
|
||||||
*
|
*
|
||||||
* \sa SDL_GetCurrentRenderOutputSize
|
* \sa SDL_GetCurrentRenderOutputSize
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetRenderOutputSize(SDL_Renderer *renderer, float *w, float *h);
|
extern SDL_DECLSPEC int SDLCALL SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current output size in pixels of a rendering context.
|
* Get the current output size in pixels of a rendering context.
|
||||||
|
@ -479,7 +479,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetRenderOutputSize(SDL_Renderer *renderer,
|
||||||
*
|
*
|
||||||
* \sa SDL_GetRenderOutputSize
|
* \sa SDL_GetRenderOutputSize
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, float *w, float *h);
|
extern SDL_DECLSPEC int SDLCALL SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a texture for a rendering context.
|
* Create a texture for a rendering context.
|
||||||
|
@ -512,8 +512,7 @@ extern SDL_DECLSPEC SDL_Texture *SDLCALL SDL_CreateTexture(SDL_Renderer *rendere
|
||||||
* `SDL_TEXTUREACCESS_STATIC`.
|
* `SDL_TEXTUREACCESS_STATIC`.
|
||||||
*
|
*
|
||||||
* The pixel format of the created texture may be different from the pixel
|
* The pixel format of the created texture may be different from the pixel
|
||||||
* format of the surface, and can be queried using the
|
* format of the surface, and can be queried using the SDL_PROP_TEXTURE_FORMAT_NUMBER property.
|
||||||
* SDL_PROP_TEXTURE_FORMAT_NUMBER property.
|
|
||||||
*
|
*
|
||||||
* \param renderer the rendering context
|
* \param renderer the rendering context
|
||||||
* \param surface the SDL_Surface structure containing pixel data used to fill
|
* \param surface the SDL_Surface structure containing pixel data used to fill
|
||||||
|
@ -669,8 +668,8 @@ extern SDL_DECLSPEC SDL_Texture *SDLCALL SDL_CreateTextureWithProperties(SDL_Ren
|
||||||
*
|
*
|
||||||
* The following read-only properties are provided by SDL:
|
* The following read-only properties are provided by SDL:
|
||||||
*
|
*
|
||||||
* - `SDL_PROP_TEXTURE_COLORSPACE_NUMBER`: an SDL_ColorSpace value describing
|
* - `SDL_PROP_TEXTURE_COLORSPACE_NUMBER`: an SDL_ColorSpace value
|
||||||
* the texture colorspace.
|
* describing the texture colorspace.
|
||||||
* - `SDL_PROP_TEXTURE_FORMAT_NUMBER`: one of the enumerated values in
|
* - `SDL_PROP_TEXTURE_FORMAT_NUMBER`: one of the enumerated values in
|
||||||
* SDL_PixelFormatEnum.
|
* SDL_PixelFormatEnum.
|
||||||
* - `SDL_PROP_TEXTURE_ACCESS_NUMBER`: one of the enumerated values in
|
* - `SDL_PROP_TEXTURE_ACCESS_NUMBER`: one of the enumerated values in
|
||||||
|
@ -1057,8 +1056,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, SD
|
||||||
/**
|
/**
|
||||||
* Update the given texture rectangle with new pixel data.
|
* Update the given texture rectangle with new pixel data.
|
||||||
*
|
*
|
||||||
* The pixel data must be in the pixel format of the texture, which can be
|
* The pixel data must be in the pixel format of the texture, which can be queried using the SDL_PROP_TEXTURE_FORMAT_NUMBER property.
|
||||||
* queried using the SDL_PROP_TEXTURE_FORMAT_NUMBER property.
|
|
||||||
*
|
*
|
||||||
* This is a fairly slow function, intended for use with static textures that
|
* This is a fairly slow function, intended for use with static textures that
|
||||||
* do not change often.
|
* do not change often.
|
||||||
|
@ -1298,7 +1296,7 @@ extern SDL_DECLSPEC SDL_Texture *SDLCALL SDL_GetRenderTarget(SDL_Renderer *rende
|
||||||
* \sa SDL_ConvertEventToRenderCoordinates
|
* \sa SDL_ConvertEventToRenderCoordinates
|
||||||
* \sa SDL_GetRenderLogicalPresentation
|
* \sa SDL_GetRenderLogicalPresentation
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, float w, float h, SDL_RendererLogicalPresentation mode, SDL_ScaleMode scale_mode);
|
extern SDL_DECLSPEC int SDLCALL SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode, SDL_ScaleMode scale_mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get device independent resolution and presentation mode for rendering.
|
* Get device independent resolution and presentation mode for rendering.
|
||||||
|
@ -1318,7 +1316,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetRenderLogicalPresentation(SDL_Renderer *r
|
||||||
*
|
*
|
||||||
* \sa SDL_SetRenderLogicalPresentation
|
* \sa SDL_SetRenderLogicalPresentation
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, float *w, float *h, SDL_RendererLogicalPresentation *mode, SDL_ScaleMode *scale_mode);
|
extern SDL_DECLSPEC int SDLCALL SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode, SDL_ScaleMode *scale_mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a point in render coordinates when given a point in window coordinates.
|
* Get a point in render coordinates when given a point in window coordinates.
|
||||||
|
@ -1381,7 +1379,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Renderer
|
||||||
* Set the drawing area for rendering on the current target.
|
* Set the drawing area for rendering on the current target.
|
||||||
*
|
*
|
||||||
* \param renderer the rendering context
|
* \param renderer the rendering context
|
||||||
* \param rect the SDL_FRect structure representing the drawing area, or NULL
|
* \param rect the SDL_Rect structure representing the drawing area, or NULL
|
||||||
* to set the viewport to the entire target
|
* to set the viewport to the entire target
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
|
@ -1391,13 +1389,13 @@ extern SDL_DECLSPEC int SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Renderer
|
||||||
* \sa SDL_GetRenderViewport
|
* \sa SDL_GetRenderViewport
|
||||||
* \sa SDL_RenderViewportSet
|
* \sa SDL_RenderViewportSet
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_FRect *rect);
|
extern SDL_DECLSPEC int SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the drawing area for the current target.
|
* Get the drawing area for the current target.
|
||||||
*
|
*
|
||||||
* \param renderer the rendering context
|
* \param renderer the rendering context
|
||||||
* \param rect an SDL_FRect structure filled in with the current drawing area
|
* \param rect an SDL_Rect structure filled in with the current drawing area
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
@ -1406,7 +1404,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, co
|
||||||
* \sa SDL_RenderViewportSet
|
* \sa SDL_RenderViewportSet
|
||||||
* \sa SDL_SetRenderViewport
|
* \sa SDL_SetRenderViewport
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_FRect *rect);
|
extern SDL_DECLSPEC int SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether an explicit rectangle was set as the viewport.
|
* Return whether an explicit rectangle was set as the viewport.
|
||||||
|
@ -1430,7 +1428,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderViewportSet(SDL_Renderer *rendere
|
||||||
* Set the clip rectangle for rendering on the specified target.
|
* Set the clip rectangle for rendering on the specified target.
|
||||||
*
|
*
|
||||||
* \param renderer the rendering context
|
* \param renderer the rendering context
|
||||||
* \param rect an SDL_FRect structure representing the clip area, relative to
|
* \param rect an SDL_Rect structure representing the clip area, relative to
|
||||||
* the viewport, or NULL to disable clipping
|
* the viewport, or NULL to disable clipping
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
|
@ -1440,13 +1438,13 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderViewportSet(SDL_Renderer *rendere
|
||||||
* \sa SDL_GetRenderClipRect
|
* \sa SDL_GetRenderClipRect
|
||||||
* \sa SDL_RenderClipEnabled
|
* \sa SDL_RenderClipEnabled
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_FRect *rect);
|
extern SDL_DECLSPEC int SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the clip rectangle for the current target.
|
* Get the clip rectangle for the current target.
|
||||||
*
|
*
|
||||||
* \param renderer the rendering context
|
* \param renderer the rendering context
|
||||||
* \param rect an SDL_FRect structure filled in with the current clipping area
|
* \param rect an SDL_Rect structure filled in with the current clipping area
|
||||||
* or an empty rectangle if clipping is disabled
|
* or an empty rectangle if clipping is disabled
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
|
@ -1456,7 +1454,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, co
|
||||||
* \sa SDL_RenderClipEnabled
|
* \sa SDL_RenderClipEnabled
|
||||||
* \sa SDL_SetRenderClipRect
|
* \sa SDL_SetRenderClipRect
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_FRect *rect);
|
extern SDL_DECLSPEC int SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get whether clipping is enabled on the given renderer.
|
* Get whether clipping is enabled on the given renderer.
|
||||||
|
|
|
@ -243,7 +243,7 @@ SDL_DYNAPI_PROC(const char*,SDL_GetCurrentAudioDriver,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(const char*,SDL_GetCurrentCameraDriver,(void),(),return)
|
SDL_DYNAPI_PROC(const char*,SDL_GetCurrentCameraDriver,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(const SDL_DisplayMode*,SDL_GetCurrentDisplayMode,(SDL_DisplayID a),(a),return)
|
SDL_DYNAPI_PROC(const SDL_DisplayMode*,SDL_GetCurrentDisplayMode,(SDL_DisplayID a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_DisplayOrientation,SDL_GetCurrentDisplayOrientation,(SDL_DisplayID a),(a),return)
|
SDL_DYNAPI_PROC(SDL_DisplayOrientation,SDL_GetCurrentDisplayOrientation,(SDL_DisplayID a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetCurrentRenderOutputSize,(SDL_Renderer *a, float *b, float *c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_GetCurrentRenderOutputSize,(SDL_Renderer *a, int *b, int *c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(SDL_ThreadID,SDL_GetCurrentThreadID,(void),(),return)
|
SDL_DYNAPI_PROC(SDL_ThreadID,SDL_GetCurrentThreadID,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetCurrentTime,(SDL_Time *a),(a),return)
|
SDL_DYNAPI_PROC(int,SDL_GetCurrentTime,(SDL_Time *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(const char*,SDL_GetCurrentVideoDriver,(void),(),return)
|
SDL_DYNAPI_PROC(const char*,SDL_GetCurrentVideoDriver,(void),(),return)
|
||||||
|
@ -430,20 +430,20 @@ SDL_DYNAPI_PROC(int,SDL_GetRectUnion,(const SDL_Rect *a, const SDL_Rect *b, SDL_
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRectUnionFloat,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_GetRectUnionFloat,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GetRelativeMouseMode,(void),(),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_GetRelativeMouseMode,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(SDL_MouseButtonFlags,SDL_GetRelativeMouseState,(float *a, float *b),(a,b),return)
|
SDL_DYNAPI_PROC(SDL_MouseButtonFlags,SDL_GetRelativeMouseState,(float *a, float *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRenderClipRect,(SDL_Renderer *a, SDL_FRect *b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_GetRenderClipRect,(SDL_Renderer *a, SDL_Rect *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRenderColorScale,(SDL_Renderer *a, float *b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_GetRenderColorScale,(SDL_Renderer *a, float *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode *b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_GetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRenderDrawColor,(SDL_Renderer *a, Uint8 *b, Uint8 *c, Uint8 *d, Uint8 *e),(a,b,c,d,e),return)
|
SDL_DYNAPI_PROC(int,SDL_GetRenderDrawColor,(SDL_Renderer *a, Uint8 *b, Uint8 *c, Uint8 *d, Uint8 *e),(a,b,c,d,e),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRenderDrawColorFloat,(SDL_Renderer *a, float *b, float *c, float *d, float *e),(a,b,c,d,e),return)
|
SDL_DYNAPI_PROC(int,SDL_GetRenderDrawColorFloat,(SDL_Renderer *a, float *b, float *c, float *d, float *e),(a,b,c,d,e),return)
|
||||||
SDL_DYNAPI_PROC(const char*,SDL_GetRenderDriver,(int a),(a),return)
|
SDL_DYNAPI_PROC(const char*,SDL_GetRenderDriver,(int a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRenderLogicalPresentation,(SDL_Renderer *a, float *b, float *c, SDL_RendererLogicalPresentation *d, SDL_ScaleMode *e),(a,b,c,d,e),return)
|
SDL_DYNAPI_PROC(int,SDL_GetRenderLogicalPresentation,(SDL_Renderer *a, int *b, int *c, SDL_RendererLogicalPresentation *d, SDL_ScaleMode *e),(a,b,c,d,e),return)
|
||||||
SDL_DYNAPI_PROC(void*,SDL_GetRenderMetalCommandEncoder,(SDL_Renderer *a),(a),return)
|
SDL_DYNAPI_PROC(void*,SDL_GetRenderMetalCommandEncoder,(SDL_Renderer *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(void*,SDL_GetRenderMetalLayer,(SDL_Renderer *a),(a),return)
|
SDL_DYNAPI_PROC(void*,SDL_GetRenderMetalLayer,(SDL_Renderer *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRenderOutputSize,(SDL_Renderer *a, float *b, float *c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_GetRenderOutputSize,(SDL_Renderer *a, int *b, int *c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRenderScale,(SDL_Renderer *a, float *b, float *c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_GetRenderScale,(SDL_Renderer *a, float *b, float *c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(SDL_Texture*,SDL_GetRenderTarget,(SDL_Renderer *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_Texture*,SDL_GetRenderTarget,(SDL_Renderer *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRenderVSync,(SDL_Renderer *a, int *b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_GetRenderVSync,(SDL_Renderer *a, int *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRenderViewport,(SDL_Renderer *a, SDL_FRect *b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_GetRenderViewport,(SDL_Renderer *a, SDL_Rect *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(SDL_Window*,SDL_GetRenderWindow,(SDL_Renderer *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_Window*,SDL_GetRenderWindow,(SDL_Renderer *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_GetRenderer,(SDL_Window *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_GetRenderer,(SDL_Window *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_GetRendererFromTexture,(SDL_Texture *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_GetRendererFromTexture,(SDL_Texture *a),(a),return)
|
||||||
|
@ -757,16 +757,16 @@ SDL_DYNAPI_PROC(int,SDL_SetPrimarySelectionText,(const char *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetProperty,(SDL_PropertiesID a, const char *b, void *c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_SetProperty,(SDL_PropertiesID a, const char *b, void *c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetPropertyWithCleanup,(SDL_PropertiesID a, const char *b, void *c, SDL_CleanupPropertyCallback d, void *e),(a,b,c,d,e),return)
|
SDL_DYNAPI_PROC(int,SDL_SetPropertyWithCleanup,(SDL_PropertiesID a, const char *b, void *c, SDL_CleanupPropertyCallback d, void *e),(a,b,c,d,e),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetRelativeMouseMode,(SDL_bool a),(a),return)
|
SDL_DYNAPI_PROC(int,SDL_SetRelativeMouseMode,(SDL_bool a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetRenderClipRect,(SDL_Renderer *a, const SDL_FRect *b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_SetRenderClipRect,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetRenderColorScale,(SDL_Renderer *a, float b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_SetRenderColorScale,(SDL_Renderer *a, float b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_SetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetRenderDrawColor,(SDL_Renderer *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return)
|
SDL_DYNAPI_PROC(int,SDL_SetRenderDrawColor,(SDL_Renderer *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetRenderDrawColorFloat,(SDL_Renderer *a, float b, float c, float d, float e),(a,b,c,d,e),return)
|
SDL_DYNAPI_PROC(int,SDL_SetRenderDrawColorFloat,(SDL_Renderer *a, float b, float c, float d, float e),(a,b,c,d,e),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetRenderLogicalPresentation,(SDL_Renderer *a, float b, float c, SDL_RendererLogicalPresentation d, SDL_ScaleMode e),(a,b,c,d,e),return)
|
SDL_DYNAPI_PROC(int,SDL_SetRenderLogicalPresentation,(SDL_Renderer *a, int b, int c, SDL_RendererLogicalPresentation d, SDL_ScaleMode e),(a,b,c,d,e),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetRenderScale,(SDL_Renderer *a, float b, float c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_SetRenderScale,(SDL_Renderer *a, float b, float c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetRenderTarget,(SDL_Renderer *a, SDL_Texture *b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_SetRenderTarget,(SDL_Renderer *a, SDL_Texture *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetRenderVSync,(SDL_Renderer *a, int b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_SetRenderVSync,(SDL_Renderer *a, int b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetRenderViewport,(SDL_Renderer *a, const SDL_FRect *b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_SetRenderViewport,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetStringProperty,(SDL_PropertiesID a, const char *b, const char *c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_SetStringProperty,(SDL_PropertiesID a, const char *b, const char *c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetSurfaceAlphaMod,(SDL_Surface *a, Uint8 b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_SetSurfaceAlphaMod,(SDL_Surface *a, Uint8 b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_SetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_SetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode b),(a,b),return)
|
||||||
|
|
|
@ -409,12 +409,12 @@ static void UpdatePixelViewport(SDL_Renderer *renderer, SDL_RenderViewState *vie
|
||||||
if (view->viewport.w >= 0) {
|
if (view->viewport.w >= 0) {
|
||||||
view->pixel_viewport.w = (int)SDL_ceilf(view->viewport.w * view->scale.x);
|
view->pixel_viewport.w = (int)SDL_ceilf(view->viewport.w * view->scale.x);
|
||||||
} else {
|
} else {
|
||||||
view->pixel_viewport.w = (int)SDL_ceilf(view->pixel_w);
|
view->pixel_viewport.w = view->pixel_w;
|
||||||
}
|
}
|
||||||
if (view->viewport.h >= 0) {
|
if (view->viewport.h >= 0) {
|
||||||
view->pixel_viewport.h = (int)SDL_ceilf(view->viewport.h * view->scale.y);
|
view->pixel_viewport.h = (int)SDL_ceilf(view->viewport.h * view->scale.y);
|
||||||
} else {
|
} else {
|
||||||
view->pixel_viewport.h = (int)SDL_ceilf(view->pixel_h);
|
view->pixel_viewport.h = view->pixel_h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,10 +448,10 @@ static int QueueCmdSetViewport(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static void UpdatePixelClipRect(SDL_Renderer *renderer, SDL_RenderViewState *view)
|
static void UpdatePixelClipRect(SDL_Renderer *renderer, SDL_RenderViewState *view)
|
||||||
{
|
{
|
||||||
view->pixel_cliprect.x = (int)SDL_floorf(view->clip_rect.x * view->scale.x);
|
view->pixel_clip_rect.x = (int)SDL_floorf(view->clip_rect.x * view->scale.x);
|
||||||
view->pixel_cliprect.y = (int)SDL_floorf(view->clip_rect.y * view->scale.y);
|
view->pixel_clip_rect.y = (int)SDL_floorf(view->clip_rect.y * view->scale.y);
|
||||||
view->pixel_cliprect.w = (int)SDL_ceilf(view->clip_rect.w * view->scale.x);
|
view->pixel_clip_rect.w = (int)SDL_ceilf(view->clip_rect.w * view->scale.x);
|
||||||
view->pixel_cliprect.h = (int)SDL_ceilf(view->clip_rect.h * view->scale.y);
|
view->pixel_clip_rect.h = (int)SDL_ceilf(view->clip_rect.h * view->scale.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int QueueCmdSetClipRect(SDL_Renderer *renderer)
|
static int QueueCmdSetClipRect(SDL_Renderer *renderer)
|
||||||
|
@ -459,7 +459,7 @@ static int QueueCmdSetClipRect(SDL_Renderer *renderer)
|
||||||
SDL_Rect clip_rect;
|
SDL_Rect clip_rect;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
clip_rect = renderer->view->pixel_cliprect;
|
clip_rect = renderer->view->pixel_clip_rect;
|
||||||
|
|
||||||
if (!renderer->cliprect_queued ||
|
if (!renderer->cliprect_queued ||
|
||||||
renderer->view->clipping_enabled != renderer->last_queued_cliprect_enabled ||
|
renderer->view->clipping_enabled != renderer->last_queued_cliprect_enabled ||
|
||||||
|
@ -726,8 +726,8 @@ static void UpdateMainViewDimensions(SDL_Renderer *renderer)
|
||||||
}
|
}
|
||||||
SDL_GetRenderOutputSize(renderer, &renderer->main_view.pixel_w, &renderer->main_view.pixel_h);
|
SDL_GetRenderOutputSize(renderer, &renderer->main_view.pixel_w, &renderer->main_view.pixel_h);
|
||||||
if (window_w > 0 && window_h > 0) {
|
if (window_w > 0 && window_h > 0) {
|
||||||
renderer->dpi_scale.x = renderer->main_view.pixel_w / window_w;
|
renderer->dpi_scale.x = (float)renderer->main_view.pixel_w / window_w;
|
||||||
renderer->dpi_scale.y = renderer->main_view.pixel_h / window_h;
|
renderer->dpi_scale.y = (float)renderer->main_view.pixel_h / window_h;
|
||||||
} else {
|
} else {
|
||||||
renderer->dpi_scale.x = 1.0f;
|
renderer->dpi_scale.x = 1.0f;
|
||||||
renderer->dpi_scale.y = 1.0f;
|
renderer->dpi_scale.y = 1.0f;
|
||||||
|
@ -1029,8 +1029,8 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props)
|
||||||
renderer->window = window;
|
renderer->window = window;
|
||||||
renderer->target_mutex = SDL_CreateMutex();
|
renderer->target_mutex = SDL_CreateMutex();
|
||||||
if (surface) {
|
if (surface) {
|
||||||
renderer->main_view.pixel_w = (float)surface->w;
|
renderer->main_view.pixel_w = surface->w;
|
||||||
renderer->main_view.pixel_h = (float)surface->h;
|
renderer->main_view.pixel_h = surface->h;
|
||||||
}
|
}
|
||||||
renderer->main_view.viewport.w = -1;
|
renderer->main_view.viewport.w = -1;
|
||||||
renderer->main_view.viewport.h = -1;
|
renderer->main_view.viewport.h = -1;
|
||||||
|
@ -1189,35 +1189,21 @@ SDL_PropertiesID SDL_GetRendererProperties(SDL_Renderer *renderer)
|
||||||
return renderer->props;
|
return renderer->props;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GetRenderOutputSize(SDL_Renderer *renderer, float *w, float *h)
|
int SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h)
|
||||||
{
|
{
|
||||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||||
int output_w = 0;
|
|
||||||
int output_h = 0;
|
|
||||||
|
|
||||||
if (renderer->GetOutputSize) {
|
if (renderer->GetOutputSize) {
|
||||||
if (renderer->GetOutputSize(renderer, &output_w, &output_h) < 0) {
|
return renderer->GetOutputSize(renderer, w, h);
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else if (renderer->window) {
|
} else if (renderer->window) {
|
||||||
if (SDL_GetWindowSizeInPixels(renderer->window, &output_w, &output_h) < 0) {
|
return SDL_GetWindowSizeInPixels(renderer->window, w, h);
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
SDL_assert(!"This should never happen");
|
SDL_assert(!"This should never happen");
|
||||||
return SDL_SetError("Renderer doesn't support querying output size");
|
return SDL_SetError("Renderer doesn't support querying output size");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w) {
|
|
||||||
*w = (float)output_w;
|
|
||||||
}
|
|
||||||
if (h) {
|
|
||||||
*h = (float)output_h;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, float *w, float *h)
|
int SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h)
|
||||||
{
|
{
|
||||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||||
|
|
||||||
|
@ -1348,8 +1334,8 @@ SDL_Texture *SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_Propert
|
||||||
texture->color.b = 1.0f;
|
texture->color.b = 1.0f;
|
||||||
texture->color.a = 1.0f;
|
texture->color.a = 1.0f;
|
||||||
texture->scaleMode = SDL_SCALEMODE_LINEAR;
|
texture->scaleMode = SDL_SCALEMODE_LINEAR;
|
||||||
texture->view.pixel_w = (float)w;
|
texture->view.pixel_w = w;
|
||||||
texture->view.pixel_h = (float)h;
|
texture->view.pixel_h = h;
|
||||||
texture->view.viewport.w = -1;
|
texture->view.viewport.w = -1;
|
||||||
texture->view.viewport.h = -1;
|
texture->view.viewport.h = -1;
|
||||||
texture->view.scale.x = 1.0f;
|
texture->view.scale.x = 1.0f;
|
||||||
|
@ -2434,8 +2420,8 @@ SDL_Texture *SDL_GetRenderTarget(SDL_Renderer *renderer)
|
||||||
static int UpdateLogicalPresentation(SDL_Renderer *renderer)
|
static int UpdateLogicalPresentation(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
float logical_w = 1.0f, logical_h = 1.0f;
|
float logical_w = 1.0f, logical_h = 1.0f;
|
||||||
float output_w = renderer->main_view.pixel_w;
|
float output_w = (float)renderer->main_view.pixel_w;
|
||||||
float output_h = renderer->main_view.pixel_h;
|
float output_h = (float)renderer->main_view.pixel_h;
|
||||||
float want_aspect = 1.0f;
|
float want_aspect = 1.0f;
|
||||||
float real_aspect = 1.0f;
|
float real_aspect = 1.0f;
|
||||||
float scale;
|
float scale;
|
||||||
|
@ -2529,34 +2515,34 @@ static int UpdateLogicalPresentation(SDL_Renderer *renderer)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
SDL_SetRenderLogicalPresentation(renderer, 0.0f, 0.0f, SDL_LOGICAL_PRESENTATION_DISABLED, SDL_SCALEMODE_NEAREST);
|
SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED, SDL_SCALEMODE_NEAREST);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, float w, float h, SDL_RendererLogicalPresentation mode, SDL_ScaleMode scale_mode)
|
int SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode, SDL_ScaleMode scale_mode)
|
||||||
{
|
{
|
||||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||||
|
|
||||||
w = SDL_ceilf(w);
|
|
||||||
h = SDL_ceilf(h);
|
|
||||||
|
|
||||||
if (mode == SDL_LOGICAL_PRESENTATION_DISABLED) {
|
if (mode == SDL_LOGICAL_PRESENTATION_DISABLED) {
|
||||||
if (renderer->logical_target) {
|
if (renderer->logical_target) {
|
||||||
SDL_DestroyTexture(renderer->logical_target);
|
SDL_DestroyTexture(renderer->logical_target);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (renderer->logical_target) {
|
if (renderer->logical_target) {
|
||||||
float existing_w = 0.0f, existing_h = 0.0f;
|
SDL_PropertiesID props = SDL_GetTextureProperties(renderer->logical_target);
|
||||||
|
if (!props) {
|
||||||
if (SDL_GetTextureSize(renderer->logical_target, &existing_w, &existing_h) < 0) {
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int existing_w = (int)SDL_GetNumberProperty(props, SDL_PROP_TEXTURE_WIDTH_NUMBER, 0);
|
||||||
|
int existing_h = (int)SDL_GetNumberProperty(props, SDL_PROP_TEXTURE_HEIGHT_NUMBER, 0);
|
||||||
|
|
||||||
if (w != existing_w || h != existing_h) {
|
if (w != existing_w || h != existing_h) {
|
||||||
SDL_DestroyTexture(renderer->logical_target);
|
SDL_DestroyTexture(renderer->logical_target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!renderer->logical_target) {
|
if (!renderer->logical_target) {
|
||||||
renderer->logical_target = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_UNKNOWN, SDL_TEXTUREACCESS_TARGET, (int)w, (int)h);
|
renderer->logical_target = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_UNKNOWN, SDL_TEXTUREACCESS_TARGET, w, h);
|
||||||
if (!renderer->logical_target) {
|
if (!renderer->logical_target) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -2570,24 +2556,38 @@ int SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, float w, float h, S
|
||||||
return UpdateLogicalPresentation(renderer);
|
return UpdateLogicalPresentation(renderer);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
SDL_SetRenderLogicalPresentation(renderer, 0.0f, 0.0f, SDL_LOGICAL_PRESENTATION_DISABLED, SDL_SCALEMODE_NEAREST);
|
SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED, SDL_SCALEMODE_NEAREST);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, float *w, float *h, SDL_RendererLogicalPresentation *mode, SDL_ScaleMode *scale_mode)
|
int SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode, SDL_ScaleMode *scale_mode)
|
||||||
{
|
{
|
||||||
|
if (w) {
|
||||||
|
*w = 0;
|
||||||
|
}
|
||||||
|
if (h) {
|
||||||
|
*h = 0;
|
||||||
|
}
|
||||||
|
if (mode) {
|
||||||
|
*mode = SDL_LOGICAL_PRESENTATION_DISABLED;
|
||||||
|
}
|
||||||
|
if (scale_mode) {
|
||||||
|
*scale_mode = SDL_SCALEMODE_NEAREST;
|
||||||
|
}
|
||||||
|
|
||||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||||
|
|
||||||
if (renderer->logical_target) {
|
if (renderer->logical_target) {
|
||||||
if (SDL_GetTextureSize(renderer->logical_target, w, h) < 0) {
|
SDL_PropertiesID props = SDL_GetTextureProperties(renderer->logical_target);
|
||||||
|
if (!props) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (w) {
|
if (w) {
|
||||||
*w = 0.0f;
|
*w = (int)SDL_GetNumberProperty(props, SDL_PROP_TEXTURE_WIDTH_NUMBER, 0);
|
||||||
}
|
}
|
||||||
if (h) {
|
if (h) {
|
||||||
*h = 0.0f;
|
*h = (int)SDL_GetNumberProperty(props, SDL_PROP_TEXTURE_HEIGHT_NUMBER, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2597,6 +2597,7 @@ int SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, float *w, float *h,
|
||||||
if (scale_mode) {
|
if (scale_mode) {
|
||||||
*scale_mode = renderer->logical_scale_mode;
|
*scale_mode = renderer->logical_scale_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2617,11 +2618,11 @@ static void SDL_RenderLogicalBorders(SDL_Renderer *renderer)
|
||||||
rect.x = 0.0f;
|
rect.x = 0.0f;
|
||||||
rect.y = 0.0f;
|
rect.y = 0.0f;
|
||||||
rect.w = dst->x;
|
rect.w = dst->x;
|
||||||
rect.h = renderer->view->pixel_h;
|
rect.h = (float)renderer->view->pixel_h;
|
||||||
SDL_RenderFillRect(renderer, &rect);
|
SDL_RenderFillRect(renderer, &rect);
|
||||||
|
|
||||||
rect.x = dst->x + dst->w;
|
rect.x = dst->x + dst->w;
|
||||||
rect.w = renderer->view->pixel_w - rect.x;
|
rect.w = (float)renderer->view->pixel_w - rect.x;
|
||||||
SDL_RenderFillRect(renderer, &rect);
|
SDL_RenderFillRect(renderer, &rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2630,12 +2631,12 @@ static void SDL_RenderLogicalBorders(SDL_Renderer *renderer)
|
||||||
|
|
||||||
rect.x = 0.0f;
|
rect.x = 0.0f;
|
||||||
rect.y = 0.0f;
|
rect.y = 0.0f;
|
||||||
rect.w = renderer->view->pixel_w;
|
rect.w = (float)renderer->view->pixel_w;
|
||||||
rect.h = dst->y;
|
rect.h = dst->y;
|
||||||
SDL_RenderFillRect(renderer, &rect);
|
SDL_RenderFillRect(renderer, &rect);
|
||||||
|
|
||||||
rect.y = dst->y + dst->h;
|
rect.y = dst->y + dst->h;
|
||||||
rect.h = renderer->view->pixel_h - rect.y;
|
rect.h = (float)renderer->view->pixel_h - rect.y;
|
||||||
SDL_RenderFillRect(renderer, &rect);
|
SDL_RenderFillRect(renderer, &rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2820,24 +2821,24 @@ int SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_FRect *rect)
|
int SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||||
|
|
||||||
if (rect) {
|
if (rect) {
|
||||||
SDL_copyp(&renderer->view->viewport, rect);
|
SDL_copyp(&renderer->view->viewport, rect);
|
||||||
} else {
|
} else {
|
||||||
renderer->view->viewport.x = 0.0f;
|
renderer->view->viewport.x = 0;
|
||||||
renderer->view->viewport.y = 0.0f;
|
renderer->view->viewport.y = 0;
|
||||||
renderer->view->viewport.w = -1.0f;
|
renderer->view->viewport.w = -1;
|
||||||
renderer->view->viewport.h = -1.0f;
|
renderer->view->viewport.h = -1;
|
||||||
}
|
}
|
||||||
UpdatePixelViewport(renderer, renderer->view);
|
UpdatePixelViewport(renderer, renderer->view);
|
||||||
|
|
||||||
return QueueCmdSetViewport(renderer);
|
return QueueCmdSetViewport(renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_FRect *rect)
|
int SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||||
|
|
||||||
|
@ -2847,12 +2848,12 @@ int SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_FRect *rect)
|
||||||
if (renderer->view->viewport.w >= 0) {
|
if (renderer->view->viewport.w >= 0) {
|
||||||
rect->w = renderer->view->viewport.w;
|
rect->w = renderer->view->viewport.w;
|
||||||
} else {
|
} else {
|
||||||
rect->w = SDL_ceilf(renderer->view->pixel_w / renderer->view->scale.x);
|
rect->w = (int)SDL_ceilf(renderer->view->pixel_w / renderer->view->scale.x);
|
||||||
}
|
}
|
||||||
if (renderer->view->viewport.h >= 0) {
|
if (renderer->view->viewport.h >= 0) {
|
||||||
rect->h = renderer->view->viewport.h;
|
rect->h = renderer->view->viewport.h;
|
||||||
} else {
|
} else {
|
||||||
rect->h = SDL_ceilf(renderer->view->pixel_h / renderer->view->scale.y);
|
rect->h = (int)SDL_ceilf(renderer->view->pixel_h / renderer->view->scale.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2862,8 +2863,8 @@ SDL_bool SDL_RenderViewportSet(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||||
|
|
||||||
if (renderer->view->viewport.w >= 0.0f &&
|
if (renderer->view->viewport.w >= 0 &&
|
||||||
renderer->view->viewport.h >= 0.0f) {
|
renderer->view->viewport.h >= 0) {
|
||||||
return SDL_TRUE;
|
return SDL_TRUE;
|
||||||
}
|
}
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
|
@ -2873,19 +2874,19 @@ static void GetRenderViewportSize(SDL_Renderer *renderer, SDL_FRect *rect)
|
||||||
{
|
{
|
||||||
rect->x = 0.0f;
|
rect->x = 0.0f;
|
||||||
rect->y = 0.0f;
|
rect->y = 0.0f;
|
||||||
if (renderer->view->viewport.w >= 0.0f) {
|
if (renderer->view->viewport.w >= 0) {
|
||||||
rect->w = renderer->view->viewport.w;
|
rect->w = (float)renderer->view->viewport.w;
|
||||||
} else {
|
} else {
|
||||||
rect->w = renderer->view->pixel_w / renderer->view->scale.x;
|
rect->w = renderer->view->pixel_w / renderer->view->scale.x;
|
||||||
}
|
}
|
||||||
if (renderer->view->viewport.h >= 0.0f) {
|
if (renderer->view->viewport.h >= 0) {
|
||||||
rect->h = renderer->view->viewport.h;
|
rect->h = (float)renderer->view->viewport.h;
|
||||||
} else {
|
} else {
|
||||||
rect->h = renderer->view->pixel_h / renderer->view->scale.y;
|
rect->h = renderer->view->pixel_h / renderer->view->scale.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_FRect *rect)
|
int SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
CHECK_RENDERER_MAGIC(renderer, -1)
|
CHECK_RENDERER_MAGIC(renderer, -1)
|
||||||
|
|
||||||
|
@ -2901,7 +2902,7 @@ int SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_FRect *rect)
|
||||||
return QueueCmdSetClipRect(renderer);
|
return QueueCmdSetClipRect(renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_FRect *rect)
|
int SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
CHECK_RENDERER_MAGIC(renderer, -1)
|
CHECK_RENDERER_MAGIC(renderer, -1)
|
||||||
|
|
||||||
|
@ -3142,7 +3143,7 @@ int SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y
|
||||||
|
|
||||||
static int RenderLineBresenham(SDL_Renderer *renderer, int x1, int y1, int x2, int y2, SDL_bool draw_last)
|
static int RenderLineBresenham(SDL_Renderer *renderer, int x1, int y1, int x2, int y2, SDL_bool draw_last)
|
||||||
{
|
{
|
||||||
const int MAX_PIXELS = (int)SDL_max(renderer->view->pixel_w, renderer->view->pixel_h) * 4;
|
const int MAX_PIXELS = SDL_max(renderer->view->pixel_w, renderer->view->pixel_h) * 4;
|
||||||
int i, deltax, deltay, numpixels;
|
int i, deltax, deltay, numpixels;
|
||||||
int d, dinc1, dinc2;
|
int d, dinc1, dinc2;
|
||||||
int x, xinc1, xinc2;
|
int x, xinc1, xinc2;
|
||||||
|
|
|
@ -48,12 +48,12 @@ typedef struct SDL_RenderDriver SDL_RenderDriver;
|
||||||
/* Rendering view state */
|
/* Rendering view state */
|
||||||
typedef struct SDL_RenderViewState
|
typedef struct SDL_RenderViewState
|
||||||
{
|
{
|
||||||
float pixel_w;
|
int pixel_w;
|
||||||
float pixel_h;
|
int pixel_h;
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
SDL_Rect pixel_viewport;
|
SDL_Rect pixel_viewport;
|
||||||
SDL_FRect clip_rect;
|
SDL_Rect clip_rect;
|
||||||
SDL_Rect pixel_cliprect;
|
SDL_Rect pixel_clip_rect;
|
||||||
SDL_bool clipping_enabled;
|
SDL_bool clipping_enabled;
|
||||||
SDL_FPoint scale;
|
SDL_FPoint scale;
|
||||||
|
|
||||||
|
|
|
@ -1453,7 +1453,7 @@ static SDL_Surface *GL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *
|
||||||
SDL_PixelFormatEnum format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ARGB8888;
|
SDL_PixelFormatEnum format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ARGB8888;
|
||||||
GLint internalFormat;
|
GLint internalFormat;
|
||||||
GLenum targetFormat, type;
|
GLenum targetFormat, type;
|
||||||
float h;
|
int w, h;
|
||||||
SDL_Surface *surface;
|
SDL_Surface *surface;
|
||||||
|
|
||||||
GL_ActivateRenderer(renderer);
|
GL_ActivateRenderer(renderer);
|
||||||
|
@ -1468,12 +1468,12 @@ static SDL_Surface *GL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_GetCurrentRenderOutputSize(renderer, NULL, &h);
|
SDL_GetCurrentRenderOutputSize(renderer, &w, &h);
|
||||||
|
|
||||||
data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||||
data->glPixelStorei(GL_PACK_ROW_LENGTH, (surface->pitch / SDL_BYTESPERPIXEL(format)));
|
data->glPixelStorei(GL_PACK_ROW_LENGTH, (surface->pitch / SDL_BYTESPERPIXEL(format)));
|
||||||
|
|
||||||
data->glReadPixels(rect->x, renderer->target ? rect->y : ((int)h - rect->y) - rect->h,
|
data->glReadPixels(rect->x, renderer->target ? rect->y : (h - rect->y) - rect->h,
|
||||||
rect->w, rect->h, targetFormat, type, surface->pixels);
|
rect->w, rect->h, targetFormat, type, surface->pixels);
|
||||||
|
|
||||||
if (GL_CheckError("glReadPixels()", renderer) < 0) {
|
if (GL_CheckError("glReadPixels()", renderer) < 0) {
|
||||||
|
|
|
@ -1967,7 +1967,7 @@ static SDL_Surface *GLES2_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rec
|
||||||
{
|
{
|
||||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
||||||
SDL_PixelFormatEnum format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_RGBA32;
|
SDL_PixelFormatEnum format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_RGBA32;
|
||||||
float h;
|
int w, h;
|
||||||
SDL_Surface *surface;
|
SDL_Surface *surface;
|
||||||
|
|
||||||
surface = SDL_CreateSurface(rect->w, rect->h, format);
|
surface = SDL_CreateSurface(rect->w, rect->h, format);
|
||||||
|
@ -1975,9 +1975,9 @@ static SDL_Surface *GLES2_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rec
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_GetCurrentRenderOutputSize(renderer, NULL, &h);
|
SDL_GetCurrentRenderOutputSize(renderer, &w, &h);
|
||||||
|
|
||||||
data->glReadPixels(rect->x, renderer->target ? rect->y : ((int)h - rect->y) - rect->h,
|
data->glReadPixels(rect->x, renderer->target ? rect->y : (h - rect->y) - rect->h,
|
||||||
rect->w, rect->h, GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels);
|
rect->w, rect->h, GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels);
|
||||||
if (GL_CheckError("glReadPixels()", renderer) < 0) {
|
if (GL_CheckError("glReadPixels()", renderer) < 0) {
|
||||||
SDL_DestroySurface(surface);
|
SDL_DestroySurface(surface);
|
||||||
|
|
|
@ -1081,7 +1081,7 @@ void read_pixels(int x, int y, size_t width, size_t height, void *data)
|
||||||
static SDL_Surface *VITA_GXM_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
static SDL_Surface *VITA_GXM_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
Uint32 format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ABGR8888;
|
Uint32 format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ABGR8888;
|
||||||
float h;
|
int w, h;
|
||||||
SDL_Surface *surface;
|
SDL_Surface *surface;
|
||||||
|
|
||||||
// TODO: read from texture rendertarget.
|
// TODO: read from texture rendertarget.
|
||||||
|
@ -1095,9 +1095,9 @@ static SDL_Surface *VITA_GXM_RenderReadPixels(SDL_Renderer *renderer, const SDL_
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_GetCurrentRenderOutputSize(renderer, NULL, &h);
|
SDL_GetCurrentRenderOutputSize(renderer, &w, &h);
|
||||||
|
|
||||||
read_pixels(rect->x, renderer->target ? rect->y : ((int)h - rect->y) - rect->h,
|
read_pixels(rect->x, renderer->target ? rect->y : (h - rect->y) - rect->h,
|
||||||
rect->w, rect->h, surface->pixels);
|
rect->w, rect->h, surface->pixels);
|
||||||
|
|
||||||
/* Flip the rows to be top-down if necessary */
|
/* Flip the rows to be top-down if necessary */
|
||||||
|
|
|
@ -2509,9 +2509,8 @@ void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, fl
|
||||||
float textY = 0.0f;
|
float textY = 0.0f;
|
||||||
const int lineHeight = 10;
|
const int lineHeight = 10;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
float fx, fy, fw, fh;
|
float fx, fy;
|
||||||
SDL_Rect rect;
|
SDL_Rect rect;
|
||||||
SDL_FRect frect;
|
|
||||||
const SDL_DisplayMode *mode;
|
const SDL_DisplayMode *mode;
|
||||||
float scaleX, scaleY;
|
float scaleX, scaleY;
|
||||||
SDL_MouseButtonFlags flags;
|
SDL_MouseButtonFlags flags;
|
||||||
|
@ -2545,21 +2544,21 @@ void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, fl
|
||||||
SDLTest_DrawString(renderer, 0.0f, textY, text);
|
SDLTest_DrawString(renderer, 0.0f, textY, text);
|
||||||
textY += lineHeight;
|
textY += lineHeight;
|
||||||
|
|
||||||
if (0 == SDL_GetRenderOutputSize(renderer, &fw, &fh)) {
|
if (0 == SDL_GetRenderOutputSize(renderer, &w, &h)) {
|
||||||
(void)SDL_snprintf(text, sizeof(text), "SDL_GetRenderOutputSize: %gx%g", fw, fh);
|
(void)SDL_snprintf(text, sizeof(text), "SDL_GetRenderOutputSize: %dx%d", w, h);
|
||||||
SDLTest_DrawString(renderer, 0.0f, textY, text);
|
SDLTest_DrawString(renderer, 0.0f, textY, text);
|
||||||
textY += lineHeight;
|
textY += lineHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == SDL_GetCurrentRenderOutputSize(renderer, &fw, &fh)) {
|
if (0 == SDL_GetCurrentRenderOutputSize(renderer, &w, &h)) {
|
||||||
(void)SDL_snprintf(text, sizeof(text), "SDL_GetCurrentRenderOutputSize: %gx%g", fw, fh);
|
(void)SDL_snprintf(text, sizeof(text), "SDL_GetCurrentRenderOutputSize: %dx%d", w, h);
|
||||||
SDLTest_DrawString(renderer, 0.0f, textY, text);
|
SDLTest_DrawString(renderer, 0.0f, textY, text);
|
||||||
textY += lineHeight;
|
textY += lineHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_GetRenderViewport(renderer, &frect);
|
SDL_GetRenderViewport(renderer, &rect);
|
||||||
(void)SDL_snprintf(text, sizeof(text), "SDL_GetRenderViewport: %g,%g, %gx%g",
|
(void)SDL_snprintf(text, sizeof(text), "SDL_GetRenderViewport: %d,%d, %dx%d",
|
||||||
frect.x, frect.y, frect.w, frect.h);
|
rect.x, rect.y, rect.w, rect.h);
|
||||||
SDLTest_DrawString(renderer, 0.0f, textY, text);
|
SDLTest_DrawString(renderer, 0.0f, textY, text);
|
||||||
textY += lineHeight;
|
textY += lineHeight;
|
||||||
|
|
||||||
|
@ -2569,8 +2568,8 @@ void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, fl
|
||||||
SDLTest_DrawString(renderer, 0.0f, textY, text);
|
SDLTest_DrawString(renderer, 0.0f, textY, text);
|
||||||
textY += lineHeight;
|
textY += lineHeight;
|
||||||
|
|
||||||
SDL_GetRenderLogicalPresentation(renderer, &fw, &fh, &logical_presentation, &logical_scale_mode);
|
SDL_GetRenderLogicalPresentation(renderer, &w, &h, &logical_presentation, &logical_scale_mode);
|
||||||
(void)SDL_snprintf(text, sizeof(text), "SDL_GetRenderLogicalPresentation: %gx%g ", fw, fh);
|
(void)SDL_snprintf(text, sizeof(text), "SDL_GetRenderLogicalPresentation: %dx%d ", w, h);
|
||||||
SDLTest_PrintLogicalPresentation(text, sizeof(text), logical_presentation);
|
SDLTest_PrintLogicalPresentation(text, sizeof(text), logical_presentation);
|
||||||
SDL_snprintfcat(text, sizeof(text), ", ");
|
SDL_snprintfcat(text, sizeof(text), ", ");
|
||||||
SDLTest_PrintScaleMode(text, sizeof(text), logical_scale_mode);
|
SDLTest_PrintScaleMode(text, sizeof(text), logical_scale_mode);
|
||||||
|
|
|
@ -75,8 +75,8 @@ static const struct
|
||||||
{ 400, 5, 180.0 }, /* SDL_GAMEPAD_ELEMENT_AXIS_RIGHT_TRIGGER */
|
{ 400, 5, 180.0 }, /* SDL_GAMEPAD_ELEMENT_AXIS_RIGHT_TRIGGER */
|
||||||
};
|
};
|
||||||
|
|
||||||
static SDL_Rect touchpad_area = {
|
static SDL_FRect touchpad_area = {
|
||||||
148, 20, 216, 118
|
148.0f, 20.0f, 216.0f, 118.0f
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -1935,7 +1935,7 @@ GamepadButton *CreateGamepadButton(SDL_Renderer *renderer, const char *label)
|
||||||
SDL_GetTextureSize(ctx->background, &ctx->background_width, &ctx->background_height);
|
SDL_GetTextureSize(ctx->background, &ctx->background_width, &ctx->background_height);
|
||||||
|
|
||||||
ctx->label = SDL_strdup(label);
|
ctx->label = SDL_strdup(label);
|
||||||
ctx->label_width = (FONT_CHARACTER_SIZE * SDL_strlen(label));
|
ctx->label_width = (float)(FONT_CHARACTER_SIZE * SDL_strlen(label));
|
||||||
ctx->label_height = (float)FONT_CHARACTER_SIZE;
|
ctx->label_height = (float)FONT_CHARACTER_SIZE;
|
||||||
}
|
}
|
||||||
return ctx;
|
return ctx;
|
||||||
|
|
|
@ -302,7 +302,7 @@ static int keyboard_getSetModState(void *arg)
|
||||||
currentState = result;
|
currentState = result;
|
||||||
|
|
||||||
/* Set random state */
|
/* Set random state */
|
||||||
newState = SDLTest_RandomIntegerInRange(0, allStates);
|
newState = (SDL_Keymod)SDLTest_RandomIntegerInRange(0, allStates);
|
||||||
SDL_SetModState(newState);
|
SDL_SetModState(newState);
|
||||||
SDLTest_AssertPass("Call to SDL_SetModState(0x%.4x)", newState);
|
SDLTest_AssertPass("Call to SDL_SetModState(0x%.4x)", newState);
|
||||||
result = SDL_GetModState();
|
result = SDL_GetModState();
|
||||||
|
|
|
@ -155,7 +155,7 @@ static int render_testPrimitives(void *arg)
|
||||||
checkFailCount1++;
|
checkFailCount1++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = SDL_RenderPoint(renderer, x, y);
|
ret = SDL_RenderPoint(renderer, (float)x, (float)y);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
checkFailCount2++;
|
checkFailCount2++;
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,7 @@ static int render_testPrimitivesBlend(void *arg)
|
||||||
checkFailCount2++;
|
checkFailCount2++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = SDL_RenderLine(renderer, 0.0f, 0.0f, i, 59.0f);
|
ret = SDL_RenderLine(renderer, 0.0f, 0.0f, (float)i, 59.0f);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
checkFailCount3++;
|
checkFailCount3++;
|
||||||
}
|
}
|
||||||
|
@ -282,7 +282,7 @@ static int render_testPrimitivesBlend(void *arg)
|
||||||
checkFailCount2++;
|
checkFailCount2++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = SDL_RenderLine(renderer, 0.0f, 0.0f, 79.0f, i);
|
ret = SDL_RenderLine(renderer, 0.0f, 0.0f, 79.0f, (float)i);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
checkFailCount3++;
|
checkFailCount3++;
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ static int render_testPrimitivesBlend(void *arg)
|
||||||
checkFailCount2++;
|
checkFailCount2++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = SDL_RenderPoint(renderer, i, j);
|
ret = SDL_RenderPoint(renderer, (float)i, (float)j);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
checkFailCount3++;
|
checkFailCount3++;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ static int render_testPrimitivesBlend(void *arg)
|
||||||
*/
|
*/
|
||||||
static int render_testPrimitivesWithViewport(void *arg)
|
static int render_testPrimitivesWithViewport(void *arg)
|
||||||
{
|
{
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
SDL_Surface *surface;
|
SDL_Surface *surface;
|
||||||
|
|
||||||
/* Clear surface. */
|
/* Clear surface. */
|
||||||
|
@ -489,8 +489,8 @@ static int render_testBlitColor(void *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Blitting. */
|
/* Blitting. */
|
||||||
rect.x = i;
|
rect.x = (float)i;
|
||||||
rect.y = j;
|
rect.y = (float)j;
|
||||||
ret = SDL_RenderTexture(renderer, tface, NULL, &rect);
|
ret = SDL_RenderTexture(renderer, tface, NULL, &rect);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
checkFailCount2++;
|
checkFailCount2++;
|
||||||
|
@ -768,8 +768,8 @@ static int render_testBlitBlend(void *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Blitting. */
|
/* Blitting. */
|
||||||
rect.x = i;
|
rect.x = (float)i;
|
||||||
rect.y = j;
|
rect.y = (float)j;
|
||||||
ret = SDL_RenderTexture(renderer, tface, NULL, &rect);
|
ret = SDL_RenderTexture(renderer, tface, NULL, &rect);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
checkFailCount4++;
|
checkFailCount4++;
|
||||||
|
@ -803,7 +803,7 @@ static int render_testBlitBlend(void *arg)
|
||||||
static int render_testViewport(void *arg)
|
static int render_testViewport(void *arg)
|
||||||
{
|
{
|
||||||
SDL_Surface *referenceSurface;
|
SDL_Surface *referenceSurface;
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
|
|
||||||
viewport.x = TESTRENDER_SCREEN_W / 3;
|
viewport.x = TESTRENDER_SCREEN_W / 3;
|
||||||
viewport.y = TESTRENDER_SCREEN_H / 3;
|
viewport.y = TESTRENDER_SCREEN_H / 3;
|
||||||
|
@ -813,12 +813,7 @@ static int render_testViewport(void *arg)
|
||||||
/* Create expected result */
|
/* Create expected result */
|
||||||
referenceSurface = SDL_CreateSurface(TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, RENDER_COMPARE_FORMAT);
|
referenceSurface = SDL_CreateSurface(TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, RENDER_COMPARE_FORMAT);
|
||||||
CHECK_FUNC(SDL_FillSurfaceRect, (referenceSurface, NULL, RENDER_COLOR_CLEAR))
|
CHECK_FUNC(SDL_FillSurfaceRect, (referenceSurface, NULL, RENDER_COLOR_CLEAR))
|
||||||
SDL_Rect v;
|
CHECK_FUNC(SDL_FillSurfaceRect, (referenceSurface, &viewport, RENDER_COLOR_GREEN))
|
||||||
v.x = (int)viewport.x;
|
|
||||||
v.y = (int)viewport.y;
|
|
||||||
v.w = (int)viewport.w;
|
|
||||||
v.h = (int)viewport.h;
|
|
||||||
CHECK_FUNC(SDL_FillSurfaceRect, (referenceSurface, &v, RENDER_COLOR_GREEN))
|
|
||||||
|
|
||||||
/* Clear surface. */
|
/* Clear surface. */
|
||||||
clearScreen();
|
clearScreen();
|
||||||
|
@ -865,7 +860,7 @@ static int render_testViewport(void *arg)
|
||||||
static int render_testClipRect(void *arg)
|
static int render_testClipRect(void *arg)
|
||||||
{
|
{
|
||||||
SDL_Surface *referenceSurface;
|
SDL_Surface *referenceSurface;
|
||||||
SDL_FRect cliprect;
|
SDL_Rect cliprect;
|
||||||
|
|
||||||
cliprect.x = TESTRENDER_SCREEN_W / 3;
|
cliprect.x = TESTRENDER_SCREEN_W / 3;
|
||||||
cliprect.y = TESTRENDER_SCREEN_H / 3;
|
cliprect.y = TESTRENDER_SCREEN_H / 3;
|
||||||
|
@ -875,12 +870,7 @@ static int render_testClipRect(void *arg)
|
||||||
/* Create expected result */
|
/* Create expected result */
|
||||||
referenceSurface = SDL_CreateSurface(TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, RENDER_COMPARE_FORMAT);
|
referenceSurface = SDL_CreateSurface(TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, RENDER_COMPARE_FORMAT);
|
||||||
CHECK_FUNC(SDL_FillSurfaceRect, (referenceSurface, NULL, RENDER_COLOR_CLEAR))
|
CHECK_FUNC(SDL_FillSurfaceRect, (referenceSurface, NULL, RENDER_COLOR_CLEAR))
|
||||||
SDL_Rect c;
|
CHECK_FUNC(SDL_FillSurfaceRect, (referenceSurface, &cliprect, RENDER_COLOR_GREEN))
|
||||||
c.x = (int)cliprect.x;
|
|
||||||
c.y = (int)cliprect.y;
|
|
||||||
c.w = (int)cliprect.w;
|
|
||||||
c.h = (int)cliprect.h;
|
|
||||||
CHECK_FUNC(SDL_FillSurfaceRect, (referenceSurface, &c, RENDER_COLOR_GREEN))
|
|
||||||
|
|
||||||
/* Clear surface. */
|
/* Clear surface. */
|
||||||
clearScreen();
|
clearScreen();
|
||||||
|
@ -927,9 +917,9 @@ static int render_testClipRect(void *arg)
|
||||||
static int render_testLogicalSize(void *arg)
|
static int render_testLogicalSize(void *arg)
|
||||||
{
|
{
|
||||||
SDL_Surface *referenceSurface;
|
SDL_Surface *referenceSurface;
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
SDL_FRect rect;
|
SDL_FRect rect;
|
||||||
float w, h;
|
int w, h;
|
||||||
const int factor = 2;
|
const int factor = 2;
|
||||||
|
|
||||||
viewport.x = ((TESTRENDER_SCREEN_W / 4) / factor) * factor;
|
viewport.x = ((TESTRENDER_SCREEN_W / 4) / factor) * factor;
|
||||||
|
@ -940,12 +930,7 @@ static int render_testLogicalSize(void *arg)
|
||||||
/* Create expected result */
|
/* Create expected result */
|
||||||
referenceSurface = SDL_CreateSurface(TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, RENDER_COMPARE_FORMAT);
|
referenceSurface = SDL_CreateSurface(TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, RENDER_COMPARE_FORMAT);
|
||||||
CHECK_FUNC(SDL_FillSurfaceRect, (referenceSurface, NULL, RENDER_COLOR_CLEAR))
|
CHECK_FUNC(SDL_FillSurfaceRect, (referenceSurface, NULL, RENDER_COLOR_CLEAR))
|
||||||
SDL_Rect v;
|
CHECK_FUNC(SDL_FillSurfaceRect, (referenceSurface, &viewport, RENDER_COLOR_GREEN))
|
||||||
v.x = (int)viewport.x;
|
|
||||||
v.y = (int)viewport.y;
|
|
||||||
v.w = (int)viewport.w;
|
|
||||||
v.h = (int)viewport.h;
|
|
||||||
CHECK_FUNC(SDL_FillSurfaceRect, (referenceSurface, &v, RENDER_COLOR_GREEN))
|
|
||||||
|
|
||||||
/* Clear surface. */
|
/* Clear surface. */
|
||||||
clearScreen();
|
clearScreen();
|
||||||
|
@ -956,10 +941,10 @@ static int render_testLogicalSize(void *arg)
|
||||||
SDL_LOGICAL_PRESENTATION_LETTERBOX,
|
SDL_LOGICAL_PRESENTATION_LETTERBOX,
|
||||||
SDL_SCALEMODE_NEAREST))
|
SDL_SCALEMODE_NEAREST))
|
||||||
CHECK_FUNC(SDL_SetRenderDrawColor, (renderer, 0, 255, 0, SDL_ALPHA_OPAQUE))
|
CHECK_FUNC(SDL_SetRenderDrawColor, (renderer, 0, 255, 0, SDL_ALPHA_OPAQUE))
|
||||||
rect.x = viewport.x / factor;
|
rect.x = (float)viewport.x / factor;
|
||||||
rect.y = viewport.y / factor;
|
rect.y = (float)viewport.y / factor;
|
||||||
rect.w = viewport.w / factor;
|
rect.w = (float)viewport.w / factor;
|
||||||
rect.h = viewport.h / factor;
|
rect.h = (float)viewport.h / factor;
|
||||||
CHECK_FUNC(SDL_RenderFillRect, (renderer, &rect))
|
CHECK_FUNC(SDL_RenderFillRect, (renderer, &rect))
|
||||||
CHECK_FUNC(SDL_SetRenderLogicalPresentation, (renderer, 0, 0,
|
CHECK_FUNC(SDL_SetRenderLogicalPresentation, (renderer, 0, 0,
|
||||||
SDL_LOGICAL_PRESENTATION_DISABLED,
|
SDL_LOGICAL_PRESENTATION_DISABLED,
|
||||||
|
@ -1002,11 +987,7 @@ static int render_testLogicalSize(void *arg)
|
||||||
|
|
||||||
/* Create expected result */
|
/* Create expected result */
|
||||||
CHECK_FUNC(SDL_FillSurfaceRect, (referenceSurface, NULL, RENDER_COLOR_CLEAR))
|
CHECK_FUNC(SDL_FillSurfaceRect, (referenceSurface, NULL, RENDER_COLOR_CLEAR))
|
||||||
v.x = (int)viewport.x;
|
CHECK_FUNC(SDL_FillSurfaceRect, (referenceSurface, &viewport, RENDER_COLOR_GREEN))
|
||||||
v.y = (int)viewport.y;
|
|
||||||
v.w = (int)viewport.w;
|
|
||||||
v.h = (int)viewport.h;
|
|
||||||
CHECK_FUNC(SDL_FillSurfaceRect, (referenceSurface, &v, RENDER_COLOR_GREEN))
|
|
||||||
|
|
||||||
/* Clear surface. */
|
/* Clear surface. */
|
||||||
clearScreen();
|
clearScreen();
|
||||||
|
|
|
@ -234,7 +234,8 @@ int SDL_AppIterate(void *appstate)
|
||||||
SDL_SetRenderDrawColor(renderer, 0x99, 0x99, 0x99, 255);
|
SDL_SetRenderDrawColor(renderer, 0x99, 0x99, 0x99, 255);
|
||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
|
|
||||||
float win_w, win_h, tw, th;
|
int win_w, win_h;
|
||||||
|
float tw, th;
|
||||||
SDL_FRect d;
|
SDL_FRect d;
|
||||||
Uint64 timestampNS = 0;
|
Uint64 timestampNS = 0;
|
||||||
SDL_Surface *frame_next = camera ? SDL_AcquireCameraFrame(camera, ×tampNS) : NULL;
|
SDL_Surface *frame_next = camera ? SDL_AcquireCameraFrame(camera, ×tampNS) : NULL;
|
||||||
|
|
|
@ -2088,7 +2088,7 @@ int main(int argc, char *argv[])
|
||||||
SDL_RenderPresent(screen);
|
SDL_RenderPresent(screen);
|
||||||
|
|
||||||
/* scale for platforms that don't give you the window size you asked for. */
|
/* scale for platforms that don't give you the window size you asked for. */
|
||||||
SDL_SetRenderLogicalPresentation(screen, SCREEN_WIDTH, SCREEN_HEIGHT,
|
SDL_SetRenderLogicalPresentation(screen, (int)SCREEN_WIDTH, (int)SCREEN_HEIGHT,
|
||||||
SDL_LOGICAL_PRESENTATION_LETTERBOX,
|
SDL_LOGICAL_PRESENTATION_LETTERBOX,
|
||||||
SDL_SCALEMODE_LINEAR);
|
SDL_SCALEMODE_LINEAR);
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ static void DrawPoints(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
float x, y;
|
float x, y;
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
|
|
||||||
/* Query the sizes */
|
/* Query the sizes */
|
||||||
SDL_GetRenderViewport(renderer, &viewport);
|
SDL_GetRenderViewport(renderer, &viewport);
|
||||||
|
@ -75,8 +75,8 @@ static void DrawPoints(SDL_Renderer *renderer)
|
||||||
SDL_SetRenderDrawColor(renderer, 255, (Uint8)current_color,
|
SDL_SetRenderDrawColor(renderer, 255, (Uint8)current_color,
|
||||||
(Uint8)current_color, (Uint8)current_alpha);
|
(Uint8)current_color, (Uint8)current_alpha);
|
||||||
|
|
||||||
x = (float)(rand() % (int)viewport.w);
|
x = (float)(rand() % viewport.w);
|
||||||
y = (float)(rand() % (int)viewport.h);
|
y = (float)(rand() % viewport.h);
|
||||||
SDL_RenderPoint(renderer, x, y);
|
SDL_RenderPoint(renderer, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ static void DrawLines(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
float x1, y1, x2, y2;
|
float x1, y1, x2, y2;
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
|
|
||||||
/* Query the sizes */
|
/* Query the sizes */
|
||||||
SDL_GetRenderViewport(renderer, &viewport);
|
SDL_GetRenderViewport(renderer, &viewport);
|
||||||
|
@ -118,15 +118,15 @@ static void DrawLines(SDL_Renderer *renderer)
|
||||||
(Uint8)current_color, (Uint8)current_alpha);
|
(Uint8)current_color, (Uint8)current_alpha);
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
SDL_RenderLine(renderer, 0.0f, 0.0f, (viewport.w - 1), (viewport.h - 1));
|
SDL_RenderLine(renderer, 0.0f, 0.0f, (float)(viewport.w - 1), (float)(viewport.h - 1));
|
||||||
SDL_RenderLine(renderer, 0.0f, (viewport.h - 1), (viewport.w - 1), 0.0f);
|
SDL_RenderLine(renderer, 0.0f, (float)(viewport.h - 1), (float)(viewport.w - 1), 0.0f);
|
||||||
SDL_RenderLine(renderer, 0.0f, (viewport.h / 2), (viewport.w - 1), (viewport.h / 2));
|
SDL_RenderLine(renderer, 0.0f, (float)(viewport.h / 2), (float)(viewport.w - 1), (float)(viewport.h / 2));
|
||||||
SDL_RenderLine(renderer, (viewport.w / 2), 0.0f, (viewport.w / 2), (viewport.h - 1));
|
SDL_RenderLine(renderer, (float)(viewport.w / 2), 0.0f, (float)(viewport.w / 2), (float)(viewport.h - 1));
|
||||||
} else {
|
} else {
|
||||||
x1 = ((rand() % ((int)viewport.w * 2)) - viewport.w);
|
x1 = (float)((rand() % (viewport.w * 2)) - viewport.w);
|
||||||
x2 = ((rand() % ((int)viewport.w * 2)) - viewport.w);
|
x2 = (float)((rand() % (viewport.w * 2)) - viewport.w);
|
||||||
y1 = ((rand() % ((int)viewport.h * 2)) - viewport.h);
|
y1 = (float)((rand() % (viewport.h * 2)) - viewport.h);
|
||||||
y2 = ((rand() % ((int)viewport.h * 2)) - viewport.h);
|
y2 = (float)((rand() % (viewport.h * 2)) - viewport.h);
|
||||||
SDL_RenderLine(renderer, x1, y1, x2, y2);
|
SDL_RenderLine(renderer, x1, y1, x2, y2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ static void DrawRects(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
SDL_FRect rect;
|
SDL_FRect rect;
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
|
|
||||||
/* Query the sizes */
|
/* Query the sizes */
|
||||||
SDL_GetRenderViewport(renderer, &viewport);
|
SDL_GetRenderViewport(renderer, &viewport);
|
||||||
|
@ -168,10 +168,10 @@ static void DrawRects(SDL_Renderer *renderer)
|
||||||
SDL_SetRenderDrawColor(renderer, 255, (Uint8)current_color,
|
SDL_SetRenderDrawColor(renderer, 255, (Uint8)current_color,
|
||||||
(Uint8)current_color, (Uint8)current_alpha);
|
(Uint8)current_color, (Uint8)current_alpha);
|
||||||
|
|
||||||
rect.w = (float)(rand() % ((int)viewport.h / 2));
|
rect.w = (float)(rand() % (viewport.h / 2));
|
||||||
rect.h = (float)(rand() % ((int)viewport.h / 2));
|
rect.h = (float)(rand() % (viewport.h / 2));
|
||||||
rect.x = ((rand() % ((int)viewport.w * 2) - viewport.w) - (rect.w / 2));
|
rect.x = (float)((rand() % (viewport.w * 2) - viewport.w) - (rect.w / 2));
|
||||||
rect.y = ((rand() % ((int)viewport.h * 2) - viewport.h) - (rect.h / 2));
|
rect.y = (float)((rand() % (viewport.h * 2) - viewport.h) - (rect.h / 2));
|
||||||
SDL_RenderFillRect(renderer, &rect);
|
SDL_RenderFillRect(renderer, &rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ static void DrawChessBoard(void)
|
||||||
{
|
{
|
||||||
int row = 0, column = 0, x = 0;
|
int row = 0, column = 0, x = 0;
|
||||||
SDL_FRect rect;
|
SDL_FRect rect;
|
||||||
SDL_FRect darea;
|
SDL_Rect darea;
|
||||||
|
|
||||||
/* Get the Size of drawing surface */
|
/* Get the Size of drawing surface */
|
||||||
SDL_GetRenderViewport(renderer, &darea);
|
SDL_GetRenderViewport(renderer, &darea);
|
||||||
|
@ -43,10 +43,10 @@ static void DrawChessBoard(void)
|
||||||
for (; column < 4 + (row % 2); column++) {
|
for (; column < 4 + (row % 2); column++) {
|
||||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF);
|
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF);
|
||||||
|
|
||||||
rect.w = (darea.w / 8);
|
rect.w = (float)(darea.w / 8);
|
||||||
rect.h = (darea.h / 8);
|
rect.h = (float)(darea.h / 8);
|
||||||
rect.x = (x * rect.w);
|
rect.x = (float)(x * rect.w);
|
||||||
rect.y = (row * rect.h);
|
rect.y = (float)(row * rect.h);
|
||||||
x = x + 2;
|
x = x + 2;
|
||||||
SDL_RenderFillRect(renderer, &rect);
|
SDL_RenderFillRect(renderer, &rect);
|
||||||
|
|
||||||
|
|
|
@ -252,7 +252,7 @@ static SDL_Texture *CreateTexture(SDL_Renderer *r, unsigned char *data, unsigned
|
||||||
|
|
||||||
static void MoveSprite(void)
|
static void MoveSprite(void)
|
||||||
{
|
{
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
SDL_FRect *position, *velocity;
|
SDL_FRect *position, *velocity;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1484,12 +1484,12 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Position sprites and set their velocities */
|
/* Position sprites and set their velocities */
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
SDL_GetRenderViewport(renderer, &viewport);
|
SDL_GetRenderViewport(renderer, &viewport);
|
||||||
srand((unsigned int)time(NULL));
|
srand((unsigned int)time(NULL));
|
||||||
for (i = 0; i < num_sprites; ++i) {
|
for (i = 0; i < num_sprites; ++i) {
|
||||||
positions[i].x = (float)(rand() % (int)(viewport.w - sprite_w));
|
positions[i].x = (float)(rand() % (viewport.w - sprite_w));
|
||||||
positions[i].y = (float)(rand() % (int)(viewport.h - sprite_h));
|
positions[i].y = (float)(rand() % (viewport.h - sprite_h));
|
||||||
positions[i].w = (float)sprite_w;
|
positions[i].w = (float)sprite_w;
|
||||||
positions[i].h = (float)sprite_h;
|
positions[i].h = (float)sprite_h;
|
||||||
velocities[i].x = 0.0f;
|
velocities[i].x = 0.0f;
|
||||||
|
|
|
@ -121,11 +121,11 @@ static void loop(void)
|
||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
|
|
||||||
{
|
{
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
SDL_Vertex verts[3];
|
SDL_Vertex verts[3];
|
||||||
float a;
|
float a;
|
||||||
float d;
|
float d;
|
||||||
float cx, cy;
|
int cx, cy;
|
||||||
|
|
||||||
/* Query the sizes */
|
/* Query the sizes */
|
||||||
SDL_GetRenderViewport(renderer, &viewport);
|
SDL_GetRenderViewport(renderer, &viewport);
|
||||||
|
|
|
@ -45,7 +45,7 @@ static void DrawPoints(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
float x, y;
|
float x, y;
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
|
|
||||||
/* Query the sizes */
|
/* Query the sizes */
|
||||||
SDL_GetRenderViewport(renderer, &viewport);
|
SDL_GetRenderViewport(renderer, &viewport);
|
||||||
|
@ -77,8 +77,8 @@ static void DrawPoints(SDL_Renderer *renderer)
|
||||||
SDL_SetRenderDrawColor(renderer, 255, (Uint8)current_color,
|
SDL_SetRenderDrawColor(renderer, 255, (Uint8)current_color,
|
||||||
(Uint8)current_color, (Uint8)current_alpha);
|
(Uint8)current_color, (Uint8)current_alpha);
|
||||||
|
|
||||||
x = (float)(rand() % (int)viewport.w);
|
x = (float)(rand() % viewport.w);
|
||||||
y = (float)(rand() % (int)viewport.h);
|
y = (float)(rand() % viewport.h);
|
||||||
SDL_RenderPoint(renderer, x, y);
|
SDL_RenderPoint(renderer, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ static int add_line(float x1, float y1, float x2, float y2)
|
||||||
static void DrawLines(SDL_Renderer *renderer)
|
static void DrawLines(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
|
|
||||||
/* Query the sizes */
|
/* Query the sizes */
|
||||||
SDL_GetRenderViewport(renderer, &viewport);
|
SDL_GetRenderViewport(renderer, &viewport);
|
||||||
|
@ -116,10 +116,10 @@ static void DrawLines(SDL_Renderer *renderer)
|
||||||
|
|
||||||
for (i = 0; i < num_lines; ++i) {
|
for (i = 0; i < num_lines; ++i) {
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
SDL_RenderLine(renderer, 0.0f, 0.0f, (viewport.w - 1), (viewport.h - 1));
|
SDL_RenderLine(renderer, 0.0f, 0.0f, (float)(viewport.w - 1), (float)(viewport.h - 1));
|
||||||
SDL_RenderLine(renderer, 0.0f, (viewport.h - 1), (viewport.w - 1), 0.0f);
|
SDL_RenderLine(renderer, 0.0f, (float)(viewport.h - 1), (float)(viewport.w - 1), 0.0f);
|
||||||
SDL_RenderLine(renderer, 0.0f, (viewport.h / 2), (viewport.w - 1), (viewport.h / 2));
|
SDL_RenderLine(renderer, 0.0f, (float)(viewport.h / 2), (float)(viewport.w - 1), (float)(viewport.h / 2));
|
||||||
SDL_RenderLine(renderer, (viewport.w / 2), 0.0f, (viewport.w / 2), (viewport.h - 1));
|
SDL_RenderLine(renderer, (float)(viewport.w / 2), 0.0f, (float)(viewport.w / 2), (float)(viewport.h - 1));
|
||||||
} else {
|
} else {
|
||||||
SDL_RenderLine(renderer, lines[i].x, lines[i].y, lines[i].w, lines[i].h);
|
SDL_RenderLine(renderer, lines[i].x, lines[i].y, lines[i].w, lines[i].h);
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,7 +401,7 @@ static void HandleKeyboardKeyDown(SDL_KeyboardEvent *event)
|
||||||
case SDLK_RIGHT:
|
case SDLK_RIGHT:
|
||||||
keyboard_state->position.x += CURSOR_SIZE;
|
keyboard_state->position.x += CURSOR_SIZE;
|
||||||
if (keyboard_state->position.x > w) {
|
if (keyboard_state->position.x > w) {
|
||||||
keyboard_state->position.x = w;
|
keyboard_state->position.x = (float)w;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDLK_UP:
|
case SDLK_UP:
|
||||||
|
@ -413,7 +413,7 @@ static void HandleKeyboardKeyDown(SDL_KeyboardEvent *event)
|
||||||
case SDLK_DOWN:
|
case SDLK_DOWN:
|
||||||
keyboard_state->position.y += CURSOR_SIZE;
|
keyboard_state->position.y += CURSOR_SIZE;
|
||||||
if (keyboard_state->position.y > h) {
|
if (keyboard_state->position.y > h) {
|
||||||
keyboard_state->position.y = h;
|
keyboard_state->position.y = (float)h;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -65,7 +65,7 @@ static void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite)
|
||||||
{
|
{
|
||||||
float sprite_w, sprite_h;
|
float sprite_w, sprite_h;
|
||||||
int i;
|
int i;
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
SDL_FRect *position, *velocity;
|
SDL_FRect *position, *velocity;
|
||||||
|
|
||||||
/* Query the sizes */
|
/* Query the sizes */
|
||||||
|
|
|
@ -52,7 +52,7 @@ static void loop(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < state->num_windows; ++i) {
|
for (i = 0; i < state->num_windows; ++i) {
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
SDL_Renderer *renderer = state->renderers[i];
|
SDL_Renderer *renderer = state->renderers[i];
|
||||||
if (state->windows[i] == NULL) {
|
if (state->windows[i] == NULL) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -49,14 +49,14 @@ quit(int rc)
|
||||||
|
|
||||||
static void Draw(DrawState *s)
|
static void Draw(DrawState *s)
|
||||||
{
|
{
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
SDL_Texture *target;
|
SDL_Texture *target;
|
||||||
SDL_FPoint *center = NULL;
|
SDL_FPoint *center = NULL;
|
||||||
SDL_FPoint origin = { 0.0f, 0.0f };
|
SDL_FPoint origin = { 0.0f, 0.0f };
|
||||||
|
|
||||||
SDL_GetRenderViewport(s->renderer, &viewport);
|
SDL_GetRenderViewport(s->renderer, &viewport);
|
||||||
|
|
||||||
target = SDL_CreateTexture(s->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, (int)viewport.w, (int)viewport.h);
|
target = SDL_CreateTexture(s->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, viewport.w, viewport.h);
|
||||||
SDL_SetRenderTarget(s->renderer, target);
|
SDL_SetRenderTarget(s->renderer, target);
|
||||||
|
|
||||||
/* Draw the background */
|
/* Draw the background */
|
||||||
|
@ -75,8 +75,8 @@ static void Draw(DrawState *s)
|
||||||
s->scale_direction = 1;
|
s->scale_direction = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s->sprite_rect.x = ((viewport.w - s->sprite_rect.w) / 2);
|
s->sprite_rect.x = (float)((viewport.w - s->sprite_rect.w) / 2);
|
||||||
s->sprite_rect.y = ((viewport.h - s->sprite_rect.h) / 2);
|
s->sprite_rect.y = (float)((viewport.h - s->sprite_rect.h) / 2);
|
||||||
|
|
||||||
SDL_RenderTextureRotated(s->renderer, s->sprite, NULL, &s->sprite_rect, (double)s->sprite_rect.w, center, SDL_FLIP_NONE);
|
SDL_RenderTextureRotated(s->renderer, s->sprite, NULL, &s->sprite_rect, (double)s->sprite_rect.w, center, SDL_FLIP_NONE);
|
||||||
|
|
||||||
|
@ -135,7 +135,6 @@ int main(int argc, char *argv[])
|
||||||
drawstates = SDL_stack_alloc(DrawState, state->num_windows);
|
drawstates = SDL_stack_alloc(DrawState, state->num_windows);
|
||||||
for (i = 0; i < state->num_windows; ++i) {
|
for (i = 0; i < state->num_windows; ++i) {
|
||||||
DrawState *drawstate = &drawstates[i];
|
DrawState *drawstate = &drawstates[i];
|
||||||
float w, h;
|
|
||||||
|
|
||||||
drawstate->window = state->windows[i];
|
drawstate->window = state->windows[i];
|
||||||
drawstate->renderer = state->renderers[i];
|
drawstate->renderer = state->renderers[i];
|
||||||
|
@ -144,9 +143,7 @@ int main(int argc, char *argv[])
|
||||||
if (!drawstate->sprite || !drawstate->background) {
|
if (!drawstate->sprite || !drawstate->background) {
|
||||||
quit(2);
|
quit(2);
|
||||||
}
|
}
|
||||||
SDL_GetTextureSize(drawstate->sprite, &w, &h);
|
SDL_GetTextureSize(drawstate->sprite, &drawstate->sprite_rect.w, &drawstate->sprite_rect.h);
|
||||||
drawstate->sprite_rect.w = w;
|
|
||||||
drawstate->sprite_rect.h = h;
|
|
||||||
drawstate->scale_direction = 1;
|
drawstate->scale_direction = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ quit(int rc)
|
||||||
static SDL_bool
|
static SDL_bool
|
||||||
DrawComposite(DrawState *s)
|
DrawComposite(DrawState *s)
|
||||||
{
|
{
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
SDL_FRect R;
|
SDL_FRect R;
|
||||||
SDL_Texture *target;
|
SDL_Texture *target;
|
||||||
SDL_Surface *surface;
|
SDL_Surface *surface;
|
||||||
|
@ -91,7 +91,7 @@ DrawComposite(DrawState *s)
|
||||||
|
|
||||||
SDL_GetRenderViewport(s->renderer, &viewport);
|
SDL_GetRenderViewport(s->renderer, &viewport);
|
||||||
|
|
||||||
target = SDL_CreateTexture(s->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, (int)viewport.w, (int)viewport.h);
|
target = SDL_CreateTexture(s->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, viewport.w, viewport.h);
|
||||||
SDL_SetTextureBlendMode(target, SDL_BLENDMODE_BLEND);
|
SDL_SetTextureBlendMode(target, SDL_BLENDMODE_BLEND);
|
||||||
SDL_SetRenderTarget(s->renderer, target);
|
SDL_SetRenderTarget(s->renderer, target);
|
||||||
|
|
||||||
|
@ -113,8 +113,8 @@ DrawComposite(DrawState *s)
|
||||||
s->scale_direction = 1;
|
s->scale_direction = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s->sprite_rect.x = ((viewport.w - s->sprite_rect.w) / 2);
|
s->sprite_rect.x = (float)((viewport.w - s->sprite_rect.w) / 2);
|
||||||
s->sprite_rect.y = ((viewport.h - s->sprite_rect.h) / 2);
|
s->sprite_rect.y = (float)((viewport.h - s->sprite_rect.h) / 2);
|
||||||
|
|
||||||
SDL_RenderTexture(s->renderer, s->sprite, NULL, &s->sprite_rect);
|
SDL_RenderTexture(s->renderer, s->sprite, NULL, &s->sprite_rect);
|
||||||
|
|
||||||
|
@ -141,12 +141,12 @@ DrawComposite(DrawState *s)
|
||||||
static SDL_bool
|
static SDL_bool
|
||||||
Draw(DrawState *s)
|
Draw(DrawState *s)
|
||||||
{
|
{
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
SDL_Texture *target;
|
SDL_Texture *target;
|
||||||
|
|
||||||
SDL_GetRenderViewport(s->renderer, &viewport);
|
SDL_GetRenderViewport(s->renderer, &viewport);
|
||||||
|
|
||||||
target = SDL_CreateTexture(s->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, (int)viewport.w, (int)viewport.h);
|
target = SDL_CreateTexture(s->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, viewport.w, viewport.h);
|
||||||
if (!target) {
|
if (!target) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create render target texture: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create render target texture: %s\n", SDL_GetError());
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
|
@ -168,8 +168,8 @@ Draw(DrawState *s)
|
||||||
s->scale_direction = 1;
|
s->scale_direction = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s->sprite_rect.x = ((viewport.w - s->sprite_rect.w) / 2);
|
s->sprite_rect.x = (float)((viewport.w - s->sprite_rect.w) / 2);
|
||||||
s->sprite_rect.y = ((viewport.h - s->sprite_rect.h) / 2);
|
s->sprite_rect.y = (float)((viewport.h - s->sprite_rect.h) / 2);
|
||||||
|
|
||||||
SDL_RenderTexture(s->renderer, s->sprite, NULL, &s->sprite_rect);
|
SDL_RenderTexture(s->renderer, s->sprite, NULL, &s->sprite_rect);
|
||||||
|
|
||||||
|
@ -251,7 +251,6 @@ int main(int argc, char *argv[])
|
||||||
drawstates = SDL_stack_alloc(DrawState, state->num_windows);
|
drawstates = SDL_stack_alloc(DrawState, state->num_windows);
|
||||||
for (i = 0; i < state->num_windows; ++i) {
|
for (i = 0; i < state->num_windows; ++i) {
|
||||||
DrawState *drawstate = &drawstates[i];
|
DrawState *drawstate = &drawstates[i];
|
||||||
float w, h;
|
|
||||||
|
|
||||||
drawstate->window = state->windows[i];
|
drawstate->window = state->windows[i];
|
||||||
drawstate->renderer = state->renderers[i];
|
drawstate->renderer = state->renderers[i];
|
||||||
|
@ -264,9 +263,7 @@ int main(int argc, char *argv[])
|
||||||
if (!drawstate->sprite || !drawstate->background) {
|
if (!drawstate->sprite || !drawstate->background) {
|
||||||
quit(2);
|
quit(2);
|
||||||
}
|
}
|
||||||
SDL_GetTextureSize(drawstate->sprite, &w, &h);
|
SDL_GetTextureSize(drawstate->sprite, &drawstate->sprite_rect.w, &drawstate->sprite_rect.h);
|
||||||
drawstate->sprite_rect.w = w;
|
|
||||||
drawstate->sprite_rect.h = h;
|
|
||||||
drawstate->scale_direction = 1;
|
drawstate->scale_direction = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ quit(int rc)
|
||||||
|
|
||||||
static void Draw(DrawState *s)
|
static void Draw(DrawState *s)
|
||||||
{
|
{
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
|
|
||||||
SDL_GetRenderViewport(s->renderer, &viewport);
|
SDL_GetRenderViewport(s->renderer, &viewport);
|
||||||
|
|
||||||
|
@ -68,8 +68,8 @@ static void Draw(DrawState *s)
|
||||||
s->scale_direction = 1;
|
s->scale_direction = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s->sprite_rect.x = ((viewport.w - s->sprite_rect.w) / 2);
|
s->sprite_rect.x = (float)((viewport.w - s->sprite_rect.w) / 2);
|
||||||
s->sprite_rect.y = ((viewport.h - s->sprite_rect.h) / 2);
|
s->sprite_rect.y = (float)((viewport.h - s->sprite_rect.h) / 2);
|
||||||
|
|
||||||
SDL_RenderTexture(s->renderer, s->sprite, NULL, &s->sprite_rect);
|
SDL_RenderTexture(s->renderer, s->sprite, NULL, &s->sprite_rect);
|
||||||
|
|
||||||
|
@ -126,7 +126,6 @@ int main(int argc, char *argv[])
|
||||||
drawstates = SDL_stack_alloc(DrawState, state->num_windows);
|
drawstates = SDL_stack_alloc(DrawState, state->num_windows);
|
||||||
for (i = 0; i < state->num_windows; ++i) {
|
for (i = 0; i < state->num_windows; ++i) {
|
||||||
DrawState *drawstate = &drawstates[i];
|
DrawState *drawstate = &drawstates[i];
|
||||||
float w, h;
|
|
||||||
|
|
||||||
drawstate->window = state->windows[i];
|
drawstate->window = state->windows[i];
|
||||||
drawstate->renderer = state->renderers[i];
|
drawstate->renderer = state->renderers[i];
|
||||||
|
@ -135,9 +134,7 @@ int main(int argc, char *argv[])
|
||||||
if (!drawstate->sprite || !drawstate->background) {
|
if (!drawstate->sprite || !drawstate->background) {
|
||||||
quit(2);
|
quit(2);
|
||||||
}
|
}
|
||||||
SDL_GetTextureSize(drawstate->sprite, &w, &h);
|
SDL_GetTextureSize(drawstate->sprite, &drawstate->sprite_rect.w, &drawstate->sprite_rect.h);
|
||||||
drawstate->sprite_rect.w = w;
|
|
||||||
drawstate->sprite_rect.h = h;
|
|
||||||
drawstate->scale_direction = 1;
|
drawstate->scale_direction = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ static int LoadSprite(const char *file)
|
||||||
static void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite)
|
static void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
SDL_FRect viewport;
|
SDL_Rect viewport;
|
||||||
SDL_FRect temp;
|
SDL_FRect temp;
|
||||||
SDL_FRect *position, *velocity;
|
SDL_FRect *position, *velocity;
|
||||||
|
|
||||||
|
@ -120,9 +120,9 @@ static void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite)
|
||||||
/* Test points */
|
/* Test points */
|
||||||
SDL_SetRenderDrawColor(renderer, 0xFF, 0x00, 0x00, 0xFF);
|
SDL_SetRenderDrawColor(renderer, 0xFF, 0x00, 0x00, 0xFF);
|
||||||
SDL_RenderPoint(renderer, 0.0f, 0.0f);
|
SDL_RenderPoint(renderer, 0.0f, 0.0f);
|
||||||
SDL_RenderPoint(renderer, (viewport.w - 1), 0.0f);
|
SDL_RenderPoint(renderer, (float)(viewport.w - 1), 0.0f);
|
||||||
SDL_RenderPoint(renderer, 0.0f, (viewport.h - 1));
|
SDL_RenderPoint(renderer, 0.0f, (float)(viewport.h - 1));
|
||||||
SDL_RenderPoint(renderer, (viewport.w - 1), (viewport.h - 1));
|
SDL_RenderPoint(renderer, (float)(viewport.w - 1), (float)(viewport.h - 1));
|
||||||
|
|
||||||
/* Test horizontal and vertical lines */
|
/* Test horizontal and vertical lines */
|
||||||
SDL_SetRenderDrawColor(renderer, 0x00, 0xFF, 0x00, 0xFF);
|
SDL_SetRenderDrawColor(renderer, 0x00, 0xFF, 0x00, 0xFF);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
static SDLTest_CommonState *state;
|
static SDLTest_CommonState *state;
|
||||||
|
|
||||||
static SDL_FRect viewport;
|
static SDL_Rect viewport;
|
||||||
static int done, j;
|
static int done, j;
|
||||||
static SDL_bool use_target = SDL_FALSE;
|
static SDL_bool use_target = SDL_FALSE;
|
||||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||||
|
@ -47,7 +47,7 @@ quit(int rc)
|
||||||
static void DrawOnViewport(SDL_Renderer *renderer)
|
static void DrawOnViewport(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
SDL_FRect rect;
|
SDL_FRect rect;
|
||||||
SDL_FRect cliprect;
|
SDL_Rect cliprect;
|
||||||
float w, h;
|
float w, h;
|
||||||
|
|
||||||
/* Set the viewport */
|
/* Set the viewport */
|
||||||
|
@ -59,47 +59,47 @@ static void DrawOnViewport(SDL_Renderer *renderer)
|
||||||
|
|
||||||
/* Test inside points */
|
/* Test inside points */
|
||||||
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0x00, 0xFF);
|
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0x00, 0xFF);
|
||||||
SDL_RenderPoint(renderer, (viewport.h / 2 + 20), (viewport.w / 2));
|
SDL_RenderPoint(renderer, (float)(viewport.h / 2 + 20), (float)(viewport.w / 2));
|
||||||
SDL_RenderPoint(renderer, (viewport.h / 2 - 20), (viewport.w / 2));
|
SDL_RenderPoint(renderer, (float)(viewport.h / 2 - 20), (float)(viewport.w / 2));
|
||||||
SDL_RenderPoint(renderer, (viewport.h / 2), (viewport.w / 2 - 20));
|
SDL_RenderPoint(renderer, (float)(viewport.h / 2), (float)(viewport.w / 2 - 20));
|
||||||
SDL_RenderPoint(renderer, (viewport.h / 2), (viewport.w / 2 + 20));
|
SDL_RenderPoint(renderer, (float)(viewport.h / 2), (float)(viewport.w / 2 + 20));
|
||||||
|
|
||||||
/* Test horizontal and vertical lines */
|
/* Test horizontal and vertical lines */
|
||||||
SDL_SetRenderDrawColor(renderer, 0x00, 0xFF, 0x00, 0xFF);
|
SDL_SetRenderDrawColor(renderer, 0x00, 0xFF, 0x00, 0xFF);
|
||||||
SDL_RenderLine(renderer, 1.0f, 0.0f, (viewport.w - 2), 0.0f);
|
SDL_RenderLine(renderer, 1.0f, 0.0f, (float)(viewport.w - 2), 0.0f);
|
||||||
SDL_RenderLine(renderer, 1.0f, (viewport.h - 1), (viewport.w - 2), (viewport.h - 1));
|
SDL_RenderLine(renderer, 1.0f, (float)(viewport.h - 1), (float)(viewport.w - 2), (float)(viewport.h - 1));
|
||||||
SDL_RenderLine(renderer, 0.0f, 1.0f, 0.0f, (viewport.h - 2));
|
SDL_RenderLine(renderer, 0.0f, 1.0f, 0.0f, (float)(viewport.h - 2));
|
||||||
SDL_RenderLine(renderer, (viewport.w - 1), 1.0f, (viewport.w - 1), (viewport.h - 2));
|
SDL_RenderLine(renderer, (float)(viewport.w - 1), 1.0f, (float)(viewport.w - 1), (float)(viewport.h - 2));
|
||||||
|
|
||||||
/* Test diagonal lines */
|
/* Test diagonal lines */
|
||||||
SDL_SetRenderDrawColor(renderer, 0x00, 0xff, 0xFF, 0xFF);
|
SDL_SetRenderDrawColor(renderer, 0x00, 0xff, 0xFF, 0xFF);
|
||||||
SDL_RenderLine(renderer, 0.0f, 0.0f, (viewport.w - 1), (viewport.h - 1));
|
SDL_RenderLine(renderer, 0.0f, 0.0f, (float)(viewport.w - 1), (float)(viewport.h - 1));
|
||||||
SDL_RenderLine(renderer, (viewport.w - 1), 0.0f, 0.0f, (viewport.h - 1));
|
SDL_RenderLine(renderer, (float)(viewport.w - 1), 0.0f, 0.0f, (float)(viewport.h - 1));
|
||||||
|
|
||||||
/* Test outside points */
|
/* Test outside points */
|
||||||
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0x00, 0xFF);
|
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0x00, 0xFF);
|
||||||
SDL_RenderPoint(renderer, (viewport.h / 2 + viewport.h), (viewport.w / 2));
|
SDL_RenderPoint(renderer, (float)(viewport.h / 2 + viewport.h), (float)(viewport.w / 2));
|
||||||
SDL_RenderPoint(renderer, (viewport.h / 2 - viewport.h), (viewport.w / 2));
|
SDL_RenderPoint(renderer, (float)(viewport.h / 2 - viewport.h), (float)(viewport.w / 2));
|
||||||
SDL_RenderPoint(renderer, (viewport.h / 2), (viewport.w / 2 - viewport.w));
|
SDL_RenderPoint(renderer, (float)(viewport.h / 2), (float)(viewport.w / 2 - viewport.w));
|
||||||
SDL_RenderPoint(renderer, (viewport.h / 2), (viewport.w / 2 + viewport.w));
|
SDL_RenderPoint(renderer, (float)(viewport.h / 2), (float)(viewport.w / 2 + viewport.w));
|
||||||
|
|
||||||
/* Add a box at the top */
|
/* Add a box at the top */
|
||||||
rect.w = 8.0f;
|
rect.w = 8.0f;
|
||||||
rect.h = 8.0f;
|
rect.h = 8.0f;
|
||||||
rect.x = ((viewport.w - rect.w) / 2);
|
rect.x = (float)((viewport.w - rect.w) / 2);
|
||||||
rect.y = 0.0f;
|
rect.y = 0.0f;
|
||||||
SDL_RenderFillRect(renderer, &rect);
|
SDL_RenderFillRect(renderer, &rect);
|
||||||
|
|
||||||
/* Add a clip rect and fill it with the sprite */
|
/* Add a clip rect and fill it with the sprite */
|
||||||
SDL_GetTextureSize(sprite, &w, &h);
|
SDL_GetTextureSize(sprite, &w, &h);
|
||||||
cliprect.x = (viewport.w - w) / 2;
|
rect.x = (viewport.w - w) / 2;
|
||||||
cliprect.y = (viewport.h - h) / 2;
|
rect.y = (viewport.h - h) / 2;
|
||||||
cliprect.w = w;
|
rect.w = w;
|
||||||
cliprect.h = h;
|
rect.h = h;
|
||||||
rect.x = cliprect.x;
|
cliprect.x = (int)rect.x;
|
||||||
rect.y = cliprect.y;
|
cliprect.y = (int)rect.y;
|
||||||
rect.w = cliprect.w;
|
cliprect.w = (int)rect.w;
|
||||||
rect.h = cliprect.h;
|
cliprect.h = (int)rect.h;
|
||||||
SDL_SetRenderClipRect(renderer, &cliprect);
|
SDL_SetRenderClipRect(renderer, &cliprect);
|
||||||
SDL_RenderTexture(renderer, sprite, NULL, &rect);
|
SDL_RenderTexture(renderer, sprite, NULL, &rect);
|
||||||
SDL_SetRenderClipRect(renderer, NULL);
|
SDL_SetRenderClipRect(renderer, NULL);
|
||||||
|
@ -127,7 +127,7 @@ static void loop(void)
|
||||||
viewport.w = 100 + j * 50;
|
viewport.w = 100 + j * 50;
|
||||||
viewport.h = 100 + j * 50;
|
viewport.h = 100 + j * 50;
|
||||||
j = (j + 1) % 4;
|
j = (j + 1) % 4;
|
||||||
SDL_Log("Current Viewport x=%g y=%g w=%g h=%g", viewport.x, viewport.y, viewport.w, viewport.h);
|
SDL_Log("Current Viewport x=%i y=%i w=%i h=%i", viewport.x, viewport.y, viewport.w, viewport.h);
|
||||||
|
|
||||||
for (i = 0; i < state->num_windows; ++i) {
|
for (i = 0; i < state->num_windows; ++i) {
|
||||||
if (state->windows[i] == NULL) {
|
if (state->windows[i] == NULL) {
|
||||||
|
|
|
@ -225,7 +225,8 @@ static void loop(void)
|
||||||
SDL_Renderer *renderer = state->renderers[i];
|
SDL_Renderer *renderer = state->renderers[i];
|
||||||
if (window && renderer) {
|
if (window && renderer) {
|
||||||
float y = 0.0f;
|
float y = 0.0f;
|
||||||
SDL_FRect viewport, menurect;
|
SDL_Rect viewport;
|
||||||
|
SDL_FRect menurect;
|
||||||
|
|
||||||
SDL_GetRenderViewport(renderer, &viewport);
|
SDL_GetRenderViewport(renderer, &viewport);
|
||||||
|
|
||||||
|
@ -237,8 +238,8 @@ static void loop(void)
|
||||||
|
|
||||||
menurect.x = 0.0f;
|
menurect.x = 0.0f;
|
||||||
menurect.y = y;
|
menurect.y = y;
|
||||||
menurect.w = viewport.w;
|
menurect.w = (float)viewport.w;
|
||||||
menurect.h = viewport.h - y;
|
menurect.h = (float)viewport.h - y;
|
||||||
draw_modes_menu(window, renderer, menurect);
|
draw_modes_menu(window, renderer, menurect);
|
||||||
|
|
||||||
SDL_Delay(16);
|
SDL_Delay(16);
|
||||||
|
|
Loading…
Reference in New Issue