29 lines
645 B
C++
29 lines
645 B
C++
#pragma once
|
|
#include <atomic>
|
|
|
|
#include "KTexture.h"
|
|
#include "KVector2d.h"
|
|
|
|
namespace KapitanGame
|
|
{
|
|
class KCamera;
|
|
|
|
class KDrawable
|
|
{
|
|
public:
|
|
KDrawable(const KVector2D& position, const KTexture& texture, SDL_Rect* tileClip, SDL_RendererFlip flip = SDL_FLIP_NONE);
|
|
virtual ~KDrawable() = default;
|
|
void Render(SDL_Renderer* renderer, const KCamera& camera, float parallaxFactor = 1.f) const;
|
|
[[nodiscard]] KVector2D GetPosition() const;
|
|
const int Id;
|
|
static std::atomic<int> IdCounter;
|
|
protected:
|
|
KVector2D Position{ 0.f, 0.f };
|
|
private:
|
|
const KTexture& Texture;
|
|
SDL_Rect* TileClip;
|
|
const SDL_RendererFlip Flip;
|
|
};
|
|
}
|
|
|