Drawing/Renderer.h
Go to the documentation of this file.
1 /****
2  * Renderer.h
3  *
4  * Copyright 2021 mikee47 <mike@sillyhouse.net>
5  *
6  * This file is part of the Sming-Graphics Library
7  *
8  * This library is free software: you can redistribute it and/or modify it under the terms of the
9  * GNU General Public License as published by the Free Software Foundation, version 3 or later.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  * See the GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along with this library.
16  * If not, see <https://www.gnu.org/licenses/>.
17  *
18  * @author: May 2021 - mikee47 <mike@sillyhouse.net>
19  *
20  ****/
21 
22 #pragma once
23 
24 #include "../Renderer.h"
25 #include "Reader.h"
26 
27 namespace Graphics
28 {
29 namespace Drawing
30 {
34 class Renderer : public MultiRenderer
35 {
36 public:
37  Renderer(const Location& location, const DrawingObject& drawing) : MultiRenderer(location), reader(drawing)
38  {
39  }
40 
41 protected:
42  void renderDone(const Object* object) override
43  {
44  this->object.reset();
45  }
46 
47  const Object* getNextObject() override
48  {
49  object.reset(reader.readObject());
50  return object.get();
51  }
52 
53 private:
54  Drawing::Reader reader;
55  std::unique_ptr<Object> object;
56 };
57 
58 } // namespace Drawing
59 } // namespace Graphics
Definition: Virtual.h:30
void renderDone(const Object *object) override
Definition: Drawing/Renderer.h:99
Renderer(const Location &location, const DrawingObject &drawing)
Definition: Drawing/Renderer.h:94
const Object * getNextObject() override
Definition: Drawing/Renderer.h:104
Location location
Definition: Libraries/Graphics/src/include/Graphics/Object.h:109