mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-11 06:28:24 +02:00
SDL_RenderTexture() and SDL_RenderTextureRotated() take floating point source coordinates
See the discussion at https://discourse.libsdl.org/t/sdl-rendercopyf-uses-ints/36732/8
This commit is contained in:
@@ -330,8 +330,8 @@ static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_FRect *ds
|
||||
{
|
||||
SDL_Texture *texture;
|
||||
const Uint32 textureID = codepoint / UNIFONT_GLYPHS_IN_TEXTURE;
|
||||
SDL_Rect srcrect;
|
||||
srcrect.w = srcrect.h = 16;
|
||||
SDL_FRect srcrect;
|
||||
srcrect.w = srcrect.h = 16.0f;
|
||||
if (codepoint > UNIFONT_MAX_CODEPOINT) {
|
||||
return 0;
|
||||
}
|
||||
@@ -343,8 +343,8 @@ static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_FRect *ds
|
||||
texture = unifontTexture[UNIFONT_NUM_TEXTURES * rendererID + textureID];
|
||||
if (texture != NULL) {
|
||||
const Uint32 cInTex = codepoint % UNIFONT_GLYPHS_IN_TEXTURE;
|
||||
srcrect.x = cInTex % UNIFONT_GLYPHS_IN_ROW * 16;
|
||||
srcrect.y = cInTex / UNIFONT_GLYPHS_IN_ROW * 16;
|
||||
srcrect.x = (float)(cInTex % UNIFONT_GLYPHS_IN_ROW * 16);
|
||||
srcrect.y = (float)(cInTex / UNIFONT_GLYPHS_IN_ROW * 16);
|
||||
SDL_RenderTexture(state->renderers[rendererID], texture, &srcrect, dst);
|
||||
}
|
||||
return unifontGlyph[codepoint].width;
|
||||
|
||||
Reference in New Issue
Block a user