From 73d0d3f6a2b3c7afb7d66798e6fe8b39841c503c Mon Sep 17 00:00:00 2001
From: Nathan Renney <ng-renney@s-fet-dqfqqlvqkf.uwe.ac.uk>
Date: Fri, 9 Dec 2022 13:48:58 +0000
Subject: [PATCH] adding draw_image_with_rot(Image image, Rect src, Rect dest,
 double angle) function to allow for images to be rotated. This makes games
 like asteroids possible.

---
 include/app.hpp     | 4 ++++
 include/context.hpp | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/include/app.hpp b/include/app.hpp
index 3d13b91..6fc30b7 100644
--- a/include/app.hpp
+++ b/include/app.hpp
@@ -124,6 +124,10 @@ namespace uwe {
             context_.draw_image(image, src, dest);
         }
 
+        void draw_image_with_rot(Image image, Rect src, Rect dest, double angle) {
+            context_.draw_image_with_rot(image, src, dest, angle);
+        }
+
         void set_renderer_taret(Image image, bool clear) {
             SDL_SetRenderTarget(context_.get_renderer(), image);
             if (clear) {
diff --git a/include/context.hpp b/include/context.hpp
index b48cb91..f2a4720 100644
--- a/include/context.hpp
+++ b/include/context.hpp
@@ -165,6 +165,12 @@ namespace uwe {
             SDL_RenderCopy(renderer_, image, &src, &dest);
         }
 
+        void draw_image_with_rot(Image image, Rect src, Rect dest, double angle) {
+            SDL_RenderCopyEx(renderer_, image, &src, &dest, angle,
+                NULL,
+                SDL_FLIP_NONE);
+        }
+
         Font create_font(std::string path, int point_size, Colour colour) {
             auto font = FC_CreateFont();
             FC_LoadFont(
-- 
GitLab