stuff-from-scratch/src/graphics/DrawingContext.h

34 lines
779 B
C
Raw Normal View History

2021-04-17 12:57:14 +00:00
#pragma once
#include <memory>
2022-05-15 13:58:31 +00:00
#include <vector>
2021-04-17 12:57:14 +00:00
class INativeDrawingContext;
2022-05-15 13:58:31 +00:00
class AbstractGeometricItem;
using AbstractGeometricItemPtr = std::unique_ptr<AbstractGeometricItem>;
2021-04-17 12:57:14 +00:00
class DrawingContext
{
public:
DrawingContext() = default;
static std::unique_ptr<DrawingContext> Create();
void SetNativeContext(std::unique_ptr<INativeDrawingContext> context);
INativeDrawingContext* GetNativeContext();
2022-05-15 13:58:31 +00:00
unsigned GetNumItems() const;
void AddDrawable(AbstractGeometricItemPtr item);
AbstractGeometricItem* GetDrawable(unsigned idx) const;
2021-04-17 12:57:14 +00:00
private:
2022-05-15 13:58:31 +00:00
std::vector<std::unique_ptr<AbstractGeometricItem> > mItems;
2021-04-17 12:57:14 +00:00
std::unique_ptr<INativeDrawingContext> mNativeDrawingContext;
};
using DrawingContextPtr = std::unique_ptr<DrawingContext>;