summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2019-01-25 13:15:29 +0100
committerNao Pross <naopross@thearcway.org>2019-01-25 13:15:29 +0100
commitffd6d847526561f03b47c7cb8895cca31f00ee25 (patch)
treefda782165b7535b65f8933aee1d13cd3409ed140
parentInterface basic renderer drawing functions (diff)
downloadlibwsdl2-ffd6d847526561f03b47c7cb8895cca31f00ee25.tar.gz
libwsdl2-ffd6d847526561f03b47c7cb8895cca31f00ee25.zip
Move renderer code in video.cpp to reflect header decl order
-rw-r--r--video.cpp80
1 files changed, 39 insertions, 41 deletions
diff --git a/video.cpp b/video.cpp
index 2425b10..47d5756 100644
--- a/video.cpp
+++ b/video.cpp
@@ -12,6 +12,45 @@ extern "C" {
using namespace wsdl2;
+/* class renderer */
+
+renderer::renderer() {
+ npdebug("warning: created uninitialized renderer object");
+}
+
+SDL_Renderer * renderer::sdl() {
+#ifndef DEBUG
+ if (m_renderer == NULL) {
+ throw std::runtime_error(
+ "attempted to call renderer::sdl() when m_renderer is NULL"
+ );
+ }
+#endif
+
+ return m_renderer;
+}
+
+void renderer::create_sdl_renderer(SDL_Window *win) {
+ // create a rendering contest
+ m_renderer = SDL_CreateRenderer(
+ win, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC
+ );
+
+ if (m_renderer == NULL) {
+ throw std::runtime_error("failed to create SDL renderer");
+ }
+}
+
+renderer::renderer(window& w) {
+ create_sdl_renderer(w.sdl());
+}
+
+renderer::~renderer() {
+ if (m_renderer != NULL)
+ SDL_DestroyRenderer(m_renderer);
+ else
+ npdebug("warning: m_renderer is NULL")
+}
/* class window */
@@ -78,44 +117,3 @@ SDL_Window * window::sdl() {
return m_window;
}
-
-
-/* class renderer */
-
-renderer::renderer() {
- npdebug("warning: created uninitialized renderer object");
-}
-
-SDL_Renderer * renderer::sdl() {
-#ifndef DEBUG
- if (m_renderer == NULL) {
- throw std::runtime_error(
- "attempted to call renderer::sdl() when m_renderer is NULL"
- );
- }
-#endif
-
- return m_renderer;
-}
-
-void renderer::create_sdl_renderer(SDL_Window *win) {
- // create a rendering contest
- m_renderer = SDL_CreateRenderer(
- win, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC
- );
-
- if (m_renderer == NULL) {
- throw std::runtime_error("failed to create SDL renderer");
- }
-}
-
-renderer::renderer(window& w) {
- create_sdl_renderer(w.sdl());
-}
-
-renderer::~renderer() {
- if (m_renderer != NULL)
- SDL_DestroyRenderer(m_renderer);
- else
- npdebug("warning: m_renderer is NULL")
-} \ No newline at end of file