Просмотр исходного кода

Merge branch 'master' of https://github.com/taylor001/crown

mikymod 12 лет назад
Родитель
Сommit
bbbc3e9874

+ 3 - 9
engine/os/android/OsWindow.cpp

@@ -32,20 +32,14 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-static ANativeWindow* g_android_window = NULL;
+ANativeWindow* g_android_window = NULL;
 
 //-----------------------------------------------------------------------------
-OsWindow::OsWindow(uint32_t /*width*/, uint32_t /*height*/, uint32_t /*parent*/) :
-	m_x(0),
-	m_y(0),
-	m_width(0),
-	m_height(0)
+OsWindow::OsWindow(uint32_t /*width*/, uint32_t /*height*/, uint32_t /*parent*/)
+	: m_x(0), m_y(0), m_width(0), m_height(0)
 {
-
 	m_width = ANativeWindow_getWidth(g_android_window);
 	m_height = ANativeWindow_getHeight(g_android_window);
-
-    set_android_window(g_android_window);
 }
 
 //-----------------------------------------------------------------------------

+ 5 - 13
engine/renderers/gles/egl/GLContext.cpp

@@ -34,7 +34,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-static ANativeWindow* awindow;
+extern ANativeWindow* g_android_window;
 
 //-----------------------------------------------------------------------------
 static const char* egl_error_to_string(EGLint error)
@@ -71,16 +71,8 @@ static const char* egl_error_to_string(EGLint error)
 #endif
 
 //-----------------------------------------------------------------------------
-void set_android_window(ANativeWindow* window)
-{
-    CE_ASSERT_NOT_NULL(window);
-
-	awindow = window;
-}
-
-//-----------------------------------------------------------------------------
-GLContext::GLContext() :
-	num_configs(0)
+GLContext::GLContext()
+	: num_configs(0)
 {
 }
 
@@ -110,11 +102,11 @@ void GLContext::create_context()
     EGLint format;
 	EGL_CHECK(eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format));
 
-	ANativeWindow_setBuffersGeometry(awindow, 0, 0, format);
+	ANativeWindow_setBuffersGeometry(g_android_window, 0, 0, format);
 
     context = EGL_CHECK(eglCreateContext(display, config, EGL_NO_CONTEXT, attributes));
 
-	surface = EGL_CHECK(eglCreateWindowSurface(display, config, (EGLNativeWindowType)awindow, NULL));
+	surface = EGL_CHECK(eglCreateWindowSurface(display, config, (EGLNativeWindowType)g_android_window, NULL));
 
     EGL_CHECK(eglMakeCurrent(display, surface, surface, context));
 

+ 0 - 2
engine/renderers/gles/egl/GLContext.h

@@ -32,8 +32,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-void set_android_window(ANativeWindow* window);
-
 class GLContext
 {
 public: