From fb7ae1149a80a22c77014d0ece33f6f4b965b631 Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 31 Mar 2019 14:34:40 +0800 Subject: *misc --- source/modules/asura-core/wnd/window.cpp | 108 +++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 source/modules/asura-core/wnd/window.cpp (limited to 'source/modules/asura-core/wnd/window.cpp') diff --git a/source/modules/asura-core/wnd/window.cpp b/source/modules/asura-core/wnd/window.cpp new file mode 100644 index 0000000..174d04e --- /dev/null +++ b/source/modules/asura-core/wnd/window.cpp @@ -0,0 +1,108 @@ +#include + +#include "window.h" + +#include "window_impl_sdl.h" +#include "window_impl_glew.h" +#include "window_impl_glut.h" + +namespace AsuraEngine +{ + namespace Wnd + { + + Window::Window() + : mImpl(nullptr) + { + } + + Window::~Window() + { + if (mImpl) + delete mImpl; + } + +#define try_init_window(impl) \ + if (!mImpl) \ + { \ + try \ + { \ + mImpl = new impl(config); \ + } \ + catch (Exception& e) \ + { \ + mImpl = nullptr; \ + } \ + } + + bool Window::Init(const WindowConfig& config) + { + ASSERT(!mImpl); +#if ASURA_WINDOW_SDL + try_init_window(WindowImplSDL); +#endif + ASSERT(mImpl); + } + + void Window::Exit() + { + if (mImpl) + delete mImpl; + } + + void Window::SetPosition(int x, int y) + { + ASSERT(mImpl); + mImpl->SetPosition(x, y); + } + + void Window::SetTitle(const std::string& title) + { + ASSERT(mImpl); + mImpl->SetTitils(title); + } + + void Window::Show() + { + ASSERT(mImpl); + mImpl->Show(); + } + + void Window::Hide() + { + ASSERT(mImpl); + mImpl->Hide(); + } + + void Window::SwapRenderBuffer() + { + ASSERT(mImpl); + mImpl->SwapRenderBuffer(); + } + + void Window::Clear(const AEGraphics::Color& col /*= AEGraphics::Color::Black*/) + { + ASSERT(mImpl); + + } + + void Window::Clear(const Math::Recti& quad, const AEGraphics::Color& col /*= AEGraphics::Color::Black*/) + { + ASSERT(mImpl); + + } + + void Window::Draw(const AEGraphics::Drawable* texture, const AEGraphics::RenderState& state) + { + ASSERT(mImpl); + + } + + void Window::Draw(const AEGraphics::Drawable* texture, const Math::Recti& quad, const AEGraphics::RenderState& state) + { + ASSERT(mImpl); + + } + + } +} -- cgit v1.1-26-g67d0