SDLPP: add texture flipping/rotation

This commit is contained in:
2021-04-29 13:06:37 +02:00
parent b611e2479a
commit ff741dd882
3 changed files with 52 additions and 5 deletions
+10
View File
@@ -8,6 +8,7 @@
#include "sdlpp_vector.hpp"
#include "sdlpp_visitor.hpp"
#include <SDL2/SDL_render.h>
#include <memory>
#include <vector>
@@ -111,6 +112,11 @@ public:
void animate( int ticks );
void visit( Visitor &visitor );
void setAlignment( ObjectAlignment horizontal, ObjectAlignment vertical );
void flipHorizontally();
void flipVertically();
void setRotationCenter( const Vec2D< double > &center );
void rotateClockwise( int angle );
void rotateCounterClockwise( int angle );
protected:
virtual void copyTo( std::shared_ptr< RenderObject > other );
@@ -140,6 +146,10 @@ protected:
int animation_next_frame_base = 0;
std::vector< SDL_Rect > animation{};
bool animating = true;
SDL_RendererFlip flip = SDL_FLIP_NONE;
Vec2D< double > rotation_center = { -1, -1 };
SDL_Point rotation_center_point;
int rotation_angle = 0;
private:
friend Scene;