diff libmlk-core/mlk/core/texture.c @ 613:f76cada0bbb2

misc: switch to SDL3
author David Demelier <markand@malikania.fr>
date Sun, 20 Aug 2023 11:14:58 +0200
parents 76ce31b0151f
children e16808365d42
line wrap: on
line diff
--- a/libmlk-core/mlk/core/texture.c	Sun Aug 20 10:48:57 2023 +0200
+++ b/libmlk-core/mlk/core/texture.c	Sun Aug 20 11:14:58 2023 +0200
@@ -101,14 +101,14 @@
 {
 	assert(tex);
 
-	SDL_Rect dst = {
+	SDL_FRect dst = {
 		.x = x,
 		.y = y,
 		.w = tex->w,
 		.h = tex->h
 	};
 
-	if (SDL_RenderCopy(MLK__RENDERER(), tex->handle, NULL, &dst) < 0)
+	if (SDL_RenderTexture(MLK__RENDERER(), tex->handle, NULL, &dst) < 0)
 		return mlk_errf("%s", SDL_GetError());
 
 	return 0;
@@ -126,20 +126,20 @@
                   unsigned dst_h,
                   double angle)
 {
-	const SDL_Rect src = {
+	const SDL_FRect src = {
 		.x = src_x,
 		.y = src_y,
 		.w = src_w,
 		.h = src_h
 	};
-	const SDL_Rect dst = {
+	const SDL_FRect dst = {
 		.x = dst_x,
 		.y = dst_y,
 		.w = dst_w,
 		.h = dst_h
 	};
 
-	if (SDL_RenderCopyEx(MLK__RENDERER(), tex->handle, &src, &dst, angle, NULL, SDL_FLIP_NONE) < 0)
+	if (SDL_RenderTextureRotated(MLK__RENDERER(), tex->handle, &src, &dst, angle, NULL, SDL_FLIP_NONE) < 0)
 		return mlk_errf("%s", SDL_GetError());
 
 	return 0;
@@ -172,7 +172,7 @@
 	tex->w = surface->w;
 	tex->h = surface->h;
 
-	SDL_FreeSurface(surface);
+	SDL_DestroySurface(surface);
 
 	return 0;
 }