44 lines
731 B
C++
44 lines
731 B
C++
#include <SDL2/SDL.h>
|
|
#include <SDL2/SDL_gpu.h>
|
|
#include <iostream>
|
|
#include <strings.h>
|
|
#include <math.h>
|
|
|
|
#include "math/vec2.h"
|
|
#include "node.h"
|
|
|
|
#ifndef SPRITE_H
|
|
#define SPRITE_H
|
|
|
|
class Sprite : public Node {
|
|
public:
|
|
// Constructor and Destructor
|
|
explicit Sprite(const std::string &resource_path);
|
|
|
|
~Sprite();
|
|
|
|
// Methods
|
|
void update() override;
|
|
|
|
void pollInputs() override;
|
|
|
|
void free() override;
|
|
|
|
void setImage(GPU_Image *img);
|
|
|
|
void setImage(char *img_path);
|
|
|
|
void getImage(GPU_Image *image);
|
|
|
|
// Member Variables
|
|
double angle = 0;
|
|
Vec2 scale = Vec2(1, 1);
|
|
bool visible = true;
|
|
private:
|
|
GPU_Image *gpuImage;
|
|
GPU_Target *target_;
|
|
|
|
void render();
|
|
};
|
|
|
|
#endif |