ajout de Sprite et de TILES

This commit is contained in:
YANNIS
2025-05-31 19:49:26 +02:00
parent c3b47c30c4
commit 90c5485fc5
9 changed files with 46 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
#pragma once
#include <iostream>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
class Sprite {
private:
SDL_Surface* surface = nullptr;
SDL_Texture* texture = nullptr;
float posX = 0.0f;
float posY = 0.0f;
public:
Sprite() = default;
virtual ~Sprite() = default;
// Pure virtual function to be implemented by derived classes
virtual void draw() const = 0;
// Function to set the position of the sprite
virtual void setPosition(float x, float y) { posX = x; posY = y; }
// Function to get the current position of the sprite
virtual void getPosition(float &x, float &y) const { x = posX; y = posY; }
};