diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-09-09 07:55:22 +0100 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-09-09 07:55:22 +0100 |
commit | 60072c1d8089ffd3294e76636198d14710be95b8 (patch) | |
tree | 511d459e9afe69ca58d05880eb53ce44a9a183c6 /yage/base/window.h | |
parent | 660996bd750dbb5fcdce85845ee6b260f3ed23eb (diff) | |
download | YAGE-60072c1d8089ffd3294e76636198d14710be95b8.tar.gz YAGE-60072c1d8089ffd3294e76636198d14710be95b8.zip |
Restructuring
Diffstat (limited to 'yage/base/window.h')
-rw-r--r-- | yage/base/window.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/yage/base/window.h b/yage/base/window.h new file mode 100644 index 00000000..8639e075 --- /dev/null +++ b/yage/base/window.h @@ -0,0 +1,55 @@ +/* ---------------------------------------------------------------------------- + * window.h + * + * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com> -- MIT License + * See file LICENSE for more details + * ---------------------------------------------------------------------------- + */ + +#ifndef WINDOW_H +#define WINDOW_H + +#include <SDL2/SDL.h> + +#include <string> + +namespace yage +{ + +// window flags that can change it's appearance +enum WindowFlags : unsigned { + SHOWN = 0x1, + HIDDEN = 0x2, + FULLSCREEN = 0x4, + BORDERLESS = 0x8, +}; + +// window wrapper around SDL_Window pointer +class Window +{ +private: + /// window handle + SDL_Window *window_ = nullptr; + +public: + Window(); + Window(const Window &) = delete; + Window(Window &&) = delete; + /// destroys the window handle + ~Window(); + + Window &operator=(const Window &) = delete; + Window &operator=(Window &&) = delete; + + /// create the window, initialize the handle and update the width and height + void create(const std::string &window_name, int width, int height, + unsigned flags = WindowFlags::SHOWN); + /// swap the buffer + void swapBuffer(); + /// clear buffer + void clearBuffer(); +}; + +} // namespace yage + +#endif |