diff options
Diffstat (limited to 'source/modules/asura-core/window')
-rw-r--r-- | source/modules/asura-core/window/window.cpp | 52 | ||||
-rw-r--r-- | source/modules/asura-core/window/window.h | 2 | ||||
-rw-r--r-- | source/modules/asura-core/window/window_impl_sdl.cpp | 34 | ||||
-rw-r--r-- | source/modules/asura-core/window/window_impl_sdl.h | 4 |
4 files changed, 46 insertions, 46 deletions
diff --git a/source/modules/asura-core/window/window.cpp b/source/modules/asura-core/window/window.cpp index 9dc247d..939e974 100644 --- a/source/modules/asura-core/window/window.cpp +++ b/source/modules/asura-core/window/window.cpp @@ -12,93 +12,93 @@ namespace AsuraEngine { Window::Window() - : mImpl(nullptr) + : m_Impl(nullptr) { } Window::~Window() { - if (mImpl) - delete mImpl; + if (m_Impl) + delete m_Impl; } #define try_init_window(impl) \ - if (!mImpl) \ + if (!m_Impl) \ { \ - mImpl = new impl(); \ - if (!mImpl->Init(config)) \ + m_Impl = new impl(); \ + if (!m_Impl->Init(config)) \ { \ - delete mImpl; \ - mImpl = nullptr; \ + delete m_Impl; \ + m_Impl = nullptr; \ } \ } bool Window::Init(const WindowConfig& config) { - ASSERT(!mImpl); + ASSERT(!m_Impl); #if ASURA_WINDOW_SDL try_init_window(WindowImplSDL); #endif - return mImpl != nullptr; + return m_Impl != nullptr; } void Window::Exit() { - if (mImpl) - delete mImpl; + if (m_Impl) + delete m_Impl; } void Window::SetPosition(int x, int y) { - ASSERT(mImpl); - mImpl->SetPosition(x, y); + ASSERT(m_Impl); + m_Impl->SetPosition(x, y); } void Window::SetTitle(const std::string& title) { - ASSERT(mImpl); - mImpl->SetTitils(title); + ASSERT(m_Impl); + m_Impl->SetTitils(title); } void Window::Show() { - ASSERT(mImpl); - mImpl->Show(); + ASSERT(m_Impl); + m_Impl->Show(); } void Window::Hide() { - ASSERT(mImpl); - mImpl->Hide(); + ASSERT(m_Impl); + m_Impl->Hide(); } void Window::SwapRenderBuffer() { - ASSERT(mImpl); - mImpl->SwapRenderBuffer(); + ASSERT(m_Impl); + m_Impl->SwapRenderBuffer(); } void Window::Clear(const AEGraphics::Color& col /*= AEGraphics::Color::Black*/) { - ASSERT(mImpl); + ASSERT(m_Impl); glClearColor(col.r, col.g, col.b, col.a); } //void Window::Clear(const Math::Recti& quad, const AEGraphics::Color& col /*= AEGraphics::Color::Black*/) //{ - // ASSERT(mImpl); + // ASSERT(m_Impl); //} void Window::Draw(const AEGraphics::Drawable* texture, const AEGraphics::RenderState& state) { - ASSERT(mImpl); + ASSERT(m_Impl); } /* void Window::Draw(const AEGraphics::Drawable* texture, const Math::Recti& quad, const AEGraphics::RenderState& state) { - ASSERT(mImpl); + ASSERT(m_Impl); } */ diff --git a/source/modules/asura-core/window/window.h b/source/modules/asura-core/window/window.h index 835535d..deffc10 100644 --- a/source/modules/asura-core/window/window.h +++ b/source/modules/asura-core/window/window.h @@ -90,7 +90,7 @@ namespace AsuraEngine private: - WindowImpl* mImpl; + WindowImpl* m_Impl; luaxport: diff --git a/source/modules/asura-core/window/window_impl_sdl.cpp b/source/modules/asura-core/window/window_impl_sdl.cpp index 2679bc1..29a7540 100644 --- a/source/modules/asura-core/window/window_impl_sdl.cpp +++ b/source/modules/asura-core/window/window_impl_sdl.cpp @@ -21,15 +21,15 @@ namespace AsuraEngine flag |= _sdl_flag WindowImplSDL::WindowImplSDL() - : mWnd(nullptr) - , mGLContext(0) + : m_Wnd(nullptr) + , m_GLContext(0) { } WindowImplSDL::~WindowImplSDL() { - SDL_GL_DeleteContext(mGLContext); - SDL_DestroyWindow(mWnd); + SDL_GL_DeleteContext(m_GLContext); + SDL_DestroyWindow(m_Wnd); SDL_FlushEvent(SDL_WINDOWEVENT); } @@ -65,9 +65,9 @@ namespace AsuraEngine SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 0); - mWnd = SDL_CreateWindow(config.title.c_str(), config.x, config.y, config.width, config.height, flag); + m_Wnd = SDL_CreateWindow(config.title.c_str(), config.x, config.y, config.width, config.height, flag); - if (!mWnd) + if (!m_Wnd) return false; // ͼ @@ -96,7 +96,7 @@ namespace AsuraEngine img->Unlock(); - SDL_SetWindowIcon(mWnd, surface); + SDL_SetWindowIcon(m_Wnd, surface); SDL_FreeSurface(surface); } } @@ -105,15 +105,15 @@ namespace AsuraEngine { } - mGLContext = SDL_GL_CreateContext(mWnd); + m_GLContext = SDL_GL_CreateContext(m_Wnd); - if (!mGLContext) + if (!m_GLContext) { - SDL_DestroyWindow(mWnd); + SDL_DestroyWindow(m_Wnd); return false; } - SDL_GL_MakeCurrent(mWnd, mGLContext); + SDL_GL_MakeCurrent(m_Wnd, m_GLContext); SDL_GL_SetSwapInterval(config.vsync ? 1 : 0); return true; @@ -121,32 +121,32 @@ namespace AsuraEngine void WindowImplSDL::SetSize(uint width, uint height) { - SDL_SetWindowSize(mWnd, width, height); + SDL_SetWindowSize(m_Wnd, width, height); } void WindowImplSDL::SetPosition(int x, int y) { - SDL_SetWindowPosition(mWnd, x, y); + SDL_SetWindowPosition(m_Wnd, x, y); } void WindowImplSDL::SetTitils(const std::string& title) { - SDL_SetWindowTitle(mWnd, title.c_str()); + SDL_SetWindowTitle(m_Wnd, title.c_str()); } void WindowImplSDL::Show() { - SDL_ShowWindow(mWnd); + SDL_ShowWindow(m_Wnd); } void WindowImplSDL::Hide() { - SDL_HideWindow(mWnd); + SDL_HideWindow(m_Wnd); } void WindowImplSDL::SwapRenderBuffer() { - SDL_GL_SwapWindow(mWnd); + SDL_GL_SwapWindow(m_Wnd); } } diff --git a/source/modules/asura-core/window/window_impl_sdl.h b/source/modules/asura-core/window/window_impl_sdl.h index de4cafb..1f4ea0e 100644 --- a/source/modules/asura-core/window/window_impl_sdl.h +++ b/source/modules/asura-core/window/window_impl_sdl.h @@ -34,8 +34,8 @@ namespace AsuraEngine private: - SDL_Window* mWnd; - SDL_GLContext mGLContext; + SDL_Window* m_Wnd; + SDL_GLContext m_GLContext; }; |