- Canvis que vaig fer fa 2 messos, però no sé en què estava pensant, he de arreglar-ho.

This commit is contained in:
2023-02-13 11:50:37 +01:00
parent d230259e42
commit 908ffa6d55
5 changed files with 62 additions and 22 deletions

View File

@@ -1,16 +1,30 @@
#include "destsurface.h"
#include "systempalette.h"
namespace DestSurface
{
void Init(SDL_Renderer *renderer, SDL_Texture *texture) {
uint8_t *pixels = nullptr;
int width, height;
void init(int width, int height)
{
if (pixels==nullptr) pixels = new uint8_t[width*height];
DestSurface::width = width;
DestSurface::height = height;
}
void Clear() {
void clear(uint32_t color)
{
SDL_memset(pixels, SystemPalette::getEntry(color), width*height);
}
uint32_t *getPixels() {
uint8_t *getPixels()
{
return pixels;
}
int getWidth()
{
return width;
}
}