aboutsummaryrefslogtreecommitdiffstats
path: root/src/render.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/render.hpp')
-rw-r--r--src/render.hpp79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/render.hpp b/src/render.hpp
new file mode 100644
index 0000000..fa609a3
--- /dev/null
+++ b/src/render.hpp
@@ -0,0 +1,79 @@
+/**
+ * @file render.hpp
+ * Handles all in game rendering
+ *
+ * Copyright (C) 2019 Clyne Sullivan
+ * Copyright (C) 2019 Belle-Isle, Andrew <drumsetmonkey@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef RENDER_HPP_
+#define RENDER_HPP_
+
+#include <entityx/entityx.h>
+
+#include <shader.hpp>
+
+#include <SDL2/SDL.h>
+
+#define GLM_FORCE_RADIANS
+#include <glm/glm.hpp>
+#include <glm/gtc/matrix_transform.hpp>
+#include <glm/gtc/type_ptr.hpp>
+#include <glm/gtc/noise.hpp>
+
+class RenderSystem : public entityx::System<RenderSystem>
+{
+private:
+ constexpr static const char *title = "gamedev2";
+ constexpr static int width = 640;
+ constexpr static int height = 480;
+
+ std::unique_ptr<SDL_Window, void (*)(SDL_Window *)> window;
+ SDL_GLContext context;
+
+ Shader worldShader;
+public:
+ RenderSystem(void):
+ window(nullptr, SDL_DestroyWindow)
+ {}
+
+ ~RenderSystem(void)
+ {
+ SDL_GL_DeleteContext(context);
+ SDL_Quit();
+ }
+
+ /**
+ * Prepares the system for running.
+ */
+ void configure([[maybe_unused]]entityx::EntityManager& entities,
+ [[maybe_unused]]entityx::EventManager& events) final;
+
+ /**
+ * Updates the render system.
+ */
+ void update([[maybe_unused]] entityx::EntityManager& entites,
+ [[maybe_unused]] entityx::EventManager& events,
+ [[maybe_unused]] entityx::TimeDelta dt) final;
+
+ /**
+ * Initializes the rendering system
+ * @return Zero on success, non-zero on error
+ */
+ int init(void);
+};
+
+#endif//RENDER_HPP_