Commit 507026b6 authored by Linshizhi's avatar Linshizhi

Add Drawable.

parent 2cbc6266
#ifndef DRAWABLE_H
#define DRAWABLE_H
template <typename T>
class Drawable {
public:
bool draw(void *args) {
static_cast<T*>(this)->draw(args);
}
};
#endif /* DRAWABLE_H */
#include "canvas.h"
std::shared_ptr<Canvas> Canvas::MakeCanvas(int width, int height, PixelTypes pixType) {
}
#include <memory>
#include "Drawable.h"
#ifndef CANVAS_H
#define CANVAS_H
......@@ -8,8 +9,13 @@ enum PixelTypes {};
class Canvas {
public:
Canvas(int width, int height, PixelTypes pixType);
static std::shared_ptr<Canvas> MakeCanvas(int width, int height, PixelTypes pixType);
template<typename T>
bool draw(Drawable<T>* drawable);
protected:
Canvas(int width, int height, PixelTypes pixType);
};
#endif /* CANVAS_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment