mirror of https://github.com/axmolengine/axmol.git
issue #2460: optimize EGLView interface
This commit is contained in:
parent
d73b8e8b23
commit
99f88df8d2
|
@ -132,9 +132,13 @@ EGLView::~EGLView()
|
|||
s_pEglView = nullptr;
|
||||
}
|
||||
|
||||
bool EGLView::create()
|
||||
bool EGLView::init(const char* viewName, float width, float height)
|
||||
{
|
||||
if(nullptr != _mainWindow) return true;
|
||||
|
||||
setViewName(viewName);
|
||||
setFrameSize(width, height);
|
||||
|
||||
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
||||
_mainWindow = glfwCreateWindow(_screenSize.width, _screenSize.height, _viewName, nullptr, nullptr);
|
||||
glfwMakeContextCurrent(_mainWindow);
|
||||
|
|
|
@ -32,8 +32,7 @@ public:
|
|||
virtual void setFrameSize(float width, float height);
|
||||
virtual void setIMEKeyboardState(bool bOpen);
|
||||
|
||||
//void setWndProc(CUSTOM_WND_PROC proc);
|
||||
virtual bool create();
|
||||
bool init(const char* viewName, float width, float height);
|
||||
public:
|
||||
|
||||
//void resize(int width, int height);
|
||||
|
|
|
@ -44,8 +44,7 @@ public:
|
|||
virtual void setFrameSize(float width, float height);
|
||||
virtual void setIMEKeyboardState(bool bOpen);
|
||||
|
||||
//void setWndProc(CUSTOM_WND_PROC proc);
|
||||
virtual bool create();
|
||||
bool init(const char* viewName, float width, float height);
|
||||
public:
|
||||
|
||||
//void resize(int width, int height);
|
||||
|
|
|
@ -149,9 +149,13 @@ EGLView::~EGLView()
|
|||
s_pEglView = nullptr;
|
||||
}
|
||||
|
||||
bool EGLView::create()
|
||||
bool EGLView::init(const char *viewName, float width, float height)
|
||||
{
|
||||
if(nullptr != _mainWindow) return true;
|
||||
|
||||
setViewName(viewName);
|
||||
setFrameSize(width, height);
|
||||
|
||||
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
||||
_mainWindow = glfwCreateWindow(_screenSize.width, _screenSize.height, _viewName, nullptr, nullptr);
|
||||
glfwMakeContextCurrent(_mainWindow);
|
||||
|
|
|
@ -245,9 +245,13 @@ EGLView::~EGLView()
|
|||
s_pEglView = nullptr;
|
||||
}
|
||||
|
||||
bool EGLView::create()
|
||||
bool EGLView::init(const char* viewName, float width, float height)
|
||||
{
|
||||
if(nullptr != _mainWindow) return true;
|
||||
|
||||
setViewName(viewName);
|
||||
setFrameSize(width, height);
|
||||
|
||||
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
||||
_mainWindow = glfwCreateWindow(_screenSize.width, _screenSize.height, _viewName, nullptr, nullptr);
|
||||
glfwMakeContextCurrent(_mainWindow);
|
||||
|
|
|
@ -49,8 +49,7 @@ public:
|
|||
virtual void setFrameSize(float width, float height);
|
||||
virtual void setIMEKeyboardState(bool bOpen);
|
||||
|
||||
//void setWndProc(CUSTOM_WND_PROC proc);
|
||||
virtual bool create();
|
||||
bool init(const char* viewName, float width, float height);
|
||||
public:
|
||||
|
||||
//void resize(int width, int height);
|
||||
|
|
|
@ -14,8 +14,6 @@ int main(int argc, char **argv)
|
|||
// create the application instance
|
||||
AppDelegate app;
|
||||
EGLView* eglView = new EGLView();
|
||||
eglView->setViewName("TestCpp");
|
||||
eglView->setFrameSize(900, 640);
|
||||
eglView->create();
|
||||
eglView->init("TestCPP",900,640);
|
||||
return Application::getInstance()->run();
|
||||
}
|
||||
|
|
|
@ -31,8 +31,6 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
AppDelegate app;
|
||||
EGLView* eglView = new EGLView();
|
||||
eglView->setViewName("TestCpp");
|
||||
eglView->setFrameSize(900, 640);
|
||||
eglView->create();
|
||||
eglView->init("TestCPP",900,640);
|
||||
return Application::getInstance()->run();
|
||||
}
|
||||
|
|
|
@ -14,9 +14,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
|||
|
||||
// create the application instance
|
||||
AppDelegate app;
|
||||
EGLView *eglView = new EGLView();
|
||||
eglView->setViewName("TestCpp");
|
||||
eglView->setFrameSize(480, 320);
|
||||
eglView->create();
|
||||
EGLView* eglView = new EGLView();
|
||||
eglView->init("TestCPP",900,640);
|
||||
return Application::getInstance()->run();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue