From e09c2211539f417474b1d3226f56f021938329bf Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 24 Sep 2013 18:56:24 +0300 Subject: [PATCH] Move struct VideoMode to its own header --- source/graphics/display.cpp | 6 ------ source/graphics/display.h | 20 +------------------- source/graphics/videomode.cpp | 12 ++++++++++++ source/graphics/videomode.h | 30 ++++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 25 deletions(-) create mode 100644 source/graphics/videomode.cpp create mode 100644 source/graphics/videomode.h diff --git a/source/graphics/display.cpp b/source/graphics/display.cpp index 42b0e8b..deaa5b5 100644 --- a/source/graphics/display.cpp +++ b/source/graphics/display.cpp @@ -1,4 +1,3 @@ -#include #include "display.h" #include "display_private.h" #include "window.h" @@ -8,11 +7,6 @@ using namespace std; namespace Msp { namespace Graphics { -unsupported_video_mode::unsupported_video_mode(const VideoMode &mode): - runtime_error(format("%dx%d", mode.width, mode.height)) -{ } - - void Display::add_window(Window &wnd) { priv->windows[wnd.get_private().window] = &wnd; diff --git a/source/graphics/display.h b/source/graphics/display.h index d311ba7..370bf0d 100644 --- a/source/graphics/display.h +++ b/source/graphics/display.h @@ -4,31 +4,13 @@ #include #include #include +#include "videomode.h" namespace Msp { namespace Graphics { class Window; -struct VideoMode -{ - unsigned width; - unsigned height; - unsigned rate; - - VideoMode(): width(0), height(0), rate(0) { } - VideoMode(unsigned w, unsigned h): width(w), height(h), rate(0) { } -}; - - -class unsupported_video_mode: public std::runtime_error -{ -public: - unsupported_video_mode(const VideoMode &); - virtual ~unsupported_video_mode() throw () { } -}; - - class Display { public: diff --git a/source/graphics/videomode.cpp b/source/graphics/videomode.cpp new file mode 100644 index 0000000..a07112a --- /dev/null +++ b/source/graphics/videomode.cpp @@ -0,0 +1,12 @@ +#include +#include "videomode.h" + +namespace Msp { +namespace Graphics { + +unsupported_video_mode::unsupported_video_mode(const VideoMode &mode): + runtime_error(format("%dx%d", mode.width, mode.height)) +{ } + +} // namespace Graphics +} // namespace Msp diff --git a/source/graphics/videomode.h b/source/graphics/videomode.h new file mode 100644 index 0000000..d883d17 --- /dev/null +++ b/source/graphics/videomode.h @@ -0,0 +1,30 @@ +#ifndef MSP_GRAPHICS_VIDEOMODE_H_ +#define MSP_GRAPHICS_VIDEOMODE_H_ + +namespace Msp { +namespace Graphics { + +struct VideoMode; + +class unsupported_video_mode: public std::runtime_error +{ +public: + unsupported_video_mode(const VideoMode &); + virtual ~unsupported_video_mode() throw () { } +}; + + +struct VideoMode +{ + unsigned width; + unsigned height; + unsigned rate; + + VideoMode(): width(0), height(0), rate(0) { } + VideoMode(unsigned w, unsigned h): width(w), height(h), rate(0) { } +}; + +} // namespace Graphics +} // namespace Msp + +#endif -- 2.43.0