diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-04-29 14:51:55 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-04-29 14:51:55 -0400 |
| commit | 4700d22680347992f7c0a87715d162658eb6e4ef (patch) | |
| tree | 950533e250c62f0771ed48d1832b1d5ca3dc94c3 /renderer.c | |
| parent | a7284d1250b3605a471daddb9a214c2fa5978f82 (diff) | |
| download | volute-4700d22680347992f7c0a87715d162658eb6e4ef.zip | |
preserve image aspect ratio
Diffstat (limited to 'renderer.c')
| -rw-r--r-- | renderer.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -337,3 +337,13 @@ r_remove_icon(int id) { icon_list.idx--; } + +void +r_get_icon_size(int id, int *w, int *h) { + expect(id >= 0 && id < icon_list.idx); + + *w = *h = 0; + if (SDL_QueryTexture(icon_list.items[id], NULL, NULL, w, h) != 0) { + fprintf(stderr, "%s\n", SDL_GetError()); + } +} |