From 75b3b53a522a77407dcb15fc87daa9936b24cade Mon Sep 17 00:00:00 2001
From: AnonymusRaccoon
Date: Wed, 5 Feb 2020 15:49:44 +0100
Subject: [PATCH] Adding a no renderer
---
CMakeLists.txt | 2 +-
sources/Renderer/NoRenderer.cpp | 31 ++++++++++++++++++++++++++++++
sources/Renderer/NoRenderer.hpp | 34 +++++++++++++++++++++++++++++++++
3 files changed, 66 insertions(+), 1 deletion(-)
create mode 100644 sources/Renderer/NoRenderer.cpp
create mode 100644 sources/Renderer/NoRenderer.hpp
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 77bbd3a..dd82dd5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,7 +41,7 @@ add_executable(unit_tests
sources/APU/DSP/DSP.hpp
sources/Memory/RectangleShadow.cpp
sources/Memory/RectangleShadow.hpp
-)
+ sources/Renderer/NoRenderer.cpp sources/Renderer/NoRenderer.hpp)
# include criterion & coverage
target_link_libraries(unit_tests criterion -lgcov)
diff --git a/sources/Renderer/NoRenderer.cpp b/sources/Renderer/NoRenderer.cpp
new file mode 100644
index 0000000..c518d38
--- /dev/null
+++ b/sources/Renderer/NoRenderer.cpp
@@ -0,0 +1,31 @@
+//
+// Created by anonymus-raccoon on 2/5/20.
+//
+
+#include "NoRenderer.hpp"
+
+namespace ComSquare::Renderer
+{
+ void NoRenderer::setWindowName(std::string newWindowName)
+ {
+ (void)newWindowName;
+ }
+
+ void NoRenderer::drawScreen() { }
+
+ void NoRenderer::putPixel(unsigned y, unsigned x, uint32_t rgba)
+ {
+ (void)x;
+ (void)y;
+ (void)rgba;
+ }
+
+ void NoRenderer::getEvents() { }
+
+ NoRenderer::NoRenderer(unsigned int height, unsigned int width, int maxFPS)
+ {
+ (void)height;
+ (void)width;
+ (void)maxFPS;
+ }
+}
\ No newline at end of file
diff --git a/sources/Renderer/NoRenderer.hpp b/sources/Renderer/NoRenderer.hpp
new file mode 100644
index 0000000..abf14e1
--- /dev/null
+++ b/sources/Renderer/NoRenderer.hpp
@@ -0,0 +1,34 @@
+//
+// Created by anonymus-raccoon on 2/5/20.
+//
+
+#ifndef COMSQUARE_NORENDERER_HPP
+#define COMSQUARE_NORENDERER_HPP
+
+#include "IRenderer.hpp"
+
+namespace ComSquare::Renderer
+{
+ class NoRenderer : public IRenderer {
+ public:
+ //! @brief Set a new name to the window, if there is already a name it will be overwrite.
+ //! @param newWindowName new title for the window.
+ void setWindowName(std::string newWindowName) override;
+ //! @brief Update the screen by printing the buffer.
+ void drawScreen() override;
+ //! @brief Add a pixel to the buffer to the coordinates x, y with the color rgba.
+ //! @param X horizontal index.
+ //! @param Y vertical index.
+ //! @param rgba The color of the pixel.
+ void putPixel(unsigned y, unsigned x, uint32_t rgba) override ;
+ //! @brief Get the inputs from the Window
+ void getEvents();
+ //! @brief Constructor that return the window component of the SFML.
+ //! @param height height of the window.
+ //! @param width width of the window.
+ //! @param maxFPS the number of maximum FPS for the window.
+ NoRenderer(unsigned int height, unsigned int width, int maxFPS);
+ };
+}
+
+#endif //COMSQUARE_NORENDERER_HPP