Files
jdd_opendingux/source/common/destsurface.cpp

31 lines
556 B
C++

#include "destsurface.h"
#include "systempalette.h"
namespace DestSurface
{
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(uint32_t color)
{
SDL_memset(pixels, SystemPalette::getEntry(color), width*height);
}
uint8_t *getPixels()
{
return pixels;
}
int getWidth()
{
return width;
}
}