stuff-from-scratch/src/graphics/DrawingSurface.cpp
2022-11-16 15:06:08 +00:00

51 lines
859 B
C++

#include "DrawingSurface.h"
#include "Image.h"
#include "Scene.h"
#include "RootNode.h"
DrawingSurface::DrawingSurface()
{
}
std::unique_ptr<DrawingSurface> DrawingSurface::Create()
{
return std::make_unique<DrawingSurface>();
}
void DrawingSurface::setSize(unsigned width, unsigned height)
{
mWidth = width;
mHeight = height;
}
unsigned DrawingSurface::getWidth() const
{
return mWidth;
}
unsigned DrawingSurface::getHeight() const
{
return mHeight;
}
Scene* DrawingSurface::getScene()
{
if (!mScene)
{
mScene = std::make_unique<Scene>();
}
return mScene.get();
}
Image<unsigned char>* DrawingSurface::getImage()
{
if (!mBackingImage)
{
mBackingImage = std::make_unique<Image<unsigned char> >(mWidth, mHeight);
mBackingImage->initialize();
}
return mBackingImage.get();
}